• Stars
    star
    177
  • Rank 215,985 (Top 5 %)
  • Language
    HTML
  • License
    MIT License
  • Created about 13 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

transform restructuredtext documents to html5 + twitter's bootstrap css, deck.js or reveal.js

rst2html5 tools - RestructuredText to HTML5 + bootstrap css

We all love rst and the ability to generate any format, but the rst2html tool generates really basic html and css.

This tool will generate newer, nicer, more readable markup and provide ways to modify the output with extensions like nice css thanks to twitter's bootstrap css or online presentations with deck.js

get it

via pip:

pip install rst2html5-tools

locally:

git clone https://github.com/marianoguerra/rst2html5.git
cd rst2html5
git submodule init
git submodule update

sudo python setup.py install

use it

to generate a basic html document:

rst2html5 examples/slides.rst > clean.html

to generate a set of slides using deck.js:

rst2html5 --deck-js --pretty-print-code --embed-content examples/slides.rst > deck.html

to generate a set of slides using reveal.js:

rst2html5 --jquery --reveal-js --pretty-print-code examples/slides.rst > reveal.html

to generate a set of slides using impress.js:

rst2html5 --stylesheet-path=html5css3/thirdparty/impressjs/css/impress-demo.css --impress-js examples/impress.rst > output/impress.html

to generate a page using bootstrap:

rst2html5 --bootstrap-css --pretty-print-code --jquery --embed-content examples/slides.rst > bootstrap.html

to higlight code with pygments:

rst2html5 --pygments examples/codeblock.rst > code.html

note that you will have to add the stylesheet for the code to actually highlight, this just does the code parsing and html transformation.

to embed images inside the html file to have a single .html file to distribute add the --embed-images option.

post processors support optional parameters, they are passed with a command line option with the same name as the post processor appending "-opts" at the end, for example to change the revealjs theme you can do:

rst2html5 --jquery --reveal-js --reveal-js-opts theme=serif examples/slides.rst > reveal.html

you can also pass the base path to the theme css file:

rst2html5 --jquery --reveal-js --reveal-js-opts theme=serif,themepath=~/mytheme examples/slides.rst > reveal.html

it will look at the theme at ~/mytheme/serif.css

options are passed as a comma separated list of key value pairs separated with an equal sign, values are parsed as json, if parsing fails they are passed as strings, for example here is an example of options:

--some-processor-opts theme=serif,count=4,verbose=true,foo=null

if a key is passed more than once that parameter is passed to the processor as a list of values, note that if only one value is passed it's passed as it is, the convenience function as_list is provided to handle this case if you want to always receive a list.

to add custom js files to the resulting file you can use the --add-js post processor like this:

rst2html5 slides.rst --add-js --add-js-opts path=foo.js,path=bar.js

that command will add foo.js and bar.js as scripts in the resulting html file.

Pretty Print Code Notes

enable it:

--pretty-print-code

add language specific lexers:

--pretty-print-code-opts langs=clj:erlang

Note: you have to pass both options when passing opts to prettify like this:

--pretty-print-code --pretty-print-code-opts langs=clj:erlang

that is, the name of the languages separated by colons, available lexers at the moment of this writing are:

  • apollo
  • basic
  • clj
  • css
  • dart
  • erlang
  • go
  • hs
  • lisp
  • llvm
  • lua
  • matlab
  • ml
  • mumps
  • n
  • pascal
  • proto
  • rd
  • r
  • scala
  • sql
  • tcl
  • tex
  • vb
  • vhdl
  • wiki
  • xq
  • yaml

you can see the available lexers under html5css3/thirdparty/prettify/lang-*.js

RevealJs Notes

to print pass --reveal-js-opts printpdf=true, for example:

rst2html5 --jquery --reveal-js --reveal-js-opts printpdf=true examples/slides.rst > reveal-print.html

this can be used to open with chrome or chromium and print as pdf as described here: https://github.com/hakimel/reveal.js#pdf-export

Math Support

Use the math role and directive to include inline math and block-level equations into your document:

When :math`a \ne 0`, there are two solutions to :math:`ax^2 + bx + c = 0`
and they are

.. math::

   x = {-b \pm \sqrt{b^2-4ac} \over 2a}

Both of these support a basic subset of LaTeX syntax.

By default, MathJax is used for displaying math. You can choose a different output format using the --math-output command line option:

  • --math-output mathjax uses MathJax (the default)
  • --math-output html will use plain HTML + CSS
  • --math-output mathml will use MathML
  • --math-output latex outputs raw LaTeX

If you use MathJax, you can use the --mathjax-url and -mathjax-config command line options to configure a custom MathJax JavaScript URL and to provide a file with a custom MathJax configuration, respectively.

If you use HTML + CSS output, you can use the --math-css command line option to configure a custom math stylesheet.

Note that the old MathJax postprocessor (activated using --mathjax) has been deprecated.

see it

you can see the examples from the above commands here:

example of video directive

test it

We use tox to run our test suite. After installing tox you can execute the tests by running tox in the project's root directory.

The test cases can be found in html5css3/tests.py.

want to contribute ?

clone and send us a pull request!

git clone https://github.com/marianoguerra/rst2html5.git
cd rst2html5
git submodule update --init
python setup.py develop

note to self to release

  • update version on setup.py
python setup.py sdist upload

More Repositories

1

json.human.js

Convert JSON to human readable HTML
JavaScript
973
star
2

efene

OFICIAL REPO IS AT https://github.com/efene/efene
Erlang
145
star
3

hiapl

HTML Is A Programming Language
JavaScript
119
star
4

efe

Elixir Flavoured Erlang: an Erlang to Elixir Transpiler
Erlang
67
star
5

json-edit

schema to form + validation to json that conforms to schema
JavaScript
59
star
6

webshot

[experiment] a tool to take screenshots of websites to png and pdf using pygtk and python-webkit
Python
52
star
7

tanodb

distributed in memory key value store on top of riak_core, example for the little riak core book
Erlang
45
star
8

couchdb-for-openshift

just merge, push, sit and relax
Shell
44
star
9

flaviodb

Riak Core sample project implementing fixed message stream store
Erlang
38
star
10

little-riak-core-book

source of the little riak core book
HTML
33
star
11

future-of-coding-weekly

repository to work on future of coding weekly newsletter
HTML
32
star
12

jwt-erl

JSON Web Token implementation in Erlang
Erlang
30
star
13

interfix

an experimental programming language for the erlang vm that is actually useful
Erlang
29
star
14

ioriodb

Stream Store with HTTP/MQTT Pub/Sub
Erlang
28
star
15

rebar3_template_riak_core

A rebar3 template for riak_core applications
Erlang
28
star
16

ricardo-forth

Forth dialect implemented in C, Javascript, WebAssembly and compiled from C to asm.js and WebAssembly.
JavaScript
28
star
17

pshb-example

pubhubsubbub example
Python
27
star
18

erldn

edn format parser for the erlang platform
Erlang
27
star
19

otp.ex

Erlang/OTP transpiled to Elixir using EFE (Elixir Flavoured Erlang)
Elixir
24
star
20

sonic-blocks

Create music using sonic-pi and google's blockly visual programming language
JavaScript
24
star
21

pynerl

run an embeded python interpreter in erlang
C
22
star
22

qrly

jquery selectors for HTML & XML in erlang
Erlang
21
star
23

tubes

[use flask, abandoned, kept for historical reasons] a simple yet powerful REST microframework based on werkzeug
Python
19
star
24

SassPython

python bindings for libsass
Python
19
star
25

clj-rhino

simple api to use rhino from clojure
Clojure
16
star
26

erlplorer

search erlang & efene code by structure by providing expressions with "holes"
JavaScript
15
star
27

otl

Erlang
14
star
28

match

[kept for historical reasons, see efene] a calculator implemented in erlang that will turn into a toy language if I have time
Erlang
14
star
29

band-blocks

A blockly frontend for band.js
JavaScript
13
star
30

json-patch.erl

a json patch (RFC 6902) implementation for erlang data structures using jsx and dotto
Erlang
12
star
31

immutant-recipes

some small immutant repos that show how to do one thing
Clojure
11
star
32

pepete

[just an experiment] a JSON presentation tool for the interweb
JavaScript
11
star
33

erl_interface.rs

Rust wrapper to erl_interface C API
Rust
11
star
34

ast_walk

An Erlang library to walk the Erlang AST with the ability to mutate it and keep state during transversal
Erlang
10
star
35

rbac-lasp

Experimental RBAC library implemented in Lasp (lasp-lang.org)
Erlang
9
star
36

edis_proto

allow erlang/BEAM applications to expose a Redis compatible protocol
Erlang
9
star
37

beamdocs

a tool to generate data from beam langs to be used for docs/tools
JavaScript
8
star
38

dotto

data driven data structure manipulation library for erlang, a superset of RFC 6902 (JSON PATCH)
Erlang
8
star
39

mclulang

McLulang: The message is the language
JavaScript
8
star
40

rebar3_otp_templates

A repository with rebar3 templates for OTP behaviors
8
star
41

legojs

generate HTML using CSS-like selectors
JavaScript
8
star
42

friend-json-workflow

json auth workflow for cemerick/friend
Clojure
7
star
43

lpr

Local Process Registry: An ETS-backed process registry with an API that's a subset of https://github.com/ostinelli/syn
Erlang
7
star
44

ep

EXPERIMENTAL: erlang protocols
Erlang
6
star
45

einfo

An Erlang library, macros and parse transform for structured, standard errors with more context
Erlang
6
star
46

riak-core-tutorial

Riak Core Tutorial
HTML
6
star
47

google-docs-spreadsheets.clj

Library to interact with google spreadhsheets from clojure
Clojure
6
star
48

transito

Command Line Tool to translate between transit, edn and JSON
Python
6
star
49

squim

a kernel programming language implementation in js
JavaScript
5
star
50

plang

because the world needs another programming language
Python
5
star
51

PyGtkOnWindows

a sample project on how to create a pygtk application on windows, transform it to exe and make an installer and portable version
Python
5
star
52

exat

Easy Elixir Interoperability for Erlang
Erlang
5
star
53

ioriofn

ioriodb client and tests in efene
Erlang
5
star
54

fnt---efene-templates

jquery templates for erlang/efene
Erlang
4
star
55

rebar3_template_lasp

Rebar3 lasp template
Smarty
4
star
56

uniendo

meta dependency that makes it easy to use riak_core on partisan without doing rebar3/mix magic
Erlang
4
star
57

cadena

a step by step sample riak_ensemble application
Erlang
4
star
58

lager_exometer_backend

a lager backend that sends metrics to exometer with logs by level by time
Erlang
4
star
59

rebar3_template_partisan

Rebar3 partisan template
Smarty
4
star
60

wemesene

conquer the world style cloud mobile first p2p node js asyncronous actor based concurrent ACID compliant CAP theorem breaker object oriented MVC compliant dependency injected fully TDD BDD STD tested internet of thing enabled nosql cosql newsql out of the box bootstraped VC funded enterprise agile thing
4
star
61

example-phonegap-camera-get-file-size

Simple Phonegap Project to Show how to get a picture from the camera or gallery and then get the file size of the image
JavaScript
3
star
62

jsonpath-scala

jsonpath queries for json in scala
JavaScript
3
star
63

emel

generate HTML (or XML) using CSS-like selectors in erlang
Erlang
3
star
64

webvectors

an experiment using vector embeddings and t-SNE/UMAP to display embeddings in 3D using all-MiniLM-L6-v2 and transformers.js
JavaScript
3
star
65

rcs_cowboy

cowboy rest api to handle riak_core_security users, groups and grants, backend for iorioui
Erlang
3
star
66

klisp-zmq

zeromq bindings for klisp (a kernel programming language implementation)
C
3
star
67

adel

a markup/data expansion experiment
Erlang
3
star
68

requirejs-guide

a small starters guide to requirejs
JavaScript
3
star
69

webless

[see status in README] library to make headless server side website rendering and filtering using webkit and jquery and getting the results back with persistent links for the "mashups"
JavaScript
3
star
70

mqttl

Erlang embedable MQTT acceptor and behaviour to implement your own logic
Erlang
2
star
71

y

the last command you will use
Python
2
star
72

shard

Erlang library to shard work to child processes based on a hashing function
Erlang
2
star
73

jsonpath.js

modern and tested jsonpath implementation
JavaScript
2
star
74

pyadium-themes

[see README] a module to handle adium themes in python
Python
2
star
75

chachara

picoblogging app using flask/gae/pubsubhubbub
JavaScript
2
star
76

pipe.clj

library to build abstraction by composing small functions
Clojure
2
star
77

statsdump

simple rust cli tool to dump system stats as csv, useful to collect sample data for DATA SCIENCE (TM)
Rust
2
star
78

svg-color-picker

SVG based color picker for the web
JavaScript
2
star
79

fresita

you are not interested in this, historic purpose only
JavaScript
2
star
80

cowboy_exometer

erlang library to record generic cowboy metrics with exometer
Erlang
2
star
81

ikuste

write simple logic in vuejs views without writting javascript
JavaScript
2
star
82

nj-cards

Simple textual format to keep practice notes
JavaScript
2
star
83

akvs

A Key Value Store
Erlang
2
star
84

erlang-pbkdf2-no-history

basho/erlang-pbkdf2 repo withouth couchdb history to reduce repo size
Erlang
1
star
85

squide

visual editor for squim
JavaScript
1
star
86

yel

conquering the world, one command at a time
Python
1
star
87

hkwm

window manager attempt in rust (I don't know rust nor about window managers)
Rust
1
star
88

marianoguerra.github.io

my github site
HTML
1
star
89

intercaljs

manage callbacks, deferreds and resources with style
JavaScript
1
star
90

rate-meter.clj

measure ocurrence of things at custom granularities
Clojure
1
star
91

permiso

pluggable RBACish abstraction Erlang library (ets, dets, riak_core and ldap planned by default)
Erlang
1
star
92

MozartOnFire

A simple game to learn to read music sheets
Python
1
star
93

marianoguerra.github.com

my personal repo with a web frontend
JavaScript
1
star
94

rscbag

Erlang library to store resources in a simple memory kv store with plugable kv implementations and init them on get if not found
Erlang
1
star
95

lst

manage lists of things in the command line
Python
1
star
96

how-to-build-python

Code and instructions to build any python version on any platform (at least that's the idea)
Python
1
star
97

KafkaJS

Run simple Kafka Stream map Jobs using JVM's Nashorn JS Engine
Java
1
star
98

esper-hornetq

support CEP in your app talking to esper through hornetq (mainly from immutant)
Clojure
1
star
99

wedis

a redis like js api for the browser
JavaScript
1
star
100

taskr

a small and simple task manager with desktop and web clients
Python
1
star