Skip to main content

A wrapper around various text markups

Project description

GitHub Actions status Coverage status ReadTheDocs status

This module provides a wrapper around various text markup languages.

Available by default are Markdown, reStructuredText, Textile and AsciiDoc, but you can easily add your own markups.

Usage example:

>>> import markups
>>> markup = markups.get_markup_for_file_name("myfile.rst")
>>> markup.name
'reStructuredText'
>>> markup.attributes[markups.common.SYNTAX_DOCUMENTATION]
'https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html'
>>> text = """
... Hello, world!
... =============
...
... This is an example **reStructuredText** document.
... """
>>> result = markup.convert(text)
>>> result.get_document_title()
'Hello, world!'
>>> print(result.get_document_body())  # doctest: +NORMALIZE_WHITESPACE
<main id="hello-world">
<h1 class="title" data-posmap="3">Hello, world!</h1>
<p data-posmap="5">This is an example <strong>reStructuredText</strong> document.</p>
</main>

The release version can be downloaded from PyPI or installed using:

pip install Markups

The source code is hosted on GitHub.

The documentation is available online or can be generated from source by installing Sphinx and running:

python3 -m sphinx docs build/sphinx/html

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Markups-4.0.0.tar.gz (23.0 kB view hashes)

Uploaded source

Built Distribution

Markups-4.0.0-py3-none-any.whl (14.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page