A wrapper around various text markups
Project description
This module provides a wrapper around various text markup languages.
Available by default are Markdown, reStructuredText and Textile, 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 setup.py build_sphinx
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Markups-3.1.2.tar.gz
(20.6 kB
view details)
Built Distribution
Markups-3.1.2-py3-none-any.whl
(12.8 kB
view details)
File details
Details for the file Markups-3.1.2.tar.gz
.
File metadata
- Download URL: Markups-3.1.2.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2954d53656d9ec84f2f6c077e91a1de534e05647f20d327757283bbb5a857770 |
|
MD5 | ec2a5b5a3db0dac922714e3172d49a94 |
|
BLAKE2b-256 | cc953d85e06393a8f484f0125f2b44da4dafd09a7208a5b2dc4681e9e81f5ebb |
File details
Details for the file Markups-3.1.2-py3-none-any.whl
.
File metadata
- Download URL: Markups-3.1.2-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40058f2ea249e24f1eba5542718f2e9c0a427923af488927094938c16607eb42 |
|
MD5 | d9d16e549f4f6ea776c0ec5232129da9 |
|
BLAKE2b-256 | 945f889877bf7f06eb581f88754d06d0472af566a1f196df46ea6f60569d2f70 |