Generates (X)HTML5 documents from standalone reStructuredText sources
Project description
rst2html5 generates (X)HTML5 documents from standalone reStructuredText sources. It is a complete rewrite of the docutils’ rst2html and uses new HTML5 constructs as <section> and <aside>.
Usage
$ rst2html5 [options] <source>
Options:
- --stylesheet=<URL or path>
Specify comma separated list of stylesheet URLs.
- --script=<URL or path>
Specify comma separated list of script URLs.
- --no-indent
Don’t indent output
- --option-limit=<level>
Specify the maximum width (in characters) for options in option lists. Longer options will span an entire row of the table used to render the option list. Default is 0 characters which means “no limit”.
Examples
Consider the following rst snippet:
Title
=====
Some text and a target to `Title 2`_. **strong emphasis**:
* item 1
* item 2
Title 2
=======
.. parsed-literal::
Inline markup is supported, e.g. *emphasis*, **strong**, ``literal
text``,
_`hyperlink targets`, and `references <http://www.python.org/>`_
The html5 produced is clean and tidy:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<a id="title"></a>
<section>
<h1>Title</h1>
<p>Some text and a target to <a href="#title-2">Title 2</a>. <strong>strong emphasis</strong>:</p>
<ul>
<li>item 1</li>
<li>item 2</li>
</ul>
</section>
<a id="title-2"></a>
<section>
<h1>Title 2</h1>
<pre>Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <code>literal
text</code>,
<a id="hyperlink-targets">hyperlink targets</a>, and <a href="http://www.python.org/">references</a></pre>
</section>
</body>
</html>
No stylesheets or classes are spread over the html5 by default. However:
Stylesheets and javascritps URLs or paths can be included through stylesheet and script options:
$ rst2html5 example.rst --stylesheet "css/default.css, css/special/css" \ --script https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link href="css/default.css" rel="stylesheet" /> <link href="css/special/css" rel="stylesheet" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> </head> ...
Classes can be explicitly associated to rst elements (see ref):
.. class:: special This is a "special" paragraph. .. class:: exceptional remarkable An Exceptional Section ====================== This is an ordinary paragraph.
which results in:
<p class="special">This is a "special" paragraph.</p> <a id="an-exceptional-section"></a> <section class="exceptional remarkable"> <h1>An Exceptional Section</h1> <p>This is an ordinary paragraph.</p> </section>
Installation
$ pip install rst2html5
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
File details
Details for the file rst2html5-0.10.zip
.
File metadata
- Download URL: rst2html5-0.10.zip
- Upload date:
- Size: 53.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90ebbd135b77e9b2ea6a4fc9489badbd6b4728eb3f984e98e82c5b9fc83e41b4 |
|
MD5 | f470559c55e3251b854db0bd34a716af |
|
BLAKE2b-256 | a22134200fbee39852c0c41b2bfd8ce12c4f2adb4d683027b748928744b6f889 |
File details
Details for the file rst2html5-0.10.tar.gz
.
File metadata
- Download URL: rst2html5-0.10.tar.gz
- Upload date:
- Size: 43.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c59b46943bf6ead1b3ad456d8defad4241f8c4961692172bf5ef186fa122d415 |
|
MD5 | cb54a2656fd24ff10501d745e8c36f85 |
|
BLAKE2b-256 | 5f9f29e452cb3b1dd79d08f07e8f67e737271f15e7a0106b0df9c96ce1cecb63 |