Syntext

A lightweight, markdownish markup language for generating HTML.

Version 3.1.0

Home


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

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

Overview

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 indentation-based shorthand 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.

Installation

Install directly from the Python Package Index using pip:

$ pip install syntext

Syntext requires Python 3.6 or later.

Command Line Interface

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

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

License

Zero-Clause BSD (0BSD).