File: README.rst

package info (click to toggle)
pymarkups 4.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 276 kB
  • sloc: python: 1,156; sh: 7; makefile: 3
file content (62 lines) | stat: -rw-r--r-- 2,180 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.. image:: https://github.com/retext-project/pymarkups/workflows/tests/badge.svg
   :target: https://github.com/retext-project/pymarkups/actions
   :alt: GitHub Actions status
.. image:: https://codecov.io/gh/retext-project/pymarkups/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/retext-project/pymarkups
   :alt: Coverage status
.. image:: https://readthedocs.org/projects/pymarkups/badge/?version=latest
   :target: https://pymarkups.readthedocs.io/en/latest/
   :alt: 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:

.. code:: python

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

.. _Markdown: https://daringfireball.net/projects/markdown/
.. _reStructuredText: https://docutils.sourceforge.io/rst.html
.. _Textile: https://en.wikipedia.org/wiki/Textile_(markup_language)
.. _AsciiDoc: https://asciidoc.org

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

  pip install Markups

.. _PyPI: https://pypi.org/project/Markups/

The source code is hosted on GitHub_.

.. _GitHub: https://github.com/retext-project/pymarkups

The documentation is available online_ or can be generated from source by
installing Sphinx_ and running::

  python3 -m sphinx docs build/sphinx/html

.. _online: https://pymarkups.readthedocs.io/en/latest/
.. _Sphinx: https://www.sphinx-doc.org/en/master/