{"id":13446329,"url":"https://github.com/trentm/python-markdown2","last_synced_at":"2025-05-13T16:03:34.849Z","repository":{"id":1361610,"uuid":"1310572","full_name":"trentm/python-markdown2","owner":"trentm","description":"markdown2: A fast and complete implementation of Markdown in Python","archived":false,"fork":false,"pushed_at":"2025-04-14T00:48:18.000Z","size":2496,"stargazers_count":2741,"open_issues_count":84,"forks_count":437,"subscribers_count":60,"default_branch":"master","last_synced_at":"2025-04-23T18:51:57.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trentm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-01-31T00:30:02.000Z","updated_at":"2025-04-21T01:03:00.000Z","dependencies_parsed_at":"2023-07-06T07:28:09.336Z","dependency_job_id":"d6157cfd-aa95-4bc3-9318-358858d70ac1","html_url":"https://github.com/trentm/python-markdown2","commit_stats":{"total_commits":807,"total_committers":75,"mean_commits":10.76,"dds":0.5861214374225527,"last_synced_commit":"bce3f18ed86a19b418c8114a712bb6fee790c4c2"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trentm%2Fpython-markdown2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trentm%2Fpython-markdown2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trentm%2Fpython-markdown2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trentm%2Fpython-markdown2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trentm","download_url":"https://codeload.github.com/trentm/python-markdown2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252590330,"owners_count":21772933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T05:00:51.459Z","updated_at":"2025-05-05T22:44:09.370Z","avatar_url":"https://github.com/trentm.png","language":"Python","readme":"Markdown is a light text markup format and a processor to convert that to HTML.\nThe originator describes it as follows:\n\n\u003e Markdown is a text-to-HTML conversion tool for web writers.\n\u003e Markdown allows you to write using an easy-to-read,\n\u003e easy-to-write plain text format, then convert it to\n\u003e structurally valid XHTML (or HTML).\n\u003e\n\u003e -- \u003chttp://daringfireball.net/projects/markdown/\u003e\n\nThis (markdown2) is a fast and complete Python implementation of Markdown. It\nwas written to closely match the behaviour of the original Perl-implemented\nMarkdown.pl. Markdown2 also comes with a number of extensions (called\n\"extras\") for things like syntax coloring, tables, header-ids. See the\n\"Extra Syntax\" section below. \"markdown2\" supports all Python versions\n3.5+ (and pypy and jython, though I don't frequently test those).\n\nThere is another [Python\nmarkdown.py](https://python-markdown.github.io/). However, at\nleast at the time this project was started, markdown2.py was faster (see the\n[Performance\nNotes](https://github.com/trentm/python-markdown2/wiki/Performance-Notes)) and,\nto my knowledge, more correct (see [Testing\nNotes](https://github.com/trentm/python-markdown2/wiki/Testing-Notes)).\nThat was a while ago though, so you shouldn't discount Python-markdown from\nyour consideration.\n\nFollow \u003ca href=\"https://twitter.com/intent/user?screen_name=trentmick\" target=\"_blank\"\u003e@trentmick\u003c/a\u003e\nfor updates to python-markdown2.\n\n# Install\n\nTo install it in your Python installation run *one* of the following:\n\n    pip install markdown2\n    pip install markdown2[all]  # to install all optional dependencies (eg: Pygments for code syntax highlighting)\n    pypm install markdown2      # if you use ActivePython (activestate.com/activepython)\n    easy_install markdown2      # if this is the best you have\n    python setup.py install\n\nHowever, everything you need to run this is in \"lib/markdown2.py\". If it is\neasier for you, you can just copy that file to somewhere on your PythonPath\n(to use as a module) or executable path (to use as a script).\n\n\n# Quick Usage\n\nAs a module:\n```python\n\u003e\u003e\u003e import markdown2\n\u003e\u003e\u003e markdown2.markdown(\"*boo!*\")  # or use `html = markdown_path(PATH)`\n'\u003cp\u003e\u003cem\u003eboo!\u003c/em\u003e\u003c/p\u003e\\n'\n\n\u003e\u003e\u003e from markdown2 import Markdown\n\u003e\u003e\u003e markdowner = Markdown()\n\u003e\u003e\u003e markdowner.convert(\"*boo!*\")\n'\u003cp\u003e\u003cem\u003eboo!\u003c/em\u003e\u003c/p\u003e\\n'\n\u003e\u003e\u003e markdowner.convert(\"**boom!**\")\n'\u003cp\u003e\u003cstrong\u003eboom!\u003c/strong\u003e\u003c/p\u003e\\n'\n```\nAs a script (CLI):\n```shell\n$ python markdown2.py foo.md \u003e foo.html\n```\nor \n```shell\n$ python -m markdown2 foo.md \u003e foo.html\n```\n\nI think pip-based installation will enable this as well:\n```shell\n$ markdown2 foo.md \u003e foo.html\n```\nSee the [project wiki](https://github.com/trentm/python-markdown2/wiki),\n[lib/markdown2.py](https://github.com/trentm/python-markdown2/blob/master/lib/markdown2.py)\ndocstrings and/or `python markdown2.py --help` for more details.\n\n\n# Extra Syntax (aka extensions)\n\nMany Markdown processors include support for additional optional syntax\n(often called \"extensions\") and markdown2 is no exception. With markdown2 these\nare called \"extras\".  Using the \"footnotes\" extra as an example, here is how\nyou use an extra ... as a module:\n```shell\n$ python markdown2.py --extras footnotes foo.md \u003e foo.html\n```\nas a script:\n```shell\n\u003e\u003e\u003e import markdown2\n\u003e\u003e\u003e markdown2.markdown(\"*boo!*\", extras=[\"footnotes\"])\n'\u003cp\u003e\u003cem\u003eboo!\u003c/em\u003e\u003c/p\u003e\\n'\n```\nThere are a number of currently implemented extras for tables, footnotes,\nsyntax coloring of `\u003cpre\u003e`-blocks, auto-linking patterns, table of contents,\nSmarty Pants (for fancy quotes, dashes, etc.) and more. See the [Extras\nwiki page](https://github.com/trentm/python-markdown2/wiki/Extras) for full\ndetails.\n\n\n# Project\n\nThe python-markdown2 project lives at\n\u003chttps://github.com/trentm/python-markdown2/\u003e.  (Note: On Mar 6, 2011 this\nproject was moved from [Google Code](http://code.google.com/p/python-markdown2)\nto here on Github.) See also, [markdown2 on the Python Package Index\n(PyPI)](http://pypi.python.org/pypi/markdown2).\n\nThe change log: \u003chttps://github.com/trentm/python-markdown2/blob/master/CHANGES.md\u003e\n\nTo report a bug: \u003chttps://github.com/trentm/python-markdown2/issues\u003e\n\n# Contributing\n\nWe welcome pull requests from the community. Please take a look at the [TODO](https://github.com/trentm/python-markdown2/blob/master/TODO.txt) for opportunities to help this project. For those wishing to submit a pull request to `python-markdown2` please ensure it fulfills the following requirements:\n\n* It must pass PEP8.\n* It must include relevant test coverage.\n* Bug fixes must include a regression test that exercises the bug.\n* The entire test suite must pass.\n* The README and/or docs are updated accordingly.\n\n\n# Test Suite\n\nThis markdown implementation passes a fairly extensive test suite. To run it:\n```shell\nmake test\n```\nThe crux of the test suite is a number of \"cases\" directories -- each with a\nset of matching .text (input) and .html (expected output) files. These are:\n\n    tm-cases/                   Tests authored for python-markdown2 (tm==\"Trent Mick\")\n    markdowntest-cases/         Tests from the 3rd-party MarkdownTest package\n    php-markdown-cases/         Tests from the 3rd-party MDTest package\n    php-markdown-extra-cases/   Tests also from MDTest package\n\nSee the [Testing Notes wiki\npage](https://github.com/trentm/python-markdown2/wiki/Testing-Notes) for full\ndetails.\n","funding_links":[],"categories":["笔记","资源列表","Python","Markdown parser","Libraries","Markdown"],"sub_categories":["Web知识点","特殊文本格式处理","Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrentm%2Fpython-markdown2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrentm%2Fpython-markdown2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrentm%2Fpython-markdown2/lists"}