Syntext 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 Syntext reads from
stdin and prints to
$ syntext < input.txt > output.html
To use Syntext as a Python library call its
render() function with a string of input:
>>> import syntext >>> html = syntext.render(text)
Syntext shares much of its basic syntax with Markdown:
This paragraph contains *italic* and **bold** text. It also contains a `code sample` in backticks. This paragraph contains a [link](http://example.com).
Syntext differs from Markdown in supporting an extensible, indentation-based syntax for generating arbitrary HTML:
:div .outer :div .inner This is a paragraph.
Syntext 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 syntext
Syntext requires Python 3.4 or later.
Command Line Interface
syntext --help flag to view the utility's command line help:
Usage: syntext [FLAGS] Renders input text in Syntext format into HTML. Reads from stdin and prints to stdout. Example: $ syntext < input.txt > output.html Flags: -d, --debug Run in debug mode. -h, --help Print the application's help text. -p, --pygmentize Add syntax highlighting to code. -v, --version Print the application's version.
Syntext 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 Syntext using
Only code blocks with a language attribute will have syntax highlighting applied.
This work has been placed in the public domain.