Syntex is a lightweight, markdownish markup language for generating HTML. It's implemented in Python and can be used as both a command line utility and a Python library.
When used on the command line Syntex reads from
stdin and prints to
$ syntex < input.txt > output.html
To use Syntex as a Python library call its
render() function with a string of input:
>>> import syntex >>> html = syntex.render(text)
Syntex inherits much of its basic syntax from Markdown:
This is a paragraph containing *emphasised* and **strong** text. It also contains a `code sample` in backticks. This is a second paragraph containing a [link](http://example.com).
Syntex differs from Markdown in providing an extensible, indentation-based syntax for generating arbitrary HTML:
:tag [keyword] [.class] [#id] [&attr] [attr="value"] block content block content ...
Syntex also includes out-of-the-box support for tables, tables-of-contents, definition lists, syntax highlighting, and footnotes.
Install directly from the Python Package Index using
$ pip install syntex
Syntex requires Python 3.4 or later.
Command Line Interface
syntex --help flag to view the utility's command line help:
Usage: syntex [FLAGS] Renders input text in Syntex format into HTML. Reads from stdin and prints to stdout. Example: $ syntex < input.txt > output.html Flags: -d, --debug Run in debug mode. --help Print the application's help text and exit. -p, --pygmentize Add syntax highlighting to code samples. --version Print the application's version number and exit.
Syntex can use the Pygments package to add syntax highlighting to code blocks; this feature can be enabled via the
--pygmentize flag. (Pygments is installed automatically when you install Syntex using
Only code blocks with a language attribute will have syntax highlighting applied.
This work has been placed in the public domain.