multimark 0.1.3__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. multimark-0.2.0/.github/CONTRIBUTING.md +62 -0
  2. {multimark-0.1.3 → multimark-0.2.0}/.github/ISSUE_TEMPLATE/bug.md +2 -2
  3. {multimark-0.1.3 → multimark-0.2.0}/.github/ISSUE_TEMPLATE/feature.md +2 -2
  4. {multimark-0.1.3 → multimark-0.2.0}/.github/ISSUE_TEMPLATE/question.md +2 -2
  5. {multimark-0.1.3 → multimark-0.2.0}/.github/workflows/docs.yml +1 -1
  6. {multimark-0.1.3/src/multimark.egg-info → multimark-0.2.0}/PKG-INFO +40 -19
  7. {multimark-0.1.3 → multimark-0.2.0}/README.md +35 -15
  8. multimark-0.2.0/ROADMAP.md +53 -0
  9. multimark-0.2.0/_freeze/site_libs/clipboard/clipboard.min.js +7 -0
  10. multimark-0.2.0/_freeze/user-guide/performance/execute-results/html.json +16 -0
  11. multimark-0.2.0/assets/logo.png +0 -0
  12. {multimark-0.1.3 → multimark-0.2.0}/great-docs.yml +5 -5
  13. {multimark-0.1.3 → multimark-0.2.0}/pyproject.toml +19 -4
  14. multimark-0.2.0/skills/multimark/SKILL.md +108 -0
  15. {multimark-0.1.3 → multimark-0.2.0}/src/multimark/__init__.py +0 -5
  16. {multimark-0.1.3 → multimark-0.2.0}/src/multimark/_build_cmark.py +0 -1
  17. multimark-0.2.0/src/multimark/_cli.py +93 -0
  18. {multimark-0.1.3 → multimark-0.2.0}/src/multimark/_cmark.py +20 -10
  19. {multimark-0.1.3 → multimark-0.2.0/src/multimark.egg-info}/PKG-INFO +40 -19
  20. {multimark-0.1.3 → multimark-0.2.0}/src/multimark.egg-info/SOURCES.txt +13 -3
  21. multimark-0.2.0/src/multimark.egg-info/entry_points.txt +2 -0
  22. {multimark-0.1.3 → multimark-0.2.0}/src/multimark.egg-info/requires.txt +1 -0
  23. {multimark-0.1.3 → multimark-0.2.0}/tests/spec_parser.py +0 -13
  24. multimark-0.2.0/tests/test_cli.py +175 -0
  25. {multimark-0.1.3 → multimark-0.2.0}/tests/test_errors.py +0 -5
  26. {multimark-0.1.3 → multimark-0.2.0}/tests/test_extensions.py +0 -1
  27. {multimark-0.1.3 → multimark-0.2.0}/tests/test_html.py +71 -1
  28. {multimark-0.1.3 → multimark-0.2.0}/tests/test_latex.py +5 -1
  29. {multimark-0.1.3 → multimark-0.2.0}/tests/test_man.py +0 -1
  30. {multimark-0.1.3 → multimark-0.2.0}/tests/test_package.py +0 -1
  31. {multimark-0.1.3 → multimark-0.2.0}/tests/test_param_combos.py +0 -5
  32. {multimark-0.1.3 → multimark-0.2.0}/tests/test_pathological.py +0 -5
  33. {multimark-0.1.3 → multimark-0.2.0}/tests/test_regressions.py +0 -7
  34. {multimark-0.1.3 → multimark-0.2.0}/tests/test_spec_html.py +0 -5
  35. {multimark-0.1.3 → multimark-0.2.0}/tests/test_spec_renderers.py +0 -11
  36. {multimark-0.1.3 → multimark-0.2.0}/tests/test_threads.py +0 -5
  37. {multimark-0.1.3 → multimark-0.2.0}/tests/test_xml.py +12 -1
  38. {multimark-0.1.3 → multimark-0.2.0}/user_guide/01-installation.qmd +1 -1
  39. multimark-0.2.0/user_guide/06-cli.qmd +163 -0
  40. multimark-0.2.0/user_guide/09-performance.qmd +162 -0
  41. multimark-0.1.3/user_guide/08-performance.qmd +0 -109
  42. {multimark-0.1.3 → multimark-0.2.0}/.github/CODE_OF_CONDUCT.md +0 -0
  43. {multimark-0.1.3 → multimark-0.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  44. {multimark-0.1.3 → multimark-0.2.0}/.github/workflows/ci.yml +0 -0
  45. {multimark-0.1.3 → multimark-0.2.0}/.gitignore +0 -0
  46. {multimark-0.1.3 → multimark-0.2.0}/LICENSE +0 -0
  47. {multimark-0.1.3 → multimark-0.2.0}/Makefile +0 -0
  48. {multimark-0.1.3 → multimark-0.2.0}/assets/logo-dark.png +0 -0
  49. {multimark-0.1.3 → multimark-0.2.0}/assets/logo-light.png +0 -0
  50. {multimark-0.1.3 → multimark-0.2.0}/index.qmd +0 -0
  51. {multimark-0.1.3 → multimark-0.2.0}/setup.cfg +0 -0
  52. {multimark-0.1.3 → multimark-0.2.0}/setup.py +0 -0
  53. {multimark-0.1.3 → multimark-0.2.0}/src/multimark/cmark.cffi.h +0 -0
  54. {multimark-0.1.3 → multimark-0.2.0}/src/multimark.egg-info/dependency_links.txt +0 -0
  55. {multimark-0.1.3 → multimark-0.2.0}/src/multimark.egg-info/top_level.txt +0 -0
  56. {multimark-0.1.3 → multimark-0.2.0}/tests/conftest.py +0 -0
  57. {multimark-0.1.3 → multimark-0.2.0}/tests/fixtures/extensions.txt +0 -0
  58. {multimark-0.1.3 → multimark-0.2.0}/tests/fixtures/regression.txt +0 -0
  59. {multimark-0.1.3 → multimark-0.2.0}/tests/fixtures/smart_punct.txt +0 -0
  60. {multimark-0.1.3 → multimark-0.2.0}/tests/fixtures/spec.txt +0 -0
  61. {multimark-0.1.3 → multimark-0.2.0}/tests/test_commonmark.py +0 -0
  62. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/CMakeLists.txt +0 -0
  63. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/autolink.c +0 -0
  64. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/autolink.h +0 -0
  65. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/cmark-gfm-core-extensions.h +0 -0
  66. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/core-extensions.c +0 -0
  67. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/ext_scanners.c +0 -0
  68. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/ext_scanners.h +0 -0
  69. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/ext_scanners.re +0 -0
  70. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/strikethrough.c +0 -0
  71. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/strikethrough.h +0 -0
  72. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/table.c +0 -0
  73. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/table.h +0 -0
  74. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/tagfilter.c +0 -0
  75. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/tagfilter.h +0 -0
  76. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/tasklist.c +0 -0
  77. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/extensions/tasklist.h +0 -0
  78. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/CMakeLists.txt +0 -0
  79. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/arena.c +0 -0
  80. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/blocks.c +0 -0
  81. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/buffer.c +0 -0
  82. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/buffer.h +0 -0
  83. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/case_fold_switch.inc +0 -0
  84. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/chunk.h +0 -0
  85. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/cmark-gfm-extension_api.h +0 -0
  86. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/cmark-gfm.h +0 -0
  87. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/cmark-gfm_export.h +0 -0
  88. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/cmark-gfm_version.h +0 -0
  89. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/cmark-gfm_version.h.in +0 -0
  90. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/cmark.c +0 -0
  91. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/cmark_ctype.c +0 -0
  92. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/cmark_ctype.h +0 -0
  93. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/commonmark.c +0 -0
  94. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/config.h +0 -0
  95. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/config.h.in +0 -0
  96. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/entities.inc +0 -0
  97. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/footnotes.c +0 -0
  98. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/footnotes.h +0 -0
  99. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/houdini.h +0 -0
  100. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/houdini_href_e.c +0 -0
  101. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/houdini_html_e.c +0 -0
  102. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/houdini_html_u.c +0 -0
  103. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/html.c +0 -0
  104. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/html.h +0 -0
  105. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/inlines.c +0 -0
  106. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/inlines.h +0 -0
  107. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/iterator.c +0 -0
  108. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/iterator.h +0 -0
  109. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/latex.c +0 -0
  110. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/libcmark-gfm.pc.in +0 -0
  111. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/linked_list.c +0 -0
  112. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/main.c +0 -0
  113. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/man.c +0 -0
  114. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/map.c +0 -0
  115. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/map.h +0 -0
  116. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/node.c +0 -0
  117. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/node.h +0 -0
  118. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/parser.h +0 -0
  119. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/plaintext.c +0 -0
  120. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/plugin.c +0 -0
  121. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/plugin.h +0 -0
  122. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/references.c +0 -0
  123. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/references.h +0 -0
  124. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/registry.c +0 -0
  125. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/registry.h +0 -0
  126. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/render.c +0 -0
  127. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/render.h +0 -0
  128. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/scanners.c +0 -0
  129. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/scanners.h +0 -0
  130. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/scanners.re +0 -0
  131. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/syntax_extension.c +0 -0
  132. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/syntax_extension.h +0 -0
  133. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/utf8.c +0 -0
  134. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/utf8.h +0 -0
  135. {multimark-0.1.3 → multimark-0.2.0}/third_party/cmark-gfm/src/xml.c +0 -0
  136. {multimark-0.1.3 → multimark-0.2.0}/user_guide/00-introduction.qmd +0 -0
  137. {multimark-0.1.3 → multimark-0.2.0}/user_guide/02-quick-start.qmd +0 -0
  138. {multimark-0.1.3 → multimark-0.2.0}/user_guide/03-gfm-extensions.qmd +0 -0
  139. {multimark-0.1.3 → multimark-0.2.0}/user_guide/04-output-formats.qmd +0 -0
  140. {multimark-0.1.3 → multimark-0.2.0}/user_guide/05-options-and-flags.qmd +0 -0
  141. /multimark-0.1.3/user_guide/06-security.qmd → /multimark-0.2.0/user_guide/07-security.qmd +0 -0
  142. /multimark-0.1.3/user_guide/07-recipes.qmd → /multimark-0.2.0/user_guide/08-recipes.qmd +0 -0
@@ -0,0 +1,62 @@
1
+ # Contributing to multimark
2
+
3
+ Thank you for your interest in contributing to multimark! We welcome contributions from the community.
4
+
5
+ ## How to Contribute
6
+
7
+ ### Reporting Issues
8
+
9
+ If you find a bug or have a suggestion for improvement:
10
+
11
+ 1. Check if the issue already exists in the [issue tracker](https://github.com/posit-dev/multimark/issues)
12
+ 2. If not, create a new issue with a clear description
13
+ 3. Include steps to reproduce (for bugs) or use cases (for features)
14
+
15
+ ### Submitting Pull Requests
16
+
17
+ 1. Fork the repository
18
+ 2. Create a new branch for your changes: `git checkout -b feature/your-feature-name`
19
+ 3. Make your changes and commit them with clear, descriptive messages
20
+ 4. Add tests for new functionality
21
+ 5. Ensure all tests pass: `pytest`
22
+ 6. Push to your fork and submit a pull request
23
+
24
+ ### Development Setup
25
+
26
+ ```bash
27
+ # Clone your fork
28
+ git clone https://github.com/YOUR-USERNAME/multimark.git
29
+ cd multimark
30
+
31
+ # Create a virtual environment
32
+ python -m venv .venv
33
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
34
+
35
+ # Install in development mode with test dependencies
36
+ pip install -e .
37
+ pip install pytest
38
+
39
+ # Run tests
40
+ pytest tests/ -v
41
+ ```
42
+
43
+ Note: Building from source requires a C compiler (for the cmark-gfm CFFI bindings). On most systems this is already available, but on Windows you may need the Visual Studio Build Tools.
44
+
45
+ ### Code Style
46
+
47
+ - Follow PEP 8 guidelines
48
+ - Use meaningful variable and function names
49
+ - Add NumPy-style docstrings to public functions and classes
50
+ - Keep functions focused and concise
51
+
52
+ ### Running the Documentation Site
53
+
54
+ ```bash
55
+ pip install great-docs
56
+ great-docs build
57
+ great-docs preview
58
+ ```
59
+
60
+ ## Questions?
61
+
62
+ Feel free to open an issue for questions or discussions about contributing.
@@ -7,8 +7,8 @@ labels: "Type: ☹︎ Bug"
7
7
 
8
8
  ## Prework
9
9
 
10
- - [ ] Read and agree to the [code of conduct](https://www.contributor-covenant.org/version/3/0/) and [contributing guidelines](https://github.com/rich-iannone/multimark/blob/main/.github/CONTRIBUTING.md).
11
- - [ ] If there is [already a relevant issue](https://github.com/rich-iannone/multimark/issues), whether open or closed, comment on the existing thread instead of posting a new issue.
10
+ - [ ] Read and agree to the [code of conduct](https://www.contributor-covenant.org/version/3/0/) and [contributing guidelines](https://github.com/posit-dev/multimark/blob/main/.github/CONTRIBUTING.md).
11
+ - [ ] If there is [already a relevant issue](https://github.com/posit-dev/multimark/issues), whether open or closed, comment on the existing thread instead of posting a new issue.
12
12
 
13
13
  ## Description
14
14
 
@@ -7,8 +7,8 @@ labels: "Type: ★ Enhancement"
7
7
 
8
8
  ## Prework
9
9
 
10
- - [ ] Read and abide by the multimark [code of conduct](https://www.contributor-covenant.org/version/3/0/) and [contributing guidelines](https://github.com/rich-iannone/multimark/blob/main/.github/CONTRIBUTING.md).
11
- - [ ] Search for duplicates among the [existing issues](https://github.com/rich-iannone/multimark/issues) (both open and closed).
10
+ - [ ] Read and abide by the multimark [code of conduct](https://www.contributor-covenant.org/version/3/0/) and [contributing guidelines](https://github.com/posit-dev/multimark/blob/main/.github/CONTRIBUTING.md).
11
+ - [ ] Search for duplicates among the [existing issues](https://github.com/posit-dev/multimark/issues) (both open and closed).
12
12
 
13
13
  ## Proposal
14
14
 
@@ -7,8 +7,8 @@ labels: "Type: ⁇ Question"
7
7
 
8
8
  ## Prework
9
9
 
10
- - [ ] Read and agree to the [code of conduct](https://www.contributor-covenant.org/version/3/0/) and [contributing guidelines](https://github.com/rich-iannone/multimark/blob/main/.github/CONTRIBUTING.md).
11
- - [ ] If there is [already a relevant issue](https://github.com/rich-iannone/multimark/issues), whether open or closed, comment on the existing thread instead of posting a new issue.
10
+ - [ ] Read and agree to the [code of conduct](https://www.contributor-covenant.org/version/3/0/) and [contributing guidelines](https://github.com/posit-dev/multimark/blob/main/.github/CONTRIBUTING.md).
11
+ - [ ] If there is [already a relevant issue](https://github.com/posit-dev/multimark/issues), whether open or closed, comment on the existing thread instead of posting a new issue.
12
12
 
13
13
  ## Question
14
14
 
@@ -23,7 +23,7 @@ jobs:
23
23
  run: |
24
24
  python -m pip install --upgrade pip
25
25
  python -m pip install -e .
26
- python -m pip install great-docs
26
+ python -m pip install git+https://github.com/posit-dev/great-docs.git@main
27
27
 
28
28
  - name: Set up Quarto
29
29
  uses: quarto-dev/quarto-actions/setup@v2
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multimark
3
- Version: 0.1.3
4
- Summary: Python bindings to cmark — CommonMark parsing and rendering (HTML, LaTeX, man, XML)
3
+ Version: 0.2.0
4
+ Summary: Python bindings to cmark: CommonMark parsing and rendering (HTML, LaTeX, man, XML)
5
5
  Author: Rich Iannone
6
6
  License: MIT AND BSD-2-Clause
7
- Project-URL: Homepage, https://github.com/rich-iannone/multimark
8
- Project-URL: Issues, https://github.com/rich-iannone/multimark/issues
7
+ Project-URL: Homepage, https://github.com/posit-dev/multimark
8
+ Project-URL: Issues, https://github.com/posit-dev/multimark/issues
9
9
  Keywords: markdown,commonmark,cmark-gfm,html,latex,gfm
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
@@ -23,18 +23,21 @@ Requires-Python: >=3.9
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
25
  Requires-Dist: cffi>=1.15
26
+ Requires-Dist: click>=8.0
26
27
  Dynamic: license-file
27
28
 
29
+ <p align="center">
30
+ <img src="https://posit-dev.github.io/multimark/assets/logo.png" alt="multimark" width="350">
31
+ </p>
32
+ <p align="center">
28
33
  <a href="https://pypi.org/project/multimark/"><img src="https://img.shields.io/pypi/v/multimark?logo=python&logoColor=white&color=orange" alt="PyPI"></a>
29
34
  <a href="https://pypi.org/project/multimark/"><img src="https://img.shields.io/pypi/pyversions/multimark.svg" alt="Python versions"></a>
30
35
  <a href="https://pypistats.org/packages/multimark"><img src="https://img.shields.io/pypi/dm/multimark" alt="Downloads"></a>
31
36
  <a href="https://choosealicense.com/licenses/mit/"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="MIT License"></a>
32
- <a href="https://github.com/rich-iannone/multimark/actions/workflows/ci.yml"><img src="https://github.com/rich-iannone/multimark/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
37
+ <a href="https://github.com/posit-dev/multimark/actions/workflows/ci.yml"><img src="https://github.com/posit-dev/multimark/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
33
38
  </p>
34
39
 
35
- # multimark
36
-
37
- Python bindings to [cmark-gfm](https://github.com/github/cmark-gfm), the C reference implementation of [CommonMark](https://commonmark.org/) with GitHub Flavored Markdown extensions.
40
+ The **multimark** package has Python bindings to [cmark-gfm](https://github.com/github/cmark-gfm), the C reference implementation of [CommonMark](https://commonmark.org/) with GitHub Flavored Markdown extensions.
38
41
 
39
42
  Renders Markdown to **HTML**, **LaTeX**, **groff man**, **XML**, and **normalized CommonMark**: all from a single, lightweight package.
40
43
 
@@ -129,20 +132,38 @@ Available extensions: `table`, `strikethrough`, `autolink`, `tagfilter`, `taskli
129
132
 
130
133
  Every renderer accepts:
131
134
 
132
- - **`text`** — Markdown string
133
- - **`options`** — Raw bitmask (default `0`)
134
- - **`extensions`** — List of GFM extension names (default `()`)
135
- - **`smart`** — Smart punctuation
136
- - **`hardbreaks`** — Render soft breaks as `<br>`
137
- - **`unsafe`** — Allow raw HTML
138
- - **`normalize`** — Consolidate adjacent text nodes
139
- - **`footnotes`** — Enable footnote syntax
135
+ - **`text`**: Markdown string
136
+ - **`options`**: raw bitmask (default `0`)
137
+ - **`extensions`**: list of GFM extension names (default `()`)
138
+ - **`smart`**: smart punctuation
139
+ - **`hardbreaks`**: render soft breaks as `<br>`
140
+ - **`unsafe`**: allow raw HTML
141
+ - **`normalize`**: consolidate adjacent text nodes
142
+ - **`footnotes`**: enable footnote syntax
140
143
 
141
144
  Additional parameters:
142
145
 
143
- - **`sourcepos`** — Source position attributes (HTML and XML only)
144
- - **`width`** — Line wrap column (LaTeX, man, and commonmark only; `0` = no wrap)
146
+ - **`sourcepos`**: Source position attributes (HTML and XML only)
147
+ - **`width`**: Line wrap column (LaTeX, man, and commonmark only; `0` = no wrap)
148
+
149
+ ## Why multimark?
150
+
151
+ Several Python packages wrap cmark or provide CommonMark parsing. Here's how they compare:
152
+
153
+ | | **multimark** | **[cmarkgfm](https://github.com/theacodes/cmarkgfm)** | **[commonmark.py](https://github.com/readthedocs/commonmark.py)** |
154
+ |---|---|---|---|
155
+ | Engine | cmark-gfm (C, vendored) | cmark-gfm (C, vendored) | Pure Python |
156
+ | Output formats | HTML, LaTeX, man, XML, CommonMark | HTML only | HTML only |
157
+ | GFM extensions | ✓ | ✓ | ✗ |
158
+ | Safe by default | ✓ | ✓ | ✗ |
159
+ | Convenience kwargs | `smart=True`, `unsafe=True`, etc. | Raw bitmask only | N/A |
160
+ | Performance | **Fastest** (14% faster than cmarkgfm) | Fast | ~31× slower |
161
+ | Maintained | Active (2026) | Active (2025) | Unmaintained (2019) |
162
+
163
+ multimark uses the same battle-tested C library as `cmarkgfm` but exposes all five of cmark's output formats (not just HTML). The API is designed around keyword arguments rather than opaque bitmasks, and unsafe content is blocked by default so the safe choice requires no extra configuration.
164
+
165
+ Thanks to extension pointer caching and reduced Python-side overhead, multimark is the **fastest Python Markdown-to-HTML library**. Take a look at the [benchmarks](https://posit-dev.github.io/multimark/user-guide/performance.html) for more detail on this.
145
166
 
146
167
  ## License
147
168
 
148
- MIT (Python wrapper) and BSD-2-Clause (vendored cmark-gfm).
169
+ MIT and BSD-2-Clause (`cmark-gfm`).
@@ -1,13 +1,15 @@
1
+ <p align="center">
2
+ <img src="https://posit-dev.github.io/multimark/assets/logo.png" alt="multimark" width="350">
3
+ </p>
4
+ <p align="center">
1
5
  <a href="https://pypi.org/project/multimark/"><img src="https://img.shields.io/pypi/v/multimark?logo=python&logoColor=white&color=orange" alt="PyPI"></a>
2
6
  <a href="https://pypi.org/project/multimark/"><img src="https://img.shields.io/pypi/pyversions/multimark.svg" alt="Python versions"></a>
3
7
  <a href="https://pypistats.org/packages/multimark"><img src="https://img.shields.io/pypi/dm/multimark" alt="Downloads"></a>
4
8
  <a href="https://choosealicense.com/licenses/mit/"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="MIT License"></a>
5
- <a href="https://github.com/rich-iannone/multimark/actions/workflows/ci.yml"><img src="https://github.com/rich-iannone/multimark/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
9
+ <a href="https://github.com/posit-dev/multimark/actions/workflows/ci.yml"><img src="https://github.com/posit-dev/multimark/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
6
10
  </p>
7
11
 
8
- # multimark
9
-
10
- Python bindings to [cmark-gfm](https://github.com/github/cmark-gfm), the C reference implementation of [CommonMark](https://commonmark.org/) with GitHub Flavored Markdown extensions.
12
+ The **multimark** package has Python bindings to [cmark-gfm](https://github.com/github/cmark-gfm), the C reference implementation of [CommonMark](https://commonmark.org/) with GitHub Flavored Markdown extensions.
11
13
 
12
14
  Renders Markdown to **HTML**, **LaTeX**, **groff man**, **XML**, and **normalized CommonMark**: all from a single, lightweight package.
13
15
 
@@ -102,20 +104,38 @@ Available extensions: `table`, `strikethrough`, `autolink`, `tagfilter`, `taskli
102
104
 
103
105
  Every renderer accepts:
104
106
 
105
- - **`text`** — Markdown string
106
- - **`options`** — Raw bitmask (default `0`)
107
- - **`extensions`** — List of GFM extension names (default `()`)
108
- - **`smart`** — Smart punctuation
109
- - **`hardbreaks`** — Render soft breaks as `<br>`
110
- - **`unsafe`** — Allow raw HTML
111
- - **`normalize`** — Consolidate adjacent text nodes
112
- - **`footnotes`** — Enable footnote syntax
107
+ - **`text`**: Markdown string
108
+ - **`options`**: raw bitmask (default `0`)
109
+ - **`extensions`**: list of GFM extension names (default `()`)
110
+ - **`smart`**: smart punctuation
111
+ - **`hardbreaks`**: render soft breaks as `<br>`
112
+ - **`unsafe`**: allow raw HTML
113
+ - **`normalize`**: consolidate adjacent text nodes
114
+ - **`footnotes`**: enable footnote syntax
113
115
 
114
116
  Additional parameters:
115
117
 
116
- - **`sourcepos`** — Source position attributes (HTML and XML only)
117
- - **`width`** — Line wrap column (LaTeX, man, and commonmark only; `0` = no wrap)
118
+ - **`sourcepos`**: Source position attributes (HTML and XML only)
119
+ - **`width`**: Line wrap column (LaTeX, man, and commonmark only; `0` = no wrap)
120
+
121
+ ## Why multimark?
122
+
123
+ Several Python packages wrap cmark or provide CommonMark parsing. Here's how they compare:
124
+
125
+ | | **multimark** | **[cmarkgfm](https://github.com/theacodes/cmarkgfm)** | **[commonmark.py](https://github.com/readthedocs/commonmark.py)** |
126
+ |---|---|---|---|
127
+ | Engine | cmark-gfm (C, vendored) | cmark-gfm (C, vendored) | Pure Python |
128
+ | Output formats | HTML, LaTeX, man, XML, CommonMark | HTML only | HTML only |
129
+ | GFM extensions | ✓ | ✓ | ✗ |
130
+ | Safe by default | ✓ | ✓ | ✗ |
131
+ | Convenience kwargs | `smart=True`, `unsafe=True`, etc. | Raw bitmask only | N/A |
132
+ | Performance | **Fastest** (14% faster than cmarkgfm) | Fast | ~31× slower |
133
+ | Maintained | Active (2026) | Active (2025) | Unmaintained (2019) |
134
+
135
+ multimark uses the same battle-tested C library as `cmarkgfm` but exposes all five of cmark's output formats (not just HTML). The API is designed around keyword arguments rather than opaque bitmasks, and unsafe content is blocked by default so the safe choice requires no extra configuration.
136
+
137
+ Thanks to extension pointer caching and reduced Python-side overhead, multimark is the **fastest Python Markdown-to-HTML library**. Take a look at the [benchmarks](https://posit-dev.github.io/multimark/user-guide/performance.html) for more detail on this.
118
138
 
119
139
  ## License
120
140
 
121
- MIT (Python wrapper) and BSD-2-Clause (vendored cmark-gfm).
141
+ MIT and BSD-2-Clause (`cmark-gfm`).
@@ -0,0 +1,53 @@
1
+ # Roadmap
2
+
3
+ This document outlines longer-term ideas for multimark: features that would expand its
4
+ capabilities beyond the current render-to-string API.
5
+
6
+ ---
7
+
8
+ ## Planned — Near Term
9
+
10
+ Enhancements that build directly on existing infrastructure.
11
+
12
+ ### Type Stubs / `py.typed` Marker
13
+
14
+ Add a `py.typed` marker and inline type annotations for better IDE support and static
15
+ analysis.
16
+
17
+ - PEP 561 compliant `py.typed` marker file in the package
18
+ - Full type annotations on all public functions and the `Options` enum
19
+ - Improved autocomplete, hover docs, and type checking in editors
20
+
21
+ ---
22
+
23
+ ## Planned — Medium Term
24
+
25
+ Features that expand the scope of what multimark can produce.
26
+
27
+ ### Streaming / Incremental API
28
+
29
+ Expose the cmark parser object for large documents, allowing feed-based parsing without
30
+ buffering the entire input in memory.
31
+
32
+ - `Parser` class wrapping `cmark_parser_new` / `cmark_parser_feed` / `cmark_parser_finish`
33
+ - Extensions attachable at parser creation time
34
+ - Render from the finished AST node with any renderer
35
+ - Useful for processing very large Markdown files or streaming input
36
+
37
+ ### AST Access
38
+
39
+ Let users walk the parsed tree from Python (not just render to a string).
40
+
41
+ - `parse()` function returning a `Node` wrapper around the cmark AST
42
+ - Tree traversal: `node.children`, `node.parent`, `node.next`, `node.prev`
43
+ - Node type introspection: `node.type`, `node.literal`, `node.url`, `node.title`
44
+ - Mutation support: insert, remove, and replace nodes before rendering
45
+ - Enables custom transformations, inspections, and selective rendering
46
+
47
+ ---
48
+
49
+ ## Feedback & Contributions
50
+
51
+ Have ideas for features not listed here? [Open an issue](https://github.com/posit-dev/multimark/issues) with the `enhancement` label. Contributions to any planned item are welcome so check existing issues first to avoid duplication.
52
+
53
+ _This roadmap is a living document. It is updated as features ship and new priorities emerge._
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * clipboard.js v2.0.11
3
+ * https://clipboardjs.com/
4
+ *
5
+ * Licensed MIT © Zeno Rocha
6
+ */
7
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";return"string"==typeof t?n=o(t,e):t instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null==t?void 0:t.type)?n=o(t.value,e):(n=r()(t),c("copy")),n};function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=t.action,n=void 0===e?"copy":e,o=t.container,e=t.target,t=t.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==e){if(!e||"object"!==l(e)||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return t?f(t,{container:o}):e?"cut"===n?a(e):f(e,{container:o}):void 0};function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(n){var o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=v(n);return t=o?(t=v(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),e=this,!(t=t)||"object"!==p(t)&&"function"!=typeof t?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function m(t,e){t="data-clipboard-".concat(t);if(e.hasAttribute(t))return e.getAttribute(t)}var b=function(){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)}(r,i());var t,e,n,o=h(r);function r(t,e){var n;return function(t){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this),(n=o.call(this)).resolveOptions(e),n.listenClick(t),n}return t=r,n=[{key:"copy",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body};return f(t,e)}},{key:"cut",value:function(t){return a(t)}},{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],t="string"==typeof t?[t]:t,e=!!document.queryCommandSupported;return t.forEach(function(t){e=e&&!!document.queryCommandSupported(t)}),e}}],(e=[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===p(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=u()(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget,n=this.action(e)||"copy",t=s({action:n,container:this.container,target:this.target(e),text:this.text(e)});this.emit(t?"success":"error",{action:n,text:t,trigger:e,clearSelection:function(){e&&e.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(t){return m("action",t)}},{key:"defaultTarget",value:function(t){t=m("target",t);if(t)return document.querySelector(t)}},{key:"defaultText",value:function(t){return m("text",t)}},{key:"destroy",value:function(){this.listener.destroy()}}])&&d(t.prototype,e),n&&d(t,n),r}()},828:function(t){var e;"undefined"==typeof Element||Element.prototype.matches||((e=Element.prototype).matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector),t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}},438:function(t,e,n){var u=n(828);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=u(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},879:function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},370:function(t,e,n){var f=n(879),l=n(438);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!f.string(e))throw new TypeError("Second argument must be a String");if(!f.fn(n))throw new TypeError("Third argument must be a Function");if(f.node(t))return c=e,a=n,(u=t).addEventListener(c,a),{destroy:function(){u.removeEventListener(c,a)}};if(f.nodeList(t))return o=t,r=e,i=n,Array.prototype.forEach.call(o,function(t){t.addEventListener(r,i)}),{destroy:function(){Array.prototype.forEach.call(o,function(t){t.removeEventListener(r,i)})}};if(f.string(t))return t=t,e=e,n=n,l(document.body,t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,u,c,a}},817:function(t){t.exports=function(t){var e,n="SELECT"===t.nodeName?(t.focus(),t.value):"INPUT"===t.nodeName||"TEXTAREA"===t.nodeName?((e=t.hasAttribute("readonly"))||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),e||t.removeAttribute("readonly"),t.value):(t.hasAttribute("contenteditable")&&t.focus(),n=window.getSelection(),(e=document.createRange()).selectNodeContents(t),n.removeAllRanges(),n.addRange(e),n.toString());return n}},279:function(t){function e(){}e.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,u=o.length;i<u;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=e,t.exports.TinyEmitter=e}},r={},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,{a:e}),e},o.d=function(t,e){for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o(686).default;function o(t){if(r[t])return r[t].exports;var e=r[t]={exports:{}};return n[t](e,e.exports,o),e.exports}var n,r});
@@ -0,0 +1,16 @@
1
+ {
2
+ "hash": "c9fda6cbf11383f7ca2dd8a1a1e55747",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: \"Performance\"\nguide-section: \"Advanced Usage\"\ntags: [Performance]\n\nbread-crumbs: false\nexecute:\n freeze: auto\n---\n\nThis page benchmarks multimark against other popular Python Markdown parsers and\nexplains why multimark is fast.\n\n## Benchmark: Markdown to HTML\n\nWe render a ~4 KB Markdown document (with headings, lists, code blocks, inline\nformatting, and a table) **1,000 times** and measure the average time per call. All\nparsers produce HTML output. The benchmark document is repeated 10 times to reach a\nrealistic size, and each library is configured with GFM table and strikethrough support\nwhere available.\n\n\n\n::: {#6e7a79ec .cell execution_count=2}\n\n::: {.cell-output .cell-output-display execution_count=2}\n```{=html}\n<div id=\"gdxrblefma\" style=\"padding-left:0px;padding-right:0px;padding-top:10px;padding-bottom:10px;overflow-x:auto;overflow-y:auto;width:auto;height:auto;\">\n<style>\n#gdxrblefma table {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n#gdxrblefma thead, tbody, tfoot, tr, td, th { border-style: none; }\n tr { background-color: transparent; }\n#gdxrblefma p { margin: 0; padding: 0; }\n #gdxrblefma .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: 100%; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }\n #gdxrblefma .gt_caption { padding-top: 4px; padding-bottom: 4px; }\n #gdxrblefma .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }\n #gdxrblefma .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }\n #gdxrblefma .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #gdxrblefma .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #gdxrblefma .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }\n #gdxrblefma .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }\n #gdxrblefma .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }\n #gdxrblefma .gt_column_spanner_outer:first-child { padding-left: 0; }\n #gdxrblefma .gt_column_spanner_outer:last-child { padding-right: 0; }\n #gdxrblefma .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }\n #gdxrblefma .gt_spanner_row { border-bottom-style: hidden; }\n #gdxrblefma .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }\n #gdxrblefma .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }\n #gdxrblefma .gt_from_md> :first-child { margin-top: 0; }\n #gdxrblefma .gt_from_md> :last-child { margin-bottom: 0; }\n #gdxrblefma .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }\n #gdxrblefma .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }\n #gdxrblefma .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }\n #gdxrblefma .gt_row_group_first td { border-top-width: 2px; }\n #gdxrblefma .gt_row_group_first th { border-top-width: 2px; }\n #gdxrblefma .gt_striped { color: #333333; background-color: #F4F4F4; }\n #gdxrblefma .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }\n #gdxrblefma .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }\n #gdxrblefma .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }\n #gdxrblefma .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }\n #gdxrblefma .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }\n #gdxrblefma .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }\n #gdxrblefma .gt_left { text-align: left; }\n #gdxrblefma .gt_center { text-align: center; }\n #gdxrblefma .gt_right { text-align: right; font-variant-numeric: tabular-nums; }\n #gdxrblefma .gt_font_normal { font-weight: normal; }\n #gdxrblefma .gt_font_bold { font-weight: bold; }\n #gdxrblefma .gt_font_italic { font-style: italic; }\n #gdxrblefma .gt_super { font-size: 65%; }\n #gdxrblefma .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }\n #gdxrblefma .gt_asterisk { font-size: 100%; vertical-align: 0; }\n \n</style>\n<table class=\"gt_table\" data-quarto-disable-processing=\"true\" data-quarto-bootstrap=\"false\">\n<thead>\n\n <tr class=\"gt_heading\">\n <td colspan=\"4\" class=\"gt_heading gt_title gt_font_normal\">Markdown → HTML Benchmark</td>\n </tr>\n <tr class=\"gt_heading\">\n <td colspan=\"4\" class=\"gt_heading gt_subtitle gt_font_normal gt_bottom_border\">4,450-byte document, 1,000 iterations, best-of-average</td>\n </tr>\n<tr class=\"gt_col_headings\">\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"Package\">Package</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"Engine\">Engine</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_right\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"Time-(µs)\">Time (µs)</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_right\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"Relative\">Relative</th>\n</tr>\n</thead>\n<tbody class=\"gt_table_body\">\n <tr>\n <td style=\"font-weight: bold;\" class=\"gt_row gt_left\">multimark</td>\n <td style=\"font-weight: bold;\" class=\"gt_row gt_left\">cmark-gfm (C)</td>\n <td style=\"font-weight: bold;\" class=\"gt_row gt_right\">98.6</td>\n <td style=\"font-weight: bold;\" class=\"gt_row gt_right\">1.0×</td>\n </tr>\n <tr>\n <td class=\"gt_row gt_left\">cmarkgfm</td>\n <td class=\"gt_row gt_left\">cmark-gfm (C)</td>\n <td class=\"gt_row gt_right\">114.3</td>\n <td class=\"gt_row gt_right\">1.2×</td>\n </tr>\n <tr>\n <td class=\"gt_row gt_left\">mistune</td>\n <td class=\"gt_row gt_left\">Pure Python</td>\n <td class=\"gt_row gt_right\">1,773.0</td>\n <td class=\"gt_row gt_right\">18.0×</td>\n </tr>\n <tr>\n <td class=\"gt_row gt_left\">commonmark.py</td>\n <td class=\"gt_row gt_left\">Pure Python</td>\n <td class=\"gt_row gt_right\">3,016.9</td>\n <td class=\"gt_row gt_right\">30.6×</td>\n </tr>\n <tr>\n <td class=\"gt_row gt_left\">markdown-it-py</td>\n <td class=\"gt_row gt_left\">Pure Python</td>\n <td class=\"gt_row gt_right\">3,031.3</td>\n <td class=\"gt_row gt_right\">30.7×</td>\n </tr>\n</tbody>\n <tfoot class=\"gt_sourcenotes\">\n \n <tr>\n <td class=\"gt_sourcenote\" colspan=\"4\">Lower is better. &#x27;Relative&#x27; is normalized to multimark = 1.0×.</td>\n </tr>\n\n</tfoot>\n\n</table>\n\n</div>\n \n```\n:::\n:::\n\n\n## Why multimark Is Fast\n\nmultimark wraps a compiled C library via CFFI. The actual parsing and rendering happens\nentirely in C, with Python involved only for the function call overhead and string\nencoding/decoding. This architecture gives you the ergonomics of Python with the speed\nof native code.\n\nFor typical Markdown documents (a few kilobytes), rendering completes in microseconds.\nThe overhead of the Python-to-C boundary is negligible compared to what a pure-Python\nparser would spend on the same input.\n\n## Memory Efficiency\n\nEach render call allocates memory for the AST and output buffer in C, then frees it\nbefore returning. There is no persistent state between calls, which means memory usage\nstays constant regardless of how many documents you process.\n\n::: {#553a7d24 .cell execution_count=3}\n``` {.python .cell-code}\nimport sys\nfrom multimark import markdown_to_html\n\nresult = markdown_to_html(\"# Hello\\n\\nWorld\\n\")\nprint(f\"Result type: {type(result).__name__}\")\nprint(f\"Result size: {sys.getsizeof(result)} bytes\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nResult type: str\nResult size: 69 bytes\n```\n:::\n:::\n\n\nThe C library manages its own memory internally. Python only holds the final output\nstring, so you do not need to worry about manual memory management or cleanup.\n\n## Tips for Maximum Throughput\n\n::: {.details summary=\"Performance tips\" type=\"tip\" icon=\"zap\"}\n\n**Minimize extension overhead.** Each enabled extension adds a small amount of parsing\nwork. If you do not need tables or autolinks for a particular batch, omit them.\n\n**Reuse option values.** Building the options bitmask is cheap, but defining it once\noutside a loop avoids redundant work.\n\n**Process in batches, not one-at-a-time.** If you are reading files from disk, batch the\nI/O and render calls together rather than interleaving with other heavy operations.\n\n**Avoid unnecessary encoding.** multimark accepts `str` and handles UTF-8 encoding\ninternally. Do not pre-encode to bytes and decode back; just pass the string directly.\n\n:::\n\n",
6
+ "supporting": [
7
+ "performance_files"
8
+ ],
9
+ "filters": [],
10
+ "includes": {
11
+ "include-in-header": [
12
+ "<script src=\"https://cdn.jsdelivr.net/npm/requirejs@2.3.6/require.min.js\" integrity=\"sha384-c9c+LnTbwQ3aujuU7ULEPVvgLs+Fn6fJUvIGTsuu1ZcCf11fiEubah0ttpca4ntM sha384-6V1/AdqZRWk1KAlWbKBlGhN7VG4iE/yAZcO6NZPMF8od0vukrvr0tg4qY6NSrItx\" crossorigin=\"anonymous\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js\" integrity=\"sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2\" crossorigin=\"anonymous\" data-relocate-top=\"true\"></script>\n<script type=\"application/javascript\">define('jquery', [],function() {return window.jQuery;})</script>\n"
13
+ ]
14
+ }
15
+ }
16
+ }
Binary file
@@ -8,7 +8,7 @@ parser: numpy
8
8
 
9
9
  # Site
10
10
  # ----
11
- site_url: "https://rich-iannone.github.io/multimark/"
11
+ site_url: "https://posit-dev.github.io/multimark/"
12
12
 
13
13
  # Dynamic Introspection
14
14
  # ---------------------
@@ -129,7 +129,7 @@ tags:
129
129
 
130
130
  # CLI Documentation
131
131
  # -----------------
132
- # cli:
133
- # enabled: true # Enable CLI documentation
134
- # module: my_package.cli # Module containing Click commands
135
- # name: cli # Name of the Click command object
132
+ cli:
133
+ enabled: true
134
+ module: multimark._cli
135
+ name: main
@@ -5,11 +5,11 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "multimark"
7
7
  dynamic = ["version"]
8
- description = "Python bindings to cmark — CommonMark parsing and rendering (HTML, LaTeX, man, XML)"
8
+ description = "Python bindings to cmark: CommonMark parsing and rendering (HTML, LaTeX, man, XML)"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT AND BSD-2-Clause"}
11
11
  requires-python = ">=3.9"
12
- dependencies = ["cffi>=1.15"]
12
+ dependencies = ["cffi>=1.15", "click>=8.0"]
13
13
  authors = [{name = "Rich Iannone"}]
14
14
  keywords = ["markdown", "commonmark", "cmark-gfm", "html", "latex", "gfm"]
15
15
  classifiers = [
@@ -27,9 +27,12 @@ classifiers = [
27
27
  "Topic :: Text Processing :: Markup :: Markdown",
28
28
  ]
29
29
 
30
+ [project.scripts]
31
+ multimark = "multimark._cli:main"
32
+
30
33
  [project.urls]
31
- Homepage = "https://github.com/rich-iannone/multimark"
32
- Issues = "https://github.com/rich-iannone/multimark/issues"
34
+ Homepage = "https://github.com/posit-dev/multimark"
35
+ Issues = "https://github.com/posit-dev/multimark/issues"
33
36
 
34
37
  [tool.setuptools]
35
38
  packages = ["multimark"]
@@ -42,3 +45,15 @@ multimark = ["*.h"]
42
45
 
43
46
  [tool.pytest.ini_options]
44
47
  testpaths = ["tests"]
48
+
49
+ [tool.coverage.run]
50
+ source = ["multimark"]
51
+ omit = ["src/multimark/_build_cmark.py"]
52
+
53
+ [tool.coverage.report]
54
+ exclude_lines = [
55
+ "pragma: no cover",
56
+ "raise MemoryError",
57
+ "if .+ == ffi.NULL",
58
+ "PackageNotFoundError",
59
+ ]
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: multimark
3
+ description: >
4
+ Python bindings to cmark-gfm: CommonMark/GFM parsing and rendering
5
+ (HTML, LaTeX, man, XML, CommonMark). Use when writing Python code that
6
+ converts Markdown to other formats using the multimark package.
7
+ license: MIT
8
+ compatibility: Requires Python >=3.9.
9
+ ---
10
+
11
+ # multimark
12
+
13
+ Fast Python bindings to the cmark-gfm C library for parsing CommonMark and
14
+ GitHub Flavored Markdown (GFM) into HTML, LaTeX, groff man pages, XML, or
15
+ normalized CommonMark.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install multimark
21
+ ```
22
+
23
+ ## Decision Table
24
+
25
+ | Need | Use |
26
+ |------|-----|
27
+ | Convert Markdown to HTML | `markdown_to_html(text)` |
28
+ | Convert Markdown to LaTeX | `markdown_to_latex(text)` |
29
+ | Convert Markdown to groff man page | `markdown_to_man(text)` |
30
+ | Convert Markdown to XML AST | `markdown_to_xml(text)` |
31
+ | Normalize/reformat Markdown | `markdown_to_commonmark(text)` |
32
+ | Enable GFM tables | `markdown_to_html(text, extensions=["table"])` |
33
+ | Enable strikethrough | `markdown_to_html(text, extensions=["strikethrough"])` |
34
+ | Enable autolinks | `markdown_to_html(text, extensions=["autolink"])` |
35
+ | Enable task lists | `markdown_to_html(text, extensions=["tasklist"])` |
36
+ | Combine multiple options | `markdown_to_html(text, options=Options.SMART \| Options.UNSAFE)` |
37
+ | Check bundled cmark-gfm version | `cmark_version()` |
38
+
39
+ ## API
40
+
41
+ All renderer functions share the same signature pattern:
42
+
43
+ ```python
44
+ from multimark import markdown_to_html, markdown_to_latex, markdown_to_man, markdown_to_xml, markdown_to_commonmark
45
+
46
+ # Basic usage: all renderers accept the same keyword arguments
47
+ html = markdown_to_html(text, smart=True, unsafe=True, extensions=["table", "autolink"])
48
+ ```
49
+
50
+ ### Common keyword arguments (all renderers)
51
+
52
+ | Parameter | Type | Default | Description |
53
+ |-----------|------|---------|-------------|
54
+ | `hardbreaks` | `bool` | `False` | Render soft newlines as `<br />` |
55
+ | `smart` | `bool` | `False` | Typographic quotes, en/em-dashes, ellipses |
56
+ | `normalize` | `bool` | `False` | Consolidate adjacent text nodes |
57
+ | `sourcepos` | `bool` | `False` | Add source position attributes (HTML/XML only) |
58
+ | `unsafe` | `bool` | `False` | Allow raw HTML passthrough |
59
+ | `footnotes` | `bool` | `False` | Enable `[^label]` footnote syntax |
60
+ | `extensions` | `Sequence[str]` | `()` | GFM extensions to enable |
61
+ | `options` | `int` | `0` | Bitmask of `Options` flags |
62
+
63
+ ### Additional parameter (LaTeX, man, CommonMark renderers only)
64
+
65
+ | Parameter | Type | Default | Description |
66
+ |-----------|------|---------|-------------|
67
+ | `width` | `int` | `0` | Line wrap column (0 = no wrapping) |
68
+
69
+ ### Options bitmask
70
+
71
+ ```python
72
+ from multimark import Options
73
+
74
+ # Combine flags with |
75
+ opts = Options.SMART | Options.UNSAFE | Options.FOOTNOTES
76
+
77
+ # GFM-specific flags (no keyword shortcut)
78
+ opts = Options.GITHUB_PRE_LANG | Options.STRIKETHROUGH_DOUBLE_TILDE | Options.LIBERAL_HTML_TAG
79
+ ```
80
+
81
+ ### Valid GFM extensions
82
+
83
+ The only valid extension names are: `"table"`, `"strikethrough"`, `"autolink"`, `"tagfilter"`, `"tasklist"`.
84
+
85
+ ## Gotchas
86
+
87
+ 1. The module name is `multimark`, not `multi-mark` or `multi_mark`.
88
+ 2. Raw HTML is **stripped by default** (replaced with `<!-- raw HTML omitted -->`). You must pass `unsafe=True` to allow HTML passthrough.
89
+ 3. The `extensions` parameter takes a **sequence of strings**, not a single string. Use `extensions=["table"]`, never `extensions="table"`.
90
+ 4. The `sourcepos` parameter is silently ignored by `markdown_to_latex()` and `markdown_to_man()` (it only affects HTML and XML output).
91
+ 5. `Options` flags and keyword arguments are merged via OR. `markdown_to_html(text, smart=True, options=Options.UNSAFE)` means `SMART | UNSAFE`.
92
+ 6. Passing an invalid extension name raises `ValueError`, not `KeyError`.
93
+ 7. All renderers return `str`, never `bytes`. Input must also be `str`.
94
+ 8. The `width` parameter is not available on `markdown_to_html()` or `markdown_to_xml()`.
95
+
96
+ ## Best Practices
97
+
98
+ - Prefer keyword arguments (`smart=True`) over the `Options` bitmask for common flags.
99
+ - Use the `Options` bitmask only for GFM-specific flags that lack keyword shortcuts (`GITHUB_PRE_LANG`, `STRIKETHROUGH_DOUBLE_TILDE`, `LIBERAL_HTML_TAG`).
100
+ - Enable only the GFM extensions you need: each adds parsing overhead.
101
+ - For security-sensitive contexts, never set `unsafe=True`. The default safe mode strips all raw HTML.
102
+ - The library is thread-safe: you can call renderers from multiple threads concurrently.
103
+
104
+ ## Resources
105
+
106
+ - [Full documentation](https://posit-dev.github.io/multimark/)
107
+ - [llms.txt](https://posit-dev.github.io/multimark/llms.txt): Indexed API reference for LLMs
108
+ - [llms-full.txt](https://posit-dev.github.io/multimark/llms-full.txt): Comprehensive documentation for LLMs
@@ -1,8 +1,3 @@
1
- """multimark — Python bindings to the cmark-gfm CommonMark/GFM C library.
2
-
3
- Provides parsing and rendering of CommonMark and GitHub Flavored Markdown
4
- to HTML, LaTeX, groff man, XML, and normalized CommonMark.
5
- """
6
1
  from enum import IntFlag
7
2
  from importlib.metadata import PackageNotFoundError, version as _get_version
8
3
 
@@ -1,4 +1,3 @@
1
- """CFFI build script — compiles the vendored cmark-gfm C library + extensions."""
2
1
  import os
3
2
  import glob
4
3
  from cffi import FFI