Syntex

A lightweight, markdownish markup language for generating HTML.

Home


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 stdout:

$ 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)

Overview

Syntex inherits much of its basic syntax from Markdown:

This paragraph contains *italic* and **bold** text.
It also contains a `code sample` in backticks.

This paragraph contains a [link](http://example.com).

Syntex differs from Markdown in supporting an extensible, indentation-based syntax for generating arbitrary HTML:

:div .outer
    :div .inner
        This is a paragraph.

Syntex also includes out-of-the-box support for tables, tables-of-contents, definition lists, syntax highlighting, and footnotes.

Installation

Install directly from the Python Package Index using pip:

$ pip install syntex

Syntex requires Python 3.4 or later.

Command Line Interface

Use the 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.
  -p, --pygmentize  Add syntax highlighting to code.
      --version     Print the application's version.

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 pip).

Only code blocks with a language attribute will have syntax highlighting applied.

License

This work has been placed in the public domain.