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

Project details


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.1.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

Markups-4.1.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file markups-4.1.0.tar.gz.

File metadata

  • Download URL: markups-4.1.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for markups-4.1.0.tar.gz
Algorithm Hash digest
SHA256 25214434f356d353034c2ef4db76ab50e867a63ba1967eb6bcc80472c501ddd9
MD5 287a74acec549a56adabe9167eff5706
BLAKE2b-256 685ecb208463c1cbe397e8525ce746d0492ce3131d84bb04d7dd68d476f97903

See more details on using hashes here.

File details

Details for the file Markups-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: Markups-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for Markups-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb7efceddb570191a740b52fc305742f581c0646a5df997d586068763cceb1ac
MD5 3b6cb128f48c60b7a106c987df363710
BLAKE2b-256 1d37cac1dea3f48e0af477b56d2c5b1a1b6e23a8ae62b655586075ca951bc022

See more details on using hashes here.

Supported by

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