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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file Markups-4.0.0.tar.gz.

File metadata

  • Download URL: Markups-4.0.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for Markups-4.0.0.tar.gz
Algorithm Hash digest
SHA256 3ddb9afb1c55d0cff812e3392ca33f468498c0707a4fa8b2e05d0ba0d32c019e
MD5 3ac76e1f2ba036bf0e51df39deb64ea8
BLAKE2b-256 10b7ec51da3ed9d0a93fba71c41bdef26065f78bed7e760b4fa7687283b79955

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Markups-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for Markups-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47149d8b620c39505eceb763bfc6170e1dbebf3173773d57da449fb2abf9b363
MD5 8f3fe21ac37f850314f354a49e48eeeb
BLAKE2b-256 b6db34aeea48a383c7e6b0e33c3b2836beb003469bc2481805835962b8af957f

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page