marko


Namemarko JSON
Version 2.0.3 PyPI version JSON
download
home_pagehttps://github.com/frostming/marko
SummaryA markdown parser with high extensibility.
upload_time2024-02-22 09:24:40
maintainer
docs_urlNone
author
requires_python>=3.7
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.30-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.30][spec]. It has been designed with high extensibility in mind, as detailed in the [Extensions](#extensions) section.

Marko requires Python 3.7 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.30/
[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": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Frost Ming <mianghong@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3f/78/b8316b69a2f1425ca5d3e1b1985f153fbb6e8ec42ffb5b8b9284eef091ec/marko-2.0.3.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.30-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.30][spec]. It has been designed with high extensibility in mind, as detailed in the [Extensions](#extensions) section.\n\nMarko requires Python 3.7 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.30/\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.0.3",
    "project_urls": {
        "Documentation": "https://marko-py.readthedocs.io",
        "Homepage": "https://github.com/frostming/marko"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8aeb19207d803a65645245b83f916a19b6ed14c94d2be331a1cffb7024c453f2",
                "md5": "9130527760d8b833d46a646b39211b13",
                "sha256": "7fca1c4ab1dbc09b4b3be83c22caafd7d97c99439cb4143d025727cb3df1f4d0"
            },
            "downloads": -1,
            "filename": "marko-2.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9130527760d8b833d46a646b39211b13",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 42949,
            "upload_time": "2024-02-22T09:24:38",
            "upload_time_iso_8601": "2024-02-22T09:24:38.627368Z",
            "url": "https://files.pythonhosted.org/packages/8a/eb/19207d803a65645245b83f916a19b6ed14c94d2be331a1cffb7024c453f2/marko-2.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f78b8316b69a2f1425ca5d3e1b1985f153fbb6e8ec42ffb5b8b9284eef091ec",
                "md5": "4c6c8592155c4423a64bec53b9eb2544",
                "sha256": "3b323dcd7dd48181871718ac09b3825bc8f74493cec378f2bacaaceec47577d4"
            },
            "downloads": -1,
            "filename": "marko-2.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4c6c8592155c4423a64bec53b9eb2544",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 143571,
            "upload_time": "2024-02-22T09:24:40",
            "upload_time_iso_8601": "2024-02-22T09:24:40.988807Z",
            "url": "https://files.pythonhosted.org/packages/3f/78/b8316b69a2f1425ca5d3e1b1985f153fbb6e8ec42ffb5b8b9284eef091ec/marko-2.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-22 09:24:40",
    "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.19738s