marko


Namemarko JSON
Version 2.1.2 PyPI version JSON
download
home_pagehttps://github.com/frostming/marko
SummaryA markdown parser with high extensibility.
upload_time2024-06-21 04:27:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 𝓜𝓪𝓻𝓴𝓸

> A markdown parser with high extensibility.

[![PyPI](https://img.shields.io/pypi/v/marko.svg?logo=python&logoColor=white)](https://pypi.org/project/marko/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/marko.svg?logo=python&logoColor=white)](https://pypi.org/project/marko/)
[![Documentation Status](https://img.shields.io/readthedocs/marko-py.svg?logo=readthedocs)](https://marko-py.readthedocs.io/en/latest/?badge=latest)
[![CommonMark Spec](https://img.shields.io/badge/CommonMark-0.31.2-blue.svg)][spec]

![Build Status](https://github.com/frostming/marko/workflows/Tests/badge.svg)
[![codecov](https://codecov.io/gh/frostming/marko/branch/master/graph/badge.svg)](https://codecov.io/gh/frostming/marko)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b785f5b3fa7c4d93a02372d31b3f73b1)](https://www.codacy.com/app/frostming/marko?utm_source=github.com&utm_medium=referral&utm_content=frostming/marko&utm_campaign=Badge_Grade)

Marko is a pure Python markdown parser that adheres to the specifications of [CommonMark's spec v0.31.2][spec]. It has been designed with high extensibility in mind, as detailed in the [Extensions](#extensions) section.

Marko requires Python 3.8 or higher.

## Why Marko

Of all the Python markdown parsers available, a common issue is the difficulty for users to add their own features. Additionally, both [Python-Markdown][pymd] and [mistune][mistune] do not comply with CommonMark specifications. This has prompted me to develop a new markdown parser.

Marko's compliance with the complex CommonMark specification can impact its performance. However, using a parser that does not adhere to this spec may result in unexpected rendering outcomes. According to benchmark results, Marko is three times slower than Python-Markdown but slightly faster than Commonmark-py and significantly slower than mistune. If prioritizing performance over spec compliance is crucial for you, it would be best to opt for another parser.

[spec]: https://spec.commonmark.org/0.31.2/
[pymd]: https://github.com/waylan/Python-Markdown
[mistune]: https://github.com/lepture/mistune
[cmpy]: https://github.com/rtfd/CommonMark-py

## Use Marko

The installation is very simple:

    $ pip install marko

And to use it:

```python
import marko

print(marko.convert(text))
```

Marko also provides a simple CLI, for example, to render a document and output to a html file:

    $ cat my_article.md | marko > my_article.html

## Extensions

It is super easy to use an extension:

```python
from marko import Markdown
from marko.ext.footnote import make_extension
# Add footnote extension
markdown = Markdown(extensions=[make_extension()])
# Or you can just:
markdown = Markdown(extensions=['footnote'])
# Alternatively you can register an extension later
markdown.use(make_extension())
```

An example of using an extension with the command-line version of Marko:

```
$ cat this_has_footnote.txt | marko -e footnote > hi_world.html
```

Marko is shipped with 4 extensions: `'footnote', 'toc' 'pangu', 'codehilite'`.
They are not included in CommonMark's spec but are common in other markdown parsers.

Marko also provides a Github flavored markdown parser which can be found at `marko.ext.gfm.gfm`.

Please refer to [Extend Marko](https://marko-py.readthedocs.io/en/latest/extend.html) about how to
write your own extension.

## License

Marko is released under [MIT License](LICENSE)

## [Change Log](CHANGELOG.md)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/frostming/marko",
    "name": "marko",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Frost Ming <mianghong@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8c/38/6ea5d8600b94432656c669816a479580d9f1c49ef6b426282f4ba261ae9b/marko-2.1.2.tar.gz",
    "platform": null,
    "description": "# \ud835\udcdc\ud835\udcea\ud835\udcfb\ud835\udcf4\ud835\udcf8\n\n> A markdown parser with high extensibility.\n\n[![PyPI](https://img.shields.io/pypi/v/marko.svg?logo=python&logoColor=white)](https://pypi.org/project/marko/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/marko.svg?logo=python&logoColor=white)](https://pypi.org/project/marko/)\n[![Documentation Status](https://img.shields.io/readthedocs/marko-py.svg?logo=readthedocs)](https://marko-py.readthedocs.io/en/latest/?badge=latest)\n[![CommonMark Spec](https://img.shields.io/badge/CommonMark-0.31.2-blue.svg)][spec]\n\n![Build Status](https://github.com/frostming/marko/workflows/Tests/badge.svg)\n[![codecov](https://codecov.io/gh/frostming/marko/branch/master/graph/badge.svg)](https://codecov.io/gh/frostming/marko)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b785f5b3fa7c4d93a02372d31b3f73b1)](https://www.codacy.com/app/frostming/marko?utm_source=github.com&utm_medium=referral&utm_content=frostming/marko&utm_campaign=Badge_Grade)\n\nMarko is a pure Python markdown parser that adheres to the specifications of [CommonMark's spec v0.31.2][spec]. It has been designed with high extensibility in mind, as detailed in the [Extensions](#extensions) section.\n\nMarko requires Python 3.8 or higher.\n\n## Why Marko\n\nOf all the Python markdown parsers available, a common issue is the difficulty for users to add their own features. Additionally, both [Python-Markdown][pymd] and [mistune][mistune] do not comply with CommonMark specifications. This has prompted me to develop a new markdown parser.\n\nMarko's compliance with the complex CommonMark specification can impact its performance. However, using a parser that does not adhere to this spec may result in unexpected rendering outcomes. According to benchmark results, Marko is three times slower than Python-Markdown but slightly faster than Commonmark-py and significantly slower than mistune. If prioritizing performance over spec compliance is crucial for you, it would be best to opt for another parser.\n\n[spec]: https://spec.commonmark.org/0.31.2/\n[pymd]: https://github.com/waylan/Python-Markdown\n[mistune]: https://github.com/lepture/mistune\n[cmpy]: https://github.com/rtfd/CommonMark-py\n\n## Use Marko\n\nThe installation is very simple:\n\n    $ pip install marko\n\nAnd to use it:\n\n```python\nimport marko\n\nprint(marko.convert(text))\n```\n\nMarko also provides a simple CLI, for example, to render a document and output to a html file:\n\n    $ cat my_article.md | marko > my_article.html\n\n## Extensions\n\nIt is super easy to use an extension:\n\n```python\nfrom marko import Markdown\nfrom marko.ext.footnote import make_extension\n# Add footnote extension\nmarkdown = Markdown(extensions=[make_extension()])\n# Or you can just:\nmarkdown = Markdown(extensions=['footnote'])\n# Alternatively you can register an extension later\nmarkdown.use(make_extension())\n```\n\nAn example of using an extension with the command-line version of Marko:\n\n```\n$ cat this_has_footnote.txt | marko -e footnote > hi_world.html\n```\n\nMarko is shipped with 4 extensions: `'footnote', 'toc' 'pangu', 'codehilite'`.\nThey are not included in CommonMark's spec but are common in other markdown parsers.\n\nMarko also provides a Github flavored markdown parser which can be found at `marko.ext.gfm.gfm`.\n\nPlease refer to [Extend Marko](https://marko-py.readthedocs.io/en/latest/extend.html) about how to\nwrite your own extension.\n\n## License\n\nMarko is released under [MIT License](LICENSE)\n\n## [Change Log](CHANGELOG.md)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A markdown parser with high extensibility.",
    "version": "2.1.2",
    "project_urls": {
        "Documentation": "https://marko-py.readthedocs.io",
        "Homepage": "https://github.com/frostming/marko"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ef9b3dbfbe6ee255b1c37a37e2a6046adb2e77763a020591dae63e5005a2c8d7",
                "md5": "bda4783f8519be70814f34a9966b9dd1",
                "sha256": "c14aa7a77468aaaf53cf056dcd3d32398b9df4c3fb81f5e120dd37cbb9f8c859"
            },
            "downloads": -1,
            "filename": "marko-2.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bda4783f8519be70814f34a9966b9dd1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 42089,
            "upload_time": "2024-06-21T04:26:58",
            "upload_time_iso_8601": "2024-06-21T04:26:58.941932Z",
            "url": "https://files.pythonhosted.org/packages/ef/9b/3dbfbe6ee255b1c37a37e2a6046adb2e77763a020591dae63e5005a2c8d7/marko-2.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8c386ea5d8600b94432656c669816a479580d9f1c49ef6b426282f4ba261ae9b",
                "md5": "1e806ed3b7ed47dc9e4770f9b0781e0b",
                "sha256": "a9170006b879376e6845c91b1ae3dce2992772954b99b70175ff888537186011"
            },
            "downloads": -1,
            "filename": "marko-2.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1e806ed3b7ed47dc9e4770f9b0781e0b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 142593,
            "upload_time": "2024-06-21T04:27:01",
            "upload_time_iso_8601": "2024-06-21T04:27:01.060106Z",
            "url": "https://files.pythonhosted.org/packages/8c/38/6ea5d8600b94432656c669816a479580d9f1c49ef6b426282f4ba261ae9b/marko-2.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-21 04:27:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "frostming",
    "github_project": "marko",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "marko"
}
        
Elapsed time: 0.88162s