multimark 0.4.0__tar.gz → 0.5.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 (224) hide show
  1. {multimark-0.4.0 → multimark-0.5.0}/CITATION.cff +1 -1
  2. {multimark-0.4.0 → multimark-0.5.0}/PKG-INFO +40 -9
  3. {multimark-0.4.0 → multimark-0.5.0}/README.md +38 -7
  4. multimark-0.5.0/_freeze/reference/Options/execute-results/html.json +12 -0
  5. multimark-0.5.0/_freeze/reference/cmark_version/execute-results/html.json +12 -0
  6. multimark-0.5.0/_freeze/reference/markdown_to_commonmark/execute-results/html.json +12 -0
  7. multimark-0.5.0/_freeze/reference/markdown_to_html/execute-results/html.json +12 -0
  8. multimark-0.5.0/_freeze/reference/markdown_to_latex/execute-results/html.json +12 -0
  9. multimark-0.5.0/_freeze/reference/markdown_to_man/execute-results/html.json +12 -0
  10. multimark-0.5.0/_freeze/reference/markdown_to_plaintext/execute-results/html.json +12 -0
  11. multimark-0.5.0/_freeze/reference/markdown_to_xml/execute-results/html.json +12 -0
  12. {multimark-0.4.0 → multimark-0.5.0}/_freeze/user-guide/gfm-extensions/execute-results/html.json +3 -3
  13. multimark-0.5.0/_freeze/user-guide/introduction/execute-results/html.json +12 -0
  14. multimark-0.5.0/_freeze/user-guide/options-and-flags/execute-results/html.json +12 -0
  15. multimark-0.5.0/_freeze/user-guide/output-formats/execute-results/html.json +12 -0
  16. multimark-0.5.0/_freeze/user-guide/parsing-and-ast/execute-results/html.json +12 -0
  17. {multimark-0.4.0 → multimark-0.5.0}/great-docs.yml +2 -1
  18. {multimark-0.4.0 → multimark-0.5.0}/index.qmd +4 -3
  19. {multimark-0.4.0 → multimark-0.5.0}/pyproject.toml +1 -1
  20. {multimark-0.4.0 → multimark-0.5.0}/skills/multimark/SKILL.md +5 -4
  21. {multimark-0.4.0 → multimark-0.5.0}/src/multimark/__init__.py +2 -0
  22. {multimark-0.4.0 → multimark-0.5.0}/src/multimark/_cli.py +11 -4
  23. {multimark-0.4.0 → multimark-0.5.0}/src/multimark/_cmark.py +139 -14
  24. {multimark-0.4.0 → multimark-0.5.0}/src/multimark/_node.py +27 -1
  25. {multimark-0.4.0 → multimark-0.5.0}/src/multimark/_parser.py +34 -1
  26. {multimark-0.4.0 → multimark-0.5.0}/src/multimark/cmark.cffi.h +2 -0
  27. {multimark-0.4.0 → multimark-0.5.0}/src/multimark.egg-info/PKG-INFO +40 -9
  28. {multimark-0.4.0 → multimark-0.5.0}/src/multimark.egg-info/SOURCES.txt +5 -0
  29. {multimark-0.4.0 → multimark-0.5.0}/src/multimark.egg-info/scm_file_list.json +5 -0
  30. multimark-0.5.0/src/multimark.egg-info/scm_version.json +8 -0
  31. {multimark-0.4.0 → multimark-0.5.0}/tests/test_ast.py +14 -0
  32. {multimark-0.4.0 → multimark-0.5.0}/tests/test_cli.py +14 -0
  33. {multimark-0.4.0 → multimark-0.5.0}/tests/test_errors.py +2 -0
  34. {multimark-0.4.0 → multimark-0.5.0}/tests/test_extensions.py +3 -1
  35. multimark-0.5.0/tests/test_math.py +256 -0
  36. {multimark-0.4.0 → multimark-0.5.0}/tests/test_package.py +2 -0
  37. {multimark-0.4.0 → multimark-0.5.0}/tests/test_param_combos.py +7 -3
  38. {multimark-0.4.0 → multimark-0.5.0}/tests/test_parser.py +23 -0
  39. {multimark-0.4.0 → multimark-0.5.0}/tests/test_pathological.py +2 -0
  40. multimark-0.5.0/tests/test_plaintext.py +55 -0
  41. {multimark-0.4.0 → multimark-0.5.0}/tests/test_threads.py +25 -0
  42. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/autolink.c +3 -1
  43. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/cmark-gfm-core-extensions.h +6 -0
  44. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/core-extensions.c +2 -0
  45. multimark-0.5.0/third_party/cmark-gfm/extensions/texmath.c +400 -0
  46. multimark-0.5.0/third_party/cmark-gfm/extensions/texmath.h +11 -0
  47. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/blocks.c +11 -4
  48. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark-gfm-extension_api.h +9 -0
  49. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/commonmark.c +10 -0
  50. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/inlines.c +46 -19
  51. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/inlines.h +1 -0
  52. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/node.h +6 -1
  53. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/parser.h +5 -0
  54. {multimark-0.4.0 → multimark-0.5.0}/user_guide/00-introduction.qmd +3 -2
  55. {multimark-0.4.0 → multimark-0.5.0}/user_guide/03-gfm-extensions.qmd +72 -4
  56. {multimark-0.4.0 → multimark-0.5.0}/user_guide/04-output-formats.qmd +63 -3
  57. {multimark-0.4.0 → multimark-0.5.0}/user_guide/05-options-and-flags.qmd +6 -3
  58. {multimark-0.4.0 → multimark-0.5.0}/user_guide/06-cli.qmd +23 -8
  59. {multimark-0.4.0 → multimark-0.5.0}/user_guide/09-performance.qmd +1 -1
  60. {multimark-0.4.0 → multimark-0.5.0}/user_guide/10-parsing-and-ast.qmd +18 -2
  61. multimark-0.4.0/_freeze/reference/Options/execute-results/html.json +0 -12
  62. multimark-0.4.0/_freeze/reference/cmark_version/execute-results/html.json +0 -12
  63. multimark-0.4.0/_freeze/reference/markdown_to_commonmark/execute-results/html.json +0 -12
  64. multimark-0.4.0/_freeze/reference/markdown_to_html/execute-results/html.json +0 -12
  65. multimark-0.4.0/_freeze/reference/markdown_to_latex/execute-results/html.json +0 -12
  66. multimark-0.4.0/_freeze/reference/markdown_to_man/execute-results/html.json +0 -12
  67. multimark-0.4.0/_freeze/reference/markdown_to_xml/execute-results/html.json +0 -12
  68. multimark-0.4.0/_freeze/user-guide/introduction/execute-results/html.json +0 -12
  69. multimark-0.4.0/_freeze/user-guide/options-and-flags/execute-results/html.json +0 -12
  70. multimark-0.4.0/_freeze/user-guide/output-formats/execute-results/html.json +0 -12
  71. multimark-0.4.0/_freeze/user-guide/parsing-and-ast/execute-results/html.json +0 -12
  72. multimark-0.4.0/src/multimark.egg-info/scm_version.json +0 -8
  73. {multimark-0.4.0 → multimark-0.5.0}/.github/CODE_OF_CONDUCT.md +0 -0
  74. {multimark-0.4.0 → multimark-0.5.0}/.github/CONTRIBUTING.md +0 -0
  75. {multimark-0.4.0 → multimark-0.5.0}/.github/ISSUE_TEMPLATE/bug.md +0 -0
  76. {multimark-0.4.0 → multimark-0.5.0}/.github/ISSUE_TEMPLATE/feature.md +0 -0
  77. {multimark-0.4.0 → multimark-0.5.0}/.github/ISSUE_TEMPLATE/question.md +0 -0
  78. {multimark-0.4.0 → multimark-0.5.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  79. {multimark-0.4.0 → multimark-0.5.0}/.github/workflows/ci.yml +0 -0
  80. {multimark-0.4.0 → multimark-0.5.0}/.github/workflows/docs.yml +0 -0
  81. {multimark-0.4.0 → multimark-0.5.0}/.github/workflows/pyodide.yml +0 -0
  82. {multimark-0.4.0 → multimark-0.5.0}/.github/workflows/test-build.yml +0 -0
  83. {multimark-0.4.0 → multimark-0.5.0}/.github/workflows/test-sdist.yml +0 -0
  84. {multimark-0.4.0 → multimark-0.5.0}/.gitignore +0 -0
  85. {multimark-0.4.0 → multimark-0.5.0}/LICENSE +0 -0
  86. {multimark-0.4.0 → multimark-0.5.0}/Makefile +0 -0
  87. {multimark-0.4.0 → multimark-0.5.0}/ROADMAP.md +0 -0
  88. {multimark-0.4.0 → multimark-0.5.0}/WHEELS.md +0 -0
  89. {multimark-0.4.0 → multimark-0.5.0}/_freeze/site_libs/clipboard/clipboard.min.js +0 -0
  90. {multimark-0.4.0 → multimark-0.5.0}/_freeze/user-guide/installation/execute-results/html.json +0 -0
  91. {multimark-0.4.0 → multimark-0.5.0}/_freeze/user-guide/performance/execute-results/html.json +0 -0
  92. {multimark-0.4.0 → multimark-0.5.0}/_freeze/user-guide/quick-start/execute-results/html.json +0 -0
  93. {multimark-0.4.0 → multimark-0.5.0}/_freeze/user-guide/recipes/execute-results/html.json +0 -0
  94. {multimark-0.4.0 → multimark-0.5.0}/_freeze/user-guide/security/execute-results/html.json +0 -0
  95. {multimark-0.4.0 → multimark-0.5.0}/assets/logo-dark.png +0 -0
  96. {multimark-0.4.0 → multimark-0.5.0}/assets/logo-light.png +0 -0
  97. {multimark-0.4.0 → multimark-0.5.0}/assets/logo.png +0 -0
  98. {multimark-0.4.0 → multimark-0.5.0}/multimark/_binding.c +0 -0
  99. {multimark-0.4.0 → multimark-0.5.0}/multimark/_binding.o +0 -0
  100. {multimark-0.4.0 → multimark-0.5.0}/setup.cfg +0 -0
  101. {multimark-0.4.0 → multimark-0.5.0}/setup.py +0 -0
  102. {multimark-0.4.0 → multimark-0.5.0}/src/multimark/_batch.py +0 -0
  103. {multimark-0.4.0 → multimark-0.5.0}/src/multimark/_build_cmark.py +0 -0
  104. {multimark-0.4.0 → multimark-0.5.0}/src/multimark.egg-info/dependency_links.txt +0 -0
  105. {multimark-0.4.0 → multimark-0.5.0}/src/multimark.egg-info/entry_points.txt +0 -0
  106. {multimark-0.4.0 → multimark-0.5.0}/src/multimark.egg-info/requires.txt +0 -0
  107. {multimark-0.4.0 → multimark-0.5.0}/src/multimark.egg-info/top_level.txt +0 -0
  108. {multimark-0.4.0 → multimark-0.5.0}/tests/conftest.py +0 -0
  109. {multimark-0.4.0 → multimark-0.5.0}/tests/fixtures/extensions.txt +0 -0
  110. {multimark-0.4.0 → multimark-0.5.0}/tests/fixtures/regression.txt +0 -0
  111. {multimark-0.4.0 → multimark-0.5.0}/tests/fixtures/smart_punct.txt +0 -0
  112. {multimark-0.4.0 → multimark-0.5.0}/tests/fixtures/spec.txt +0 -0
  113. {multimark-0.4.0 → multimark-0.5.0}/tests/spec_parser.py +0 -0
  114. {multimark-0.4.0 → multimark-0.5.0}/tests/test_batch.py +0 -0
  115. {multimark-0.4.0 → multimark-0.5.0}/tests/test_commonmark.py +0 -0
  116. {multimark-0.4.0 → multimark-0.5.0}/tests/test_html.py +0 -0
  117. {multimark-0.4.0 → multimark-0.5.0}/tests/test_latex.py +0 -0
  118. {multimark-0.4.0 → multimark-0.5.0}/tests/test_man.py +0 -0
  119. {multimark-0.4.0 → multimark-0.5.0}/tests/test_regressions.py +0 -0
  120. {multimark-0.4.0 → multimark-0.5.0}/tests/test_spec_html.py +0 -0
  121. {multimark-0.4.0 → multimark-0.5.0}/tests/test_spec_renderers.py +0 -0
  122. {multimark-0.4.0 → multimark-0.5.0}/tests/test_xml.py +0 -0
  123. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/CMakeLists.txt +0 -0
  124. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/autolink.h +0 -0
  125. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/autolink.o +0 -0
  126. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/core-extensions.o +0 -0
  127. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/ext_scanners.c +0 -0
  128. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/ext_scanners.h +0 -0
  129. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/ext_scanners.o +0 -0
  130. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/ext_scanners.re +0 -0
  131. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/strikethrough.c +0 -0
  132. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/strikethrough.h +0 -0
  133. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/strikethrough.o +0 -0
  134. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/table.c +0 -0
  135. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/table.h +0 -0
  136. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/table.o +0 -0
  137. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/tagfilter.c +0 -0
  138. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/tagfilter.h +0 -0
  139. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/tagfilter.o +0 -0
  140. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/tasklist.c +0 -0
  141. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/tasklist.h +0 -0
  142. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/extensions/tasklist.o +0 -0
  143. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/CMakeLists.txt +0 -0
  144. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/arena.c +0 -0
  145. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/arena.o +0 -0
  146. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/blocks.o +0 -0
  147. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/buffer.c +0 -0
  148. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/buffer.h +0 -0
  149. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/buffer.o +0 -0
  150. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/case_fold_switch.inc +0 -0
  151. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/chunk.h +0 -0
  152. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark-gfm.h +0 -0
  153. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark-gfm_export.h +0 -0
  154. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark-gfm_version.h +0 -0
  155. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark-gfm_version.h.in +0 -0
  156. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark.c +0 -0
  157. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark.o +0 -0
  158. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark_ctype.c +0 -0
  159. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark_ctype.h +0 -0
  160. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/cmark_ctype.o +0 -0
  161. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/commonmark.o +0 -0
  162. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/config.h +0 -0
  163. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/config.h.in +0 -0
  164. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/entities.inc +0 -0
  165. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/footnotes.c +0 -0
  166. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/footnotes.h +0 -0
  167. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/footnotes.o +0 -0
  168. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/houdini.h +0 -0
  169. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/houdini_href_e.c +0 -0
  170. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/houdini_href_e.o +0 -0
  171. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/houdini_html_e.c +0 -0
  172. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/houdini_html_e.o +0 -0
  173. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/houdini_html_u.c +0 -0
  174. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/houdini_html_u.o +0 -0
  175. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/html.c +0 -0
  176. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/html.h +0 -0
  177. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/html.o +0 -0
  178. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/inlines.o +0 -0
  179. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/iterator.c +0 -0
  180. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/iterator.h +0 -0
  181. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/iterator.o +0 -0
  182. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/latex.c +0 -0
  183. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/latex.o +0 -0
  184. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/libcmark-gfm.pc.in +0 -0
  185. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/linked_list.c +0 -0
  186. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/linked_list.o +0 -0
  187. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/main.c +0 -0
  188. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/man.c +0 -0
  189. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/man.o +0 -0
  190. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/map.c +0 -0
  191. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/map.h +0 -0
  192. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/map.o +0 -0
  193. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/node.c +0 -0
  194. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/node.o +0 -0
  195. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/plaintext.c +0 -0
  196. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/plaintext.o +0 -0
  197. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/plugin.c +0 -0
  198. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/plugin.h +0 -0
  199. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/plugin.o +0 -0
  200. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/references.c +0 -0
  201. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/references.h +0 -0
  202. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/references.o +0 -0
  203. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/registry.c +0 -0
  204. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/registry.h +0 -0
  205. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/registry.o +0 -0
  206. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/render.c +0 -0
  207. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/render.h +0 -0
  208. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/render.o +0 -0
  209. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/scanners.c +0 -0
  210. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/scanners.h +0 -0
  211. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/scanners.o +0 -0
  212. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/scanners.re +0 -0
  213. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/syntax_extension.c +0 -0
  214. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/syntax_extension.h +0 -0
  215. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/syntax_extension.o +0 -0
  216. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/utf8.c +0 -0
  217. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/utf8.h +0 -0
  218. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/utf8.o +0 -0
  219. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/xml.c +0 -0
  220. {multimark-0.4.0 → multimark-0.5.0}/third_party/cmark-gfm/src/xml.o +0 -0
  221. {multimark-0.4.0 → multimark-0.5.0}/user_guide/01-installation.qmd +0 -0
  222. {multimark-0.4.0 → multimark-0.5.0}/user_guide/02-quick-start.qmd +0 -0
  223. {multimark-0.4.0 → multimark-0.5.0}/user_guide/07-security.qmd +0 -0
  224. {multimark-0.4.0 → multimark-0.5.0}/user_guide/08-recipes.qmd +0 -0
@@ -3,7 +3,7 @@ message: 'If you wish to cite the "nokap" package use:'
3
3
  type: software
4
4
  license: MIT
5
5
  title: "multimark provides Python bindings to cmark and allows for CommonMark parsing and rendering (HTML, LaTeX, man, XML)"
6
- version: "0.2.0"
6
+ version: "0.4.0"
7
7
  abstract:
8
8
  multimark provides Python bindings to cmark, enabling CommonMark parsing and rendering to various formats
9
9
  including HTML, LaTeX, man, and XML. A CLI is also provided for command-line usage. The package is designed to be fast,
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multimark
3
- Version: 0.4.0
4
- Summary: Python bindings to cmark: CommonMark parsing and rendering (HTML, LaTeX, man, XML)
3
+ Version: 0.5.0
4
+ Summary: Python bindings to cmark: CommonMark parsing and rendering (HTML, LaTeX, man, XML, CommonMark, plaintext)
5
5
  Author: Rich Iannone
6
6
  License-Expression: MIT AND BSD-2-Clause
7
7
  Project-URL: Homepage, https://github.com/posit-dev/multimark
@@ -39,7 +39,7 @@ Dynamic: license-file
39
39
 
40
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.
41
41
 
42
- Renders Markdown to **HTML**, **LaTeX**, **groff man**, **XML**, and **normalized CommonMark**: all from a single, lightweight package.
42
+ Renders Markdown to **HTML**, **LaTeX**, **groff man**, **XML**, **normalized CommonMark**, and **plain text**: all from a single, lightweight package.
43
43
 
44
44
  ## Installation
45
45
 
@@ -69,8 +69,21 @@ latex = markdown_to_latex("**Hello**, *world*!")
69
69
  | `markdown_to_latex()` | LaTeX |
70
70
  | `markdown_to_man()` | groff man page |
71
71
  | `markdown_to_commonmark()` | Normalized CommonMark |
72
+ | `markdown_to_plaintext()` | Readable plain text |
72
73
  | `markdown_to_xml()` | XML (AST representation) |
73
74
 
75
+ ```python
76
+ from multimark import markdown_to_plaintext
77
+
78
+ markdown_to_plaintext("**Hello**, *world*!")
79
+ # 'Hello, world!\n'
80
+ ```
81
+
82
+ Plaintext output preserves list markers, code contents, and image descriptions,
83
+ but drops link destinations. GFM tables keep pipe syntax, task lists keep checkbox
84
+ markers, and strikethrough uses single tildes. Raw HTML blocks (including their
85
+ text) are omitted even with `unsafe=True`. Empty input returns `"\n"`.
86
+
74
87
  ## Options
75
88
 
76
89
  Use named boolean keyword arguments for common settings:
@@ -90,7 +103,7 @@ markdown_to_html('<div>hi</div>', unsafe=True)
90
103
  markdown_to_html('**Hello**', sourcepos=True)
91
104
  # '<p data-sourcepos="1:1-1:9"><strong>Hello</strong></p>\n'
92
105
 
93
- # Line wrapping (LaTeX, man, and commonmark renderers)
106
+ # Line wrapping (LaTeX, man, CommonMark, and plaintext renderers)
94
107
  markdown_to_latex('**Hello**, *world*!', width=80)
95
108
  # '\\textbf{Hello}, \\emph{world}!\n'
96
109
 
@@ -128,23 +141,41 @@ html = markdown_to_html(text, extensions=["table", "strikethrough", "autolink",
128
141
 
129
142
  Available extensions: `table`, `strikethrough`, `autolink`, `tagfilter`, `tasklist`.
130
143
 
144
+ ## TeX Math
145
+
146
+ The `math` extension (not part of GFM) recognizes `$...$` and `$$...$$` math with
147
+ Pandoc's delimiter rules, so dollar amounts like `$5` stay text. HTML output uses the
148
+ markup that MathJax and KaTeX look for:
149
+
150
+ ```python
151
+ markdown_to_html("Euler: $e^{i\\pi} + 1 = 0$, costing $5", extensions=["math"])
152
+ # '<p>Euler: <span class="math inline">\\(e^{i\\pi} + 1 = 0\\)</span>, costing $5</p>\n'
153
+ ```
154
+
155
+ LaTeX output uses `\(...\)` and `\[...\]`; the CommonMark, man, and plaintext renderers
156
+ keep the dollar delimiters.
157
+
131
158
  ## All Renderer Parameters
132
159
 
133
160
  Every renderer accepts:
134
161
 
135
162
  - **`text`**: Markdown string
136
163
  - **`options`**: raw bitmask (default `0`)
137
- - **`extensions`**: list of GFM extension names (default `()`)
164
+ - **`extensions`**: list of extension names (default `()`)
138
165
  - **`smart`**: smart punctuation
139
166
  - **`hardbreaks`**: render soft breaks as `<br>`
140
- - **`unsafe`**: allow raw HTML
167
+ - **`unsafe`**: allow raw HTML (no effect on plaintext output)
141
168
  - **`normalize`**: consolidate adjacent text nodes
142
169
  - **`footnotes`**: enable footnote syntax
143
170
 
144
171
  Additional parameters:
145
172
 
146
173
  - **`sourcepos`**: Source position attributes (HTML and XML only)
147
- - **`width`**: Line wrap column (LaTeX, man, and commonmark only; `0` = no wrap)
174
+ - **`width`**: Line wrap column (LaTeX, man, CommonMark, and plaintext only; `0` = no wrap)
175
+
176
+ For plaintext, `hardbreaks=True` disables width-based wrapping. With `width=0`,
177
+ soft line breaks are preserved; a positive width reflows them as spaces before
178
+ wrapping. Output whitespace and trailing newlines are retained.
148
179
 
149
180
  ## Why multimark?
150
181
 
@@ -153,14 +184,14 @@ Several Python packages wrap cmark or provide CommonMark parsing. Here's how the
153
184
  | | **multimark** | **[cmarkgfm](https://github.com/theacodes/cmarkgfm)** | **[commonmark.py](https://github.com/readthedocs/commonmark.py)** |
154
185
  |---|---|---|---|
155
186
  | Engine | cmark-gfm (C, vendored) | cmark-gfm (C, vendored) | Pure Python |
156
- | Output formats | HTML, LaTeX, man, XML, CommonMark | HTML only | HTML only |
187
+ | Output formats | HTML, LaTeX, man, XML, CommonMark, plaintext | HTML only | HTML only |
157
188
  | GFM extensions | ✓ | ✓ | ✗ |
158
189
  | Safe by default | ✓ | ✓ | ✗ |
159
190
  | Convenience kwargs | `smart=True`, `unsafe=True`, etc. | Raw bitmask only | N/A |
160
191
  | Performance | **Fastest** (14% faster than cmarkgfm) | Fast | ~31× slower |
161
192
  | Maintained | Active (2026) | Active (2025) | Unmaintained (2019) |
162
193
 
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.
194
+ multimark uses the same battle-tested C library as `cmarkgfm` but exposes all six 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
195
 
165
196
  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.
166
197
 
@@ -11,7 +11,7 @@
11
11
 
12
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.
13
13
 
14
- Renders Markdown to **HTML**, **LaTeX**, **groff man**, **XML**, and **normalized CommonMark**: all from a single, lightweight package.
14
+ Renders Markdown to **HTML**, **LaTeX**, **groff man**, **XML**, **normalized CommonMark**, and **plain text**: all from a single, lightweight package.
15
15
 
16
16
  ## Installation
17
17
 
@@ -41,8 +41,21 @@ latex = markdown_to_latex("**Hello**, *world*!")
41
41
  | `markdown_to_latex()` | LaTeX |
42
42
  | `markdown_to_man()` | groff man page |
43
43
  | `markdown_to_commonmark()` | Normalized CommonMark |
44
+ | `markdown_to_plaintext()` | Readable plain text |
44
45
  | `markdown_to_xml()` | XML (AST representation) |
45
46
 
47
+ ```python
48
+ from multimark import markdown_to_plaintext
49
+
50
+ markdown_to_plaintext("**Hello**, *world*!")
51
+ # 'Hello, world!\n'
52
+ ```
53
+
54
+ Plaintext output preserves list markers, code contents, and image descriptions,
55
+ but drops link destinations. GFM tables keep pipe syntax, task lists keep checkbox
56
+ markers, and strikethrough uses single tildes. Raw HTML blocks (including their
57
+ text) are omitted even with `unsafe=True`. Empty input returns `"\n"`.
58
+
46
59
  ## Options
47
60
 
48
61
  Use named boolean keyword arguments for common settings:
@@ -62,7 +75,7 @@ markdown_to_html('<div>hi</div>', unsafe=True)
62
75
  markdown_to_html('**Hello**', sourcepos=True)
63
76
  # '<p data-sourcepos="1:1-1:9"><strong>Hello</strong></p>\n'
64
77
 
65
- # Line wrapping (LaTeX, man, and commonmark renderers)
78
+ # Line wrapping (LaTeX, man, CommonMark, and plaintext renderers)
66
79
  markdown_to_latex('**Hello**, *world*!', width=80)
67
80
  # '\\textbf{Hello}, \\emph{world}!\n'
68
81
 
@@ -100,23 +113,41 @@ html = markdown_to_html(text, extensions=["table", "strikethrough", "autolink",
100
113
 
101
114
  Available extensions: `table`, `strikethrough`, `autolink`, `tagfilter`, `tasklist`.
102
115
 
116
+ ## TeX Math
117
+
118
+ The `math` extension (not part of GFM) recognizes `$...$` and `$$...$$` math with
119
+ Pandoc's delimiter rules, so dollar amounts like `$5` stay text. HTML output uses the
120
+ markup that MathJax and KaTeX look for:
121
+
122
+ ```python
123
+ markdown_to_html("Euler: $e^{i\\pi} + 1 = 0$, costing $5", extensions=["math"])
124
+ # '<p>Euler: <span class="math inline">\\(e^{i\\pi} + 1 = 0\\)</span>, costing $5</p>\n'
125
+ ```
126
+
127
+ LaTeX output uses `\(...\)` and `\[...\]`; the CommonMark, man, and plaintext renderers
128
+ keep the dollar delimiters.
129
+
103
130
  ## All Renderer Parameters
104
131
 
105
132
  Every renderer accepts:
106
133
 
107
134
  - **`text`**: Markdown string
108
135
  - **`options`**: raw bitmask (default `0`)
109
- - **`extensions`**: list of GFM extension names (default `()`)
136
+ - **`extensions`**: list of extension names (default `()`)
110
137
  - **`smart`**: smart punctuation
111
138
  - **`hardbreaks`**: render soft breaks as `<br>`
112
- - **`unsafe`**: allow raw HTML
139
+ - **`unsafe`**: allow raw HTML (no effect on plaintext output)
113
140
  - **`normalize`**: consolidate adjacent text nodes
114
141
  - **`footnotes`**: enable footnote syntax
115
142
 
116
143
  Additional parameters:
117
144
 
118
145
  - **`sourcepos`**: Source position attributes (HTML and XML only)
119
- - **`width`**: Line wrap column (LaTeX, man, and commonmark only; `0` = no wrap)
146
+ - **`width`**: Line wrap column (LaTeX, man, CommonMark, and plaintext only; `0` = no wrap)
147
+
148
+ For plaintext, `hardbreaks=True` disables width-based wrapping. With `width=0`,
149
+ soft line breaks are preserved; a positive width reflows them as spaces before
150
+ wrapping. Output whitespace and trailing newlines are retained.
120
151
 
121
152
  ## Why multimark?
122
153
 
@@ -125,14 +156,14 @@ Several Python packages wrap cmark or provide CommonMark parsing. Here's how the
125
156
  | | **multimark** | **[cmarkgfm](https://github.com/theacodes/cmarkgfm)** | **[commonmark.py](https://github.com/readthedocs/commonmark.py)** |
126
157
  |---|---|---|---|
127
158
  | Engine | cmark-gfm (C, vendored) | cmark-gfm (C, vendored) | Pure Python |
128
- | Output formats | HTML, LaTeX, man, XML, CommonMark | HTML only | HTML only |
159
+ | Output formats | HTML, LaTeX, man, XML, CommonMark, plaintext | HTML only | HTML only |
129
160
  | GFM extensions | ✓ | ✓ | ✗ |
130
161
  | Safe by default | ✓ | ✓ | ✗ |
131
162
  | Convenience kwargs | `smart=True`, `unsafe=True`, etc. | Raw bitmask only | N/A |
132
163
  | Performance | **Fastest** (14% faster than cmarkgfm) | Fast | ~31× slower |
133
164
  | Maintained | Active (2026) | Active (2025) | Unmaintained (2019) |
134
165
 
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.
166
+ multimark uses the same battle-tested C library as `cmarkgfm` but exposes all six 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
167
 
137
168
  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.
138
169
 
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "cf1c5698b2087f39f255be422442d6c5",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: \"[Options]{.doc-object-name .doc-class .doc-label .doc-label-enum}\"\nbody-classes: doc-api-page doc-py-api-page\nshift-heading-level-by: 0\nbread-crumbs: false\ntoc-depth: 3\npage-navigation: false\nhtml-table-processing: none\n---\n\n::: {.doc-subject}\n\nCommonMark/GFM parsing and rendering options.\n:::\n\n::: {.doc-usage-source}\nUsage\n\n[Source](https://github.com/posit-dev/multimark/blob/feat-markdown-to-plaintext/src/multimark/__init__.py#L25-L82){target=\"_blank\" rel=\"noopener\"}\n:::\n\n::: {.doc-signature .doc-Kind.CLASS}\n```python\nOptions\n```\n:::\n\n::: {.doc-text}\n\nAn `IntFlag` enumeration of all option flags supported by the cmark-gfm library.\nOptions can be combined using the bitwise OR operator (`|`) and passed to any\nrenderer's `options=` parameter. This provides a composable, lower-level alternative\nto the named boolean keyword arguments available on each renderer function.\n\nMost users will prefer the named keyword arguments (e.g., `smart=True`) for common\noptions. The `Options` bitmask is useful when you need to combine multiple flags\ninto a single reusable value, or when working with GFM-specific flags that do not\nhave dedicated keyword arguments.\n:::\n\n## Examples {.doc-examples}\n\nCombine multiple flags with the `|` operator:\n\n::: {#50c5d8bd .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html, Options\n\nopts = Options.SMART | Options.UNSAFE\nmarkdown_to_html('\"Hello\" -- world', options=opts)\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n'<p>“Hello” – world</p>\\n'\n```\n:::\n:::\n\n\nMix a bitmask with named keyword arguments (they are OR'd together):\n\n::: {#fb398a5a .cell execution_count=2}\n``` {.python .cell-code}\ntext = \"Here's some *text* to convert\"\nmarkdown_to_html(text, options=Options.SMART, footnotes=True)\n```\n\n::: {.cell-output .cell-output-display execution_count=2}\n```\n'<p>Here’s some <em>text</em> to convert</p>\\n'\n```\n:::\n:::\n\n\nUse GFM-specific flags that have no keyword shortcut:\n\n::: {#8aab1470 .cell execution_count=3}\n``` {.python .cell-code}\nmarkdown_to_html(\n \"~~deleted~~\",\n options=Options.STRIKETHROUGH_DOUBLE_TILDE,\n extensions=[\"strikethrough\"],\n)\n```\n\n::: {.cell-output .cell-output-display execution_count=3}\n```\n'<p><del>deleted</del></p>\\n'\n```\n:::\n:::\n\n\n",
6
+ "supporting": [
7
+ "Options_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "f88559de60babb56307135b4434b4e13",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: >-\n [cmark_version()]{.doc-object-name .doc-function .doc-label\n .doc-label-function}\nbody-classes: doc-api-page doc-py-api-page\nshift-heading-level-by: 0\nbread-crumbs: false\ntoc-depth: 3\npage-navigation: false\nhtml-table-processing: none\n---\n\n::: {.doc-subject}\n\nReturn the version string of the vendored cmark-gfm library.\n:::\n\n::: {.doc-usage-source}\nUsage\n\n[Source](https://github.com/posit-dev/multimark/blob/feat-markdown-to-plaintext/src/multimark/_cmark.py#L849-L869){target=\"_blank\" rel=\"noopener\"}\n:::\n\n::: {.doc-signature .doc-Kind.FUNCTION}\n```python\ncmark_version()\n```\n:::\n\n::: {.doc-text}\n\nReports the version of the bundled cmark-gfm C library that multimark was compiled\nagainst. This is useful for debugging or confirming which release of the underlying\nparser is in use.\n:::\n\n## Returns {.doc-returns}\n\n::: {.doc-definition-items}\n<code> [str]{.doc-parameter-annotation}</code>\n\n: A version string in the format `\"X.Y.Z.gfm.N\"` (e.g., `\"0.29.0.gfm.13\"`).\n:::\n\n## Examples {.doc-examples}\n\n::: {#3f3b1eed .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import cmark_version\n\ncmark_version()\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n'0.29.0.gfm.13'\n```\n:::\n:::\n\n\n",
6
+ "supporting": [
7
+ "cmark_version_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "56e022dfeb99ac944c94bf1c3652b0c9",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: >-\n [markdown_to_commonmark()]{.doc-object-name .doc-function .doc-label\n .doc-label-function}\nbody-classes: doc-api-page doc-py-api-page\nshift-heading-level-by: 0\nbread-crumbs: false\ntoc-depth: 3\npage-navigation: false\nhtml-table-processing: none\n---\n\n::: {.doc-subject}\n\nParse CommonMark/GFM and render back as normalized CommonMark.\n:::\n\n::: {.doc-usage-source}\nUsage\n\n[Source](https://github.com/posit-dev/multimark/blob/feat-markdown-to-plaintext/src/multimark/_cmark.py#L598-L723){target=\"_blank\" rel=\"noopener\"}\n:::\n\n::: {.doc-signature .doc-Kind.FUNCTION}\n```python\nmarkdown_to_commonmark(\n text,\n *,\n hardbreaks=False,\n smart=False,\n normalize=False,\n unsafe=False,\n footnotes=False,\n extensions=(),\n width=0,\n options=0,\n)\n```\n:::\n\n::: {.doc-text}\n\nParses the input Markdown into an AST and re-renders it as CommonMark. This\neffectively normalizes the formatting: different but semantically equivalent\nMarkdown inputs (e.g., `*italic*` vs `_italic_`, varying list indentation) will\nproduce a canonical output form.\n\nThis is useful for round-trip testing, canonical formatting, or cleaning up\ninconsistently formatted documents. The output of this function, when parsed again,\nproduces the same AST as the original input.\n:::\n\n## Parameters {.doc-parameters}\n\n::: {.doc-definition-items}\n<code>[text]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [str]{.doc-parameter-annotation}</code>\n\n: The Markdown string to parse and normalize. Must be a Python `str`.\n\n<code>[hardbreaks]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Render soft line breaks as hard breaks (backslash-newline). By default, this is\n `False`.\n\n<code>[smart]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Convert straight quotes to curly quotes, `--` to en-dashes, `---` to em-dashes,\n and `...` to ellipses. By default, this is `False`.\n\n<code>[normalize]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Consolidate adjacent text nodes in the parsed AST. By default, this is `False`.\n\n<code>[unsafe]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Allow raw HTML to pass through. By default, this is `False`, which replaces raw\n HTML with a comment placeholder.\n\n<code>[footnotes]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Enable footnote syntax parsing. By default, this is `False`.\n\n<code>[extensions]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [Sequence[str]]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [()]{.doc-parameter-default}</code>\n\n: A sequence of GFM extension names to enable. Valid names are `\"table\"`,\n `\"strikethrough\"`, `\"autolink\"`, `\"tagfilter\"`, and `\"tasklist\"`.\n\n<code>[width]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: The column at which to wrap output lines. Set to `0` (the default) to disable\n line wrapping entirely. This is useful for producing line-wrapped output for\n version-control-friendly diffs.\n\n<code>[options]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: An integer bitmask of `Options` flags (e.g., `Options.SMART | Options.UNSAFE`).\n Merged via OR with any boolean keyword arguments set to `True`.\n Defaults to `0`.\n:::\n\n## Keyword Arguments Vs. Options Flags {.doc-keyword-arguments-vs-options-flags}\n\nThe boolean keyword arguments (`smart`, `unsafe`, `hardbreaks`, etc.) are convenience\nshortcuts for the most common `Options` flags. When both styles are provided, they\nare merged via OR. See `markdown_to_html()` for a detailed explanation.\n\n## Returns {.doc-returns}\n\n::: {.doc-definition-items}\n<code> [str]{.doc-parameter-annotation}</code>\n\n: The normalized CommonMark string.\n:::\n\n## Examples {.doc-examples}\n\nNormalize inconsistent formatting:\n\n::: {#60593a47 .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_commonmark\n\nmarkdown_to_commonmark(\"_hello_ **world**\")\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n'*hello* **world**\\n'\n```\n:::\n:::\n\n\nVerify round-trip stability (parse, render, re-parse produces the same HTML):\n\n::: {#1f868b98 .cell execution_count=2}\n``` {.python .cell-code}\nfrom multimark import markdown_to_commonmark, markdown_to_html\n\noriginal = \"**bold** and *italic*\"\nnormalized = markdown_to_commonmark(original)\nassert markdown_to_html(original) == markdown_to_html(normalized)\n```\n:::\n\n\nWrap at 80 columns for version-control-friendly output:\n\n::: {#409cc51d .cell execution_count=3}\n``` {.python .cell-code}\nlong_document = \"This is a long sentence for demonstration. \" * 10\nprint(markdown_to_commonmark(long_document, width=80))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nThis is a long sentence for demonstration. This is a long sentence for\ndemonstration. This is a long sentence for demonstration. This is a long\nsentence for demonstration. This is a long sentence for demonstration. This is a\nlong sentence for demonstration. This is a long sentence for demonstration. This\nis a long sentence for demonstration. This is a long sentence for demonstration.\nThis is a long sentence for demonstration.\n\n```\n:::\n:::\n\n\n",
6
+ "supporting": [
7
+ "markdown_to_commonmark_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "007dc2a6be03f4138e3c3c1ba02a5ce8",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: >-\n [markdown_to_html()]{.doc-object-name .doc-function .doc-label\n .doc-label-function}\nbody-classes: doc-api-page doc-py-api-page\nshift-heading-level-by: 0\nbread-crumbs: false\ntoc-depth: 3\npage-navigation: false\nhtml-table-processing: none\n---\n\n::: {.doc-subject}\n\nParse CommonMark/GFM and render as HTML.\n:::\n\n::: {.doc-usage-source}\nUsage\n\n[Source](https://github.com/posit-dev/multimark/blob/feat-markdown-to-plaintext/src/multimark/_cmark.py#L78-L232){target=\"_blank\" rel=\"noopener\"}\n:::\n\n::: {.doc-signature .doc-Kind.FUNCTION}\n```python\nmarkdown_to_html(\n text,\n *,\n hardbreaks=False,\n smart=False,\n normalize=False,\n sourcepos=False,\n unsafe=False,\n footnotes=False,\n extensions=(),\n options=0,\n)\n```\n:::\n\n::: {.doc-text}\n\nTakes a Markdown string and returns the corresponding HTML output. By default,\nraw HTML embedded in the Markdown is stripped for security (replaced with an HTML\ncomment). Set `unsafe=True` to allow raw HTML passthrough.\n\nThe parser is fully [CommonMark spec](https://spec.commonmark.org/) compliant. When\nGFM extensions are enabled via `extensions=`, additional syntax is recognized\n(tables, strikethrough, autolinks, tag filtering, and task lists).\n:::\n\n## Parameters {.doc-parameters}\n\n::: {.doc-definition-items}\n<code>[text]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [str]{.doc-parameter-annotation}</code>\n\n: The Markdown string to parse and render. Can be any length, from a single\n inline fragment to a full document. Must be a Python `str` (not bytes).\n\n<code>[hardbreaks]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Render soft line breaks (single newlines within a paragraph) as `<br />` tags.\n By default, this is `False` and soft breaks are rendered as spaces, matching the\n CommonMark specification behavior.\n\n<code>[smart]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Convert straight quotes to curly quotes, `--` to en-dashes, `---` to em-dashes,\n and `...` to ellipses. By default, this is `False`.\n\n<code>[normalize]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Consolidate adjacent text nodes in the parsed AST before rendering. This can\n produce slightly cleaner output in edge cases. By default, this is `False`.\n\n<code>[sourcepos]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Include `data-sourcepos` attributes on block-level HTML elements indicating\n their line/column positions in the original Markdown source. Useful for building\n editors or source-mapping tools. By default, this is `False`.\n\n<code>[unsafe]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Allow raw HTML and potentially dangerous links to pass through to the output\n without sanitization. When `False` (the default), raw HTML blocks and inline\n HTML are replaced with a comment `<!-- raw HTML omitted -->`, and dangerous\n URLs (e.g., `javascript:`) are suppressed.\n\n<code>[footnotes]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Enable footnote syntax parsing. When `True`, `[^label]` markers and\n `[^label]: content` definitions are recognized and rendered as numbered\n footnotes with backlinks. By default, this is `False`.\n\n<code>[extensions]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [Sequence[str]]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [()]{.doc-parameter-default}</code>\n\n: A sequence of GFM extension names to enable during parsing. Valid names are\n `\"table\"`, `\"strikethrough\"`, `\"autolink\"`, `\"tagfilter\"`, and `\"tasklist\"`.\n An empty sequence (the default) parses standard CommonMark only.\n\n<code>[options]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: An integer bitmask of `Options` flags. Build it by OR-ing flags together, e.g.,\n `Options.SMART | Options.UNSAFE`. This value is combined (via OR) with any named\n boolean parameters that are set to `True`, so you can mix both styles freely.\n Defaults to `0` (no additional flags beyond those set by keyword arguments).\n:::\n\n## Keyword Arguments Vs. Options Flags {.doc-keyword-arguments-vs-options-flags}\n\nThe boolean keyword arguments (`smart`, `unsafe`, `hardbreaks`, etc.) are convenience\nshortcuts for the most common `Options` flags. Using `smart=True` is equivalent to\npassing `options=Options.SMART`. When both are provided, they are merged:\n`markdown_to_html(text, smart=True, options=Options.UNSAFE)` is the same as\n`options=Options.SMART | Options.UNSAFE`.\n\nSome flags (like `Options.GITHUB_PRE_LANG`, `Options.STRIKETHROUGH_DOUBLE_TILDE`,\nand `Options.LIBERAL_HTML_TAG`) have no keyword shortcut and can only be set via\nthe `options` parameter.\n\n## Returns {.doc-returns}\n\n::: {.doc-definition-items}\n<code> [str]{.doc-parameter-annotation}</code>\n\n: The rendered HTML string. Block-level elements end with a trailing newline.\n:::\n\n## Examples {.doc-examples}\n\nRender basic Markdown to HTML:\n\n::: {#cad80958 .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html\n\nmarkdown_to_html(\"**bold** and *italic*\")\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n'<p><strong>bold</strong> and <em>italic</em></p>\\n'\n```\n:::\n:::\n\n\nEnable smart punctuation:\n\n::: {#35dc7203 .cell execution_count=2}\n``` {.python .cell-code}\nmarkdown_to_html('\"Hello\" -- world...', smart=True)\n```\n\n::: {.cell-output .cell-output-display execution_count=2}\n```\n'<p>“Hello” – world…</p>\\n'\n```\n:::\n:::\n\n\nAllow raw HTML passthrough:\n\n::: {#f3b14ec1 .cell execution_count=3}\n``` {.python .cell-code}\nmarkdown_to_html(\"<div>custom</div>\", unsafe=True)\n```\n\n::: {.cell-output .cell-output-display execution_count=3}\n```\n'<div>custom</div>\\n'\n```\n:::\n:::\n\n\nUse GFM table extension:\n\n::: {#4c132ac6 .cell execution_count=4}\n``` {.python .cell-code}\nmarkdown_to_html(\n \"| A | B |\\n|---|---|\\n| 1 | 2 |\\n\",\n extensions=[\"table\"],\n)\n```\n\n::: {.cell-output .cell-output-display execution_count=4}\n```\n'<table>\\n<thead>\\n<tr>\\n<th>A</th>\\n<th>B</th>\\n</tr>\\n</thead>\\n<tbody>\\n<tr>\\n<td>1</td>\\n<td>2</td>\\n</tr>\\n</tbody>\\n</table>\\n'\n```\n:::\n:::\n\n\nCombine multiple features:\n\n::: {#66608d94 .cell execution_count=5}\n``` {.python .cell-code}\nmarkdown_to_html(\n \"~~old~~ -> new\\n\\nVisit https://example.com\\n\",\n extensions=[\"strikethrough\", \"autolink\"],\n smart=True,\n)\n```\n\n::: {.cell-output .cell-output-display execution_count=5}\n```\n'<p><del>old</del> -&gt; new</p>\\n<p>Visit <a href=\"https://example.com\">https://example.com</a></p>\\n'\n```\n:::\n:::\n\n\n",
6
+ "supporting": [
7
+ "markdown_to_html_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "e8b344dcce2b471df37ac0e592012552",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: >-\n [markdown_to_latex()]{.doc-object-name .doc-function .doc-label\n .doc-label-function}\nbody-classes: doc-api-page doc-py-api-page\nshift-heading-level-by: 0\nbread-crumbs: false\ntoc-depth: 3\npage-navigation: false\nhtml-table-processing: none\n---\n\n::: {.doc-subject}\n\nParse CommonMark/GFM and render as LaTeX.\n:::\n\n::: {.doc-usage-source}\nUsage\n\n[Source](https://github.com/posit-dev/multimark/blob/feat-markdown-to-plaintext/src/multimark/_cmark.py#L348-L474){target=\"_blank\" rel=\"noopener\"}\n:::\n\n::: {.doc-signature .doc-Kind.FUNCTION}\n```python\nmarkdown_to_latex(\n text,\n *,\n hardbreaks=False,\n smart=False,\n normalize=False,\n unsafe=False,\n footnotes=False,\n extensions=(),\n width=0,\n options=0,\n)\n```\n:::\n\n::: {.doc-text}\n\nConverts Markdown to LaTeX source suitable for inclusion in a `.tex` document.\nInline formatting maps to LaTeX commands (`\\textbf{}`, `\\emph{}`, `\\texttt{}`),\nheadings become sectioning commands (`\\section{}`, `\\subsection{}`, etc.), and\nlinks use `\\href{}{}`.\n\nThe output is a fragment (not a full document): it does not include\n`\\documentclass`, `\\begin{document}`, or preamble. You can concatenate it into\nyour own LaTeX document structure.\n:::\n\n## Parameters {.doc-parameters}\n\n::: {.doc-definition-items}\n<code>[text]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [str]{.doc-parameter-annotation}</code>\n\n: The Markdown string to parse and render. Must be a Python `str`.\n\n<code>[hardbreaks]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Render soft line breaks as hard breaks (`\\\\`). By default, this is `False`.\n\n<code>[smart]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Convert straight quotes to curly quotes, `--` to en-dashes, `---` to em-dashes,\n and `...` to ellipses. By default, this is `False`.\n\n<code>[normalize]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Consolidate adjacent text nodes in the parsed AST. By default, this is `False`.\n\n<code>[unsafe]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Allow raw HTML to pass through. Since LaTeX is the target format, raw HTML is\n typically irrelevant. By default, this is `False`.\n\n<code>[footnotes]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Enable footnote syntax parsing. By default, this is `False`.\n\n<code>[extensions]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [Sequence[str]]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [()]{.doc-parameter-default}</code>\n\n: A sequence of GFM extension names to enable. Valid names are `\"table\"`,\n `\"strikethrough\"`, `\"autolink\"`, `\"tagfilter\"`, and `\"tasklist\"`.\n\n<code>[width]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: The column at which to wrap output lines. Set to `0` (the default) to disable\n line wrapping entirely. A value like `80` produces lines of at most 80\n characters where possible.\n\n<code>[options]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: An integer bitmask of `Options` flags (e.g., `Options.SMART | Options.UNSAFE`).\n Merged via OR with any boolean keyword arguments set to `True`.\n Defaults to `0`.\n:::\n\n## Keyword Arguments Vs. Options Flags {.doc-keyword-arguments-vs-options-flags}\n\nThe boolean keyword arguments (`smart`, `unsafe`, `hardbreaks`, etc.) are convenience\nshortcuts for the most common `Options` flags. When both styles are provided, they\nare merged via OR. See `markdown_to_html()` for a detailed explanation.\n\n## Returns {.doc-returns}\n\n::: {.doc-definition-items}\n<code> [str]{.doc-parameter-annotation}</code>\n\n: The rendered LaTeX string.\n:::\n\n## Examples {.doc-examples}\n\nRender inline formatting:\n\n::: {#a5c3dcde .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_latex\n\nmarkdown_to_latex(\"**bold** and *italic*\")\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n'\\\\textbf{bold} and \\\\emph{italic}\\n'\n```\n:::\n:::\n\n\nRender a heading:\n\n::: {#eb53efdd .cell execution_count=2}\n``` {.python .cell-code}\nmarkdown_to_latex(\"# Introduction\")\n```\n\n::: {.cell-output .cell-output-display execution_count=2}\n```\n'\\\\section{Introduction}\\n'\n```\n:::\n:::\n\n\nEnable line wrapping at 72 columns:\n\n::: {#48d87433 .cell execution_count=3}\n``` {.python .cell-code}\nlong_text = \"This is a very long paragraph. \" * 10\nprint(markdown_to_latex(long_text, width=72))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nThis is a very long paragraph. This is a very long paragraph. This is a\nvery long paragraph. This is a very long paragraph. This is a very long\nparagraph. This is a very long paragraph. This is a very long paragraph.\nThis is a very long paragraph. This is a very long paragraph. This is a\nvery long paragraph.\n\n```\n:::\n:::\n\n\nUse smart punctuation for typographic output:\n\n::: {#c7de3086 .cell execution_count=4}\n``` {.python .cell-code}\nmarkdown_to_latex('\"Hello,\" she said --- \"goodbye.\"', smart=True)\n```\n\n::: {.cell-output .cell-output-display execution_count=4}\n```\n\"``Hello,'' she said --- ``goodbye.''\\n\"\n```\n:::\n:::\n\n\n",
6
+ "supporting": [
7
+ "markdown_to_latex_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "0a56c36654447c031cec99a0cdf8248c",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: >-\n [markdown_to_man()]{.doc-object-name .doc-function .doc-label\n .doc-label-function}\nbody-classes: doc-api-page doc-py-api-page\nshift-heading-level-by: 0\nbread-crumbs: false\ntoc-depth: 3\npage-navigation: false\nhtml-table-processing: none\n---\n\n::: {.doc-subject}\n\nParse CommonMark/GFM and render as a groff man page.\n:::\n\n::: {.doc-usage-source}\nUsage\n\n[Source](https://github.com/posit-dev/multimark/blob/feat-markdown-to-plaintext/src/multimark/_cmark.py#L477-L595){target=\"_blank\" rel=\"noopener\"}\n:::\n\n::: {.doc-signature .doc-Kind.FUNCTION}\n```python\nmarkdown_to_man(\n text,\n *,\n hardbreaks=False,\n smart=False,\n normalize=False,\n unsafe=False,\n footnotes=False,\n extensions=(),\n width=0,\n options=0,\n)\n```\n:::\n\n::: {.doc-text}\n\nProduces groff-format output suitable for use with the `man` command or inclusion\nin manual page source files. Inline formatting maps to font switching requests\n(`\\f[B]`, `\\f[I]`, `\\f[CR]`), paragraphs use `.PP`, and headings use `.SH` or\n`.SS` macros.\n\nThe output is a fragment and does not include a `.TH` title header. Wrap it in your\nown man page structure to produce a complete manual page.\n:::\n\n## Parameters {.doc-parameters}\n\n::: {.doc-definition-items}\n<code>[text]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [str]{.doc-parameter-annotation}</code>\n\n: The Markdown string to parse and render. Must be a Python `str`.\n\n<code>[hardbreaks]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Render soft line breaks as hard breaks (`.br`). By default, this is `False`.\n\n<code>[smart]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Convert straight quotes to curly quotes, `--` to en-dashes, `---` to em-dashes,\n and `...` to ellipses. By default, this is `False`.\n\n<code>[normalize]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Consolidate adjacent text nodes in the parsed AST. By default, this is `False`.\n\n<code>[unsafe]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Allow raw HTML to pass through. Since groff is the target format, raw HTML is\n typically irrelevant. By default, this is `False`.\n\n<code>[footnotes]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Enable footnote syntax parsing. By default, this is `False`.\n\n<code>[extensions]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [Sequence[str]]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [()]{.doc-parameter-default}</code>\n\n: A sequence of GFM extension names to enable. Valid names are `\"table\"`,\n `\"strikethrough\"`, `\"autolink\"`, `\"tagfilter\"`, and `\"tasklist\"`.\n\n<code>[width]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: The column at which to wrap output lines. Set to `0` (the default) to disable\n line wrapping entirely.\n\n<code>[options]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: An integer bitmask of `Options` flags (e.g., `Options.SMART | Options.UNSAFE`).\n Merged via OR with any boolean keyword arguments set to `True`.\n Defaults to `0`.\n:::\n\n## Keyword Arguments Vs. Options Flags {.doc-keyword-arguments-vs-options-flags}\n\nThe boolean keyword arguments (`smart`, `unsafe`, `hardbreaks`, etc.) are convenience\nshortcuts for the most common `Options` flags. When both styles are provided, they\nare merged via OR. See `markdown_to_html()` for a detailed explanation.\n\n## Returns {.doc-returns}\n\n::: {.doc-definition-items}\n<code> [str]{.doc-parameter-annotation}</code>\n\n: The rendered groff man page string.\n:::\n\n## Examples {.doc-examples}\n\nRender a paragraph with bold and italic:\n\n::: {#666d349f .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_man\n\nmarkdown_to_man(\"**bold** and *italic*\")\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n'.PP\\n\\\\f[B]bold\\\\f[] and \\\\f[I]italic\\\\f[]\\n'\n```\n:::\n:::\n\n\nRender a heading:\n\n::: {#5f3639dd .cell execution_count=2}\n``` {.python .cell-code}\nmarkdown_to_man(\"## Options\")\n```\n\n::: {.cell-output .cell-output-display execution_count=2}\n```\n'.SS\\nOptions\\n'\n```\n:::\n:::\n\n\nWrap at 72 columns:\n\n::: {#4d08b991 .cell execution_count=3}\n``` {.python .cell-code}\nlong_paragraph = \"This is a long paragraph of text. \" * 10\nprint(markdown_to_man(long_paragraph, width=72))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n.PP\nThis is a long paragraph of text. This is a long paragraph of text. This\nis a long paragraph of text. This is a long paragraph of text. This is a\nlong paragraph of text. This is a long paragraph of text. This is a long\nparagraph of text. This is a long paragraph of text. This is a long\nparagraph of text. This is a long paragraph of text.\n\n```\n:::\n:::\n\n\n",
6
+ "supporting": [
7
+ "markdown_to_man_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "104fa981db28fe772692524fb27260fe",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: >-\n [markdown_to_plaintext()]{.doc-object-name .doc-function .doc-label\n .doc-label-function}\nbody-classes: doc-api-page doc-py-api-page\nshift-heading-level-by: 0\nbread-crumbs: false\ntoc-depth: 3\npage-navigation: false\nhtml-table-processing: none\n---\n\n::: {.doc-subject}\n\nParse CommonMark/GFM and render as plain text.\n:::\n\n::: {.doc-usage-source}\nUsage\n\n[Source](https://github.com/posit-dev/multimark/blob/feat-markdown-to-plaintext/src/multimark/_cmark.py#L726-L846){target=\"_blank\" rel=\"noopener\"}\n:::\n\n::: {.doc-signature .doc-Kind.FUNCTION}\n```python\nmarkdown_to_plaintext(\n text,\n *,\n hardbreaks=False,\n smart=False,\n normalize=False,\n unsafe=False,\n footnotes=False,\n extensions=(),\n width=0,\n options=0,\n)\n```\n:::\n\n::: {.doc-text}\n\nRemoves heading, emphasis, link, and code delimiters while preserving their\ntext. Link destinations and image URLs are omitted; image descriptions are\nretained. Lists keep their markers and indentation, and paragraphs remain\nseparated by blank lines.\n\nGFM tables retain pipe-table syntax, task lists retain checkbox markers, and\nstrikethrough text is surrounded by single tildes. Enabled footnotes retain\nnumbered references and definitions. Raw HTML blocks, including their text,\nare omitted; inline HTML tags are omitted without removing surrounding text.\n:::\n\n## Parameters {.doc-parameters}\n\n::: {.doc-definition-items}\n<code>[text]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [str]{.doc-parameter-annotation}</code>\n\n: The Markdown string to parse and render. Must be a Python `str`.\n\n<code>[hardbreaks]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Render soft line breaks as hard breaks (newlines). By default, this is\n `False`. When enabled, width-based wrapping is disabled.\n\n<code>[smart]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Convert straight quotes to curly quotes, `--` to en-dashes, `---` to em-dashes,\n and `...` to ellipses. By default, this is `False`.\n\n<code>[normalize]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Consolidate adjacent text nodes in the parsed AST. By default, this is `False`.\n\n<code>[unsafe]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Raw HTML is always omitted, regardless of this flag. By default, this is\n `False`.\n\n<code>[footnotes]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Enable footnote syntax parsing. By default, this is `False`.\n\n<code>[extensions]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [Sequence[str]]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [()]{.doc-parameter-default}</code>\n\n: A sequence of GFM extension names to enable. Valid names are `\"table\"`,\n `\"strikethrough\"`, `\"autolink\"`, `\"tagfilter\"`, and `\"tasklist\"`.\n\n<code>[width]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: The column at which to wrap output lines. Set to `0` (the default) to disable\n line wrapping entirely and preserve soft line breaks. With a positive width,\n soft line breaks become spaces before wrapping. Code blocks are not wrapped.\n Ignored when `hardbreaks=True`.\n\n<code>[options]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: An integer bitmask of `Options` flags (e.g., `Options.SMART | Options.UNSAFE`).\n Merged via OR with any boolean keyword arguments set to `True`.\n Defaults to `0`. `Options.NOBREAKS` converts soft line breaks to spaces and\n disables automatic wrapping.\n:::\n\n## Keyword Arguments Vs. Options Flags {.doc-keyword-arguments-vs-options-flags}\n\nThe boolean keyword arguments (`smart`, `unsafe`, `hardbreaks`, etc.) are convenience\nshortcuts for the most common `Options` flags. When both styles are provided, they\nare merged via OR. See `markdown_to_html()` for a detailed explanation.\n\n## Returns {.doc-returns}\n\n::: {.doc-definition-items}\n<code> [str]{.doc-parameter-annotation}</code>\n\n: The rendered text, including a trailing newline. Empty input returns\n `\"\\n\"`. Output whitespace is not stripped.\n:::\n\n## Examples {.doc-examples}\n\nRemove inline formatting:\n\n::: {#ed635f6f .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_plaintext\n\nmarkdown_to_plaintext(\"**Hello**, *world*!\")\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n'Hello, world!\\n'\n```\n:::\n:::\n\n\nWrap readable text at 72 columns:\n\n::: {#f6ab8477 .cell execution_count=2}\n``` {.python .cell-code}\nmarkdown_to_plaintext(\"A paragraph with **bold** text. \" * 5, width=72)\n```\n\n::: {.cell-output .cell-output-display execution_count=2}\n```\n'A paragraph with bold text. A paragraph with bold text. A paragraph with\\nbold text. A paragraph with bold text. A paragraph with bold text.\\n'\n```\n:::\n:::\n\n\n",
6
+ "supporting": [
7
+ "markdown_to_plaintext_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "2bc37e402a04a5a11a20e6922f3afb5f",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: >-\n [markdown_to_xml()]{.doc-object-name .doc-function .doc-label\n .doc-label-function}\nbody-classes: doc-api-page doc-py-api-page\nshift-heading-level-by: 0\nbread-crumbs: false\ntoc-depth: 3\npage-navigation: false\nhtml-table-processing: none\n---\n\n::: {.doc-subject}\n\nParse CommonMark/GFM and render as XML.\n:::\n\n::: {.doc-usage-source}\nUsage\n\n[Source](https://github.com/posit-dev/multimark/blob/feat-markdown-to-plaintext/src/multimark/_cmark.py#L235-L345){target=\"_blank\" rel=\"noopener\"}\n:::\n\n::: {.doc-signature .doc-Kind.FUNCTION}\n```python\nmarkdown_to_xml(\n text,\n *,\n hardbreaks=False,\n smart=False,\n normalize=False,\n sourcepos=False,\n unsafe=False,\n footnotes=False,\n extensions=(),\n options=0,\n)\n```\n:::\n\n::: {.doc-text}\n\nProduces an XML representation of the parsed abstract syntax tree (AST). Each\nMarkdown construct is represented as a named element (e.g., `<paragraph>`,\n`<strong>`, `<code_block>`), with text content preserved in `<text>` elements.\n\nThe XML output conforms to the CommonMark DTD and includes an XML declaration and\nDOCTYPE. This format is useful for debugging, AST inspection, or piping into\nXML-based toolchains.\n:::\n\n## Parameters {.doc-parameters}\n\n::: {.doc-definition-items}\n<code>[text]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [str]{.doc-parameter-annotation}</code>\n\n: The Markdown string to parse and render. Must be a Python `str`.\n\n<code>[hardbreaks]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Render soft line breaks as hard breaks in the AST. By default, this is `False`.\n\n<code>[smart]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Convert straight quotes to curly quotes, `--` to en-dashes, `---` to em-dashes,\n and `...` to ellipses. By default, this is `False`.\n\n<code>[normalize]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Consolidate adjacent text nodes in the parsed AST. By default, this is `False`.\n\n<code>[sourcepos]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Include `sourcepos` attributes on elements indicating their line/column\n positions in the original Markdown source. By default, this is `False`.\n\n<code>[unsafe]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Allow raw HTML to pass through. By default, this is `False`.\n\n<code>[footnotes]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [bool]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[False]{.va}]{.doc-parameter-default}</code>\n\n: Enable footnote syntax parsing. By default, this is `False`.\n\n<code>[extensions]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [Sequence[str]]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [()]{.doc-parameter-default}</code>\n\n: A sequence of GFM extension names to enable. Valid names are `\"table\"`,\n `\"strikethrough\"`, `\"autolink\"`, `\"tagfilter\"`, and `\"tasklist\"`.\n\n<code>[options]{.doc-parameter-name}[:]{.doc-parameter-annotation-sep} [int]{.doc-parameter-annotation} [=]{.doc-parameter-default-sep .op} [[0]{.dv}]{.doc-parameter-default}</code>\n\n: An integer bitmask of `Options` flags (e.g., `Options.SMART | Options.UNSAFE`).\n Merged via OR with any boolean keyword arguments set to `True`.\n Defaults to `0`.\n:::\n\n## Keyword Arguments Vs. Options Flags {.doc-keyword-arguments-vs-options-flags}\n\nThe boolean keyword arguments (`smart`, `unsafe`, `hardbreaks`, etc.) are convenience\nshortcuts for the most common `Options` flags. When both styles are provided, they\nare merged via OR. See `markdown_to_html()` for a detailed explanation.\n\n## Returns {.doc-returns}\n\n::: {.doc-definition-items}\n<code> [str]{.doc-parameter-annotation}</code>\n\n: The rendered XML string, including the XML declaration and DOCTYPE.\n:::\n\n## Examples {.doc-examples}\n\nInspect the AST structure of a simple document:\n\n::: {#1d3eed25 .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_xml\n\nprint(markdown_to_xml(\"**hello**\"))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n<document xmlns=\"http://commonmark.org/xml/1.0\">\n <paragraph>\n <strong>\n <text xml:space=\"preserve\">hello</text>\n </strong>\n </paragraph>\n</document>\n\n```\n:::\n:::\n\n\nAdd source position information:\n\n::: {#099b1854 .cell execution_count=2}\n``` {.python .cell-code}\nmarkdown_to_xml(\"# Title\\n\\nBody text\\n\", sourcepos=True)\n```\n\n::: {.cell-output .cell-output-display execution_count=2}\n```\n'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\\n<document sourcepos=\"1:1-3:9\" xmlns=\"http://commonmark.org/xml/1.0\">\\n <heading sourcepos=\"1:1-1:7\" level=\"1\">\\n <text sourcepos=\"1:3-1:7\" xml:space=\"preserve\">Title</text>\\n </heading>\\n <paragraph sourcepos=\"3:1-3:9\">\\n <text sourcepos=\"3:1-3:9\" xml:space=\"preserve\">Body text</text>\\n </paragraph>\\n</document>\\n'\n```\n:::\n:::\n\n\n",
6
+ "supporting": [
7
+ "markdown_to_xml_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -1,10 +1,10 @@
1
1
  {
2
- "hash": "2d574431c666687beb663a4f712e95f4",
2
+ "hash": "a91735f6f20fcae7f9d3fd5503494936",
3
3
  "result": {
4
4
  "engine": "jupyter",
5
- "markdown": "---\ntitle: \"GFM Extensions\"\nguide-section: \"Core Concepts\"\ntags: [Extensions, HTML, Tables]\nbread-crumbs: false\n---\n\nThis page explains the five GitHub Flavored Markdown extensions that multimark supports, with examples showing how each one works and how to combine them.\n\n## What Are GFM Extensions?\n\nGitHub Flavored Markdown (GFM) extends the CommonMark specification with five additional\nsyntax features. These are the constructs that GitHub recognizes in README files, issues,\nand pull requests but that are not part of the base CommonMark spec.\n\nMultimark supports all five GFM extensions through the `extensions` parameter, which\naccepts a sequence of extension names. Extensions are disabled by default so that the\nparser remains strictly CommonMark-compliant unless you opt in.\n\n::: {#5b0943cd .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import VALID_EXTENSIONS\n\nsorted(VALID_EXTENSIONS)\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n['autolink', 'strikethrough', 'table', 'tagfilter', 'tasklist']\n```\n:::\n:::\n\n\nEach extension is independent: you enable only the ones you need.\n\n## Tables\n\nThe `table` extension adds pipe-table syntax. Columns are separated by `|` characters,\nand a header row is separated from body rows by a line of dashes.\n\n::: {#7ec62208 .cell execution_count=2}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html\n\ntable_md = \"\"\"\\\n| Feature | Status |\n|------------|--------|\n| Tables | ✓ |\n| Autolinks | ✓ |\n| Tasklists | ✓ |\n\"\"\"\n\nprint(markdown_to_html(table_md, extensions=[\"table\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<table>\n<thead>\n<tr>\n<th>Feature</th>\n<th>Status</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Tables</td>\n<td>✓</td>\n</tr>\n<tr>\n<td>Autolinks</td>\n<td>✓</td>\n</tr>\n<tr>\n<td>Tasklists</td>\n<td>✓</td>\n</tr>\n</tbody>\n</table>\n\n```\n:::\n:::\n\n\nColumn alignment is controlled with colons in the separator row: `:---` for left,\n`:---:` for center, and `---:` for right. The renderer emits `style=\"text-align: ...\"`\nattributes on the `<th>` and `<td>` elements.\n\n::: {#6d655856 .cell execution_count=3}\n``` {.python .cell-code}\naligned = \"\"\"\\\n| Left | Center | Right |\n|:-----|:------:|------:|\n| a | b | c |\n\"\"\"\n\nprint(markdown_to_html(aligned, extensions=[\"table\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<table>\n<thead>\n<tr>\n<th align=\"left\">Left</th>\n<th align=\"center\">Center</th>\n<th align=\"right\">Right</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align=\"left\">a</td>\n<td align=\"center\">b</td>\n<td align=\"right\">c</td>\n</tr>\n</tbody>\n</table>\n\n```\n:::\n:::\n\n\n## Strikethrough\n\nThe `strikethrough` extension recognizes `~~text~~` as deleted content, rendering it\nwith `<del>` tags.\n\n::: {#f9d9bc11 .cell execution_count=4}\n``` {.python .cell-code}\nprint(markdown_to_html(\"This is ~~no longer~~ relevant.\", extensions=[\"strikethrough\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p>This is <del>no longer</del> relevant.</p>\n\n```\n:::\n:::\n\n\nStrikethrough works inline alongside other formatting. You can combine it with bold,\nitalic, and code spans without issue.\n\n::: {#b3b968e6 .cell execution_count=5}\n``` {.python .cell-code}\ncombined = \"~~**bold and struck**~~ and ~~`code struck`~~\"\nprint(markdown_to_html(combined, extensions=[\"strikethrough\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p><del><strong>bold and struck</strong></del> and <del><code>code struck</code></del></p>\n\n```\n:::\n:::\n\n\n## Autolinks\n\nThe `autolink` extension automatically converts bare URLs and email addresses into\nclickable links without requiring explicit Markdown link syntax.\n\n::: {#0013b6ce .cell execution_count=6}\n``` {.python .cell-code}\ntext = \"\"\"\\\nVisit https://github.com for more info.\n\nSend feedback to user@example.com.\n\"\"\"\n\nprint(markdown_to_html(text, extensions=[\"autolink\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p>Visit <a href=\"https://github.com\">https://github.com</a> for more info.</p>\n<p>Send feedback to <a href=\"mailto:user@example.com\">user@example.com</a>.</p>\n\n```\n:::\n:::\n\n\nThis is the same behavior you see on GitHub: any URL starting with `http://` or\n`https://` becomes a link, and email addresses get `mailto:` links.\n\n## Tag Filtering\n\nThe `tagfilter` extension suppresses a specific set of HTML tags that could be used for\nXSS attacks, even when `unsafe=True` is set. The filtered tags are: `<textarea>`,\n`<style>`, `<xmp>`, `<iframe>`, `<noembed>`, `<noframes>`, `<script>`, and `<plaintext>`.\n\n::: {#6cdd974c .cell execution_count=7}\n``` {.python .cell-code}\nhtml_input = \"Before <script>alert('xss')</script> after\"\nprint(markdown_to_html(html_input, unsafe=True, extensions=[\"tagfilter\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p>Before &lt;script>alert('xss')&lt;/script> after</p>\n\n```\n:::\n:::\n\n\nThe tags are not removed entirely. Instead, the opening `<` is replaced with `&lt;`,\nrendering them inert while preserving the text content for visibility. This matches\nGitHub's behavior for user-generated content.\n\n## Task Lists\n\nThe `tasklist` extension renders list items that begin with `[ ]` or `[x]` as checkbox\nitems with a special CSS class.\n\n::: {#03f4eb42 .cell execution_count=8}\n``` {.python .cell-code}\ntasks = \"\"\"\\\n- [x] Write documentation\n- [x] Add tests\n- [ ] Publish release\n\"\"\"\n\nprint(markdown_to_html(tasks, extensions=[\"tasklist\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<ul>\n<li><input type=\"checkbox\" checked=\"\" disabled=\"\" /> Write documentation</li>\n<li><input type=\"checkbox\" checked=\"\" disabled=\"\" /> Add tests</li>\n<li><input type=\"checkbox\" disabled=\"\" /> Publish release</li>\n</ul>\n\n```\n:::\n:::\n\n\nThe checkboxes are rendered as `<input>` elements with `type=\"checkbox\"` and a\n`disabled` attribute (since they are static content, not interactive form elements).\n\n## Combining Extensions\n\nExtensions compose freely. Enable as many as you need by passing multiple names in the\n`extensions` list.\n\n::: {#39306003 .cell execution_count=9}\n``` {.python .cell-code}\ndoc = \"\"\"\\\n## Release Notes\n\n| Change | Status |\n|---------------|--------------|\n| ~~Old API~~ | Removed |\n| New API | Added |\n\nTasks remaining:\n\n- [x] Update docs at https://example.com/docs\n- [ ] Tag release\n\nContact: releases@example.com\n\"\"\"\n\nprint(markdown_to_html(doc, extensions=[\"table\", \"strikethrough\", \"tasklist\", \"autolink\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<h2>Release Notes</h2>\n<table>\n<thead>\n<tr>\n<th>Change</th>\n<th>Status</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><del>Old API</del></td>\n<td>Removed</td>\n</tr>\n<tr>\n<td>New API</td>\n<td>Added</td>\n</tr>\n</tbody>\n</table>\n<p>Tasks remaining:</p>\n<ul>\n<li><input type=\"checkbox\" checked=\"\" disabled=\"\" /> Update docs at <a href=\"https://example.com/docs\">https://example.com/docs</a></li>\n<li><input type=\"checkbox\" disabled=\"\" /> Tag release</li>\n</ul>\n<p>Contact: <a href=\"mailto:releases@example.com\">releases@example.com</a></p>\n\n```\n:::\n:::\n\n\nThe order of extension names in the list does not matter. The parser enables all\nrequested extensions before processing the input.\n\n## Extensions with Other Renderers\n\nGFM extensions work with all five output formats, not just HTML. Here is the same table\nrendered as LaTeX.\n\n::: {#3310b0f8 .cell execution_count=10}\n``` {.python .cell-code}\nfrom multimark import markdown_to_latex\n\nprint(markdown_to_latex(table_md, extensions=[\"table\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n\\begin{table}\n\\begin{tabular}{ll}\nFeature & Status \\\\\nTables & ✓ \\\\\nAutolinks & ✓ \\\\\nTasklists & ✓ \\\\\n\\end{tabular}\n\\end{table}\n\n```\n:::\n:::\n\n\nThe LaTeX renderer maps table structure to `tabular` environments. Each renderer\ntranslates extension syntax into its native equivalent where possible.\n\n",
5
+ "markdown": "---\ntitle: \"GFM Extensions\"\nguide-section: \"Core Concepts\"\ntags: [Extensions, HTML, Tables]\nbread-crumbs: false\n---\n\nThis page explains the five GitHub Flavored Markdown extensions that multimark supports, with examples showing how each one works and how to combine them.\n\n## What Are GFM Extensions?\n\nGitHub Flavored Markdown (GFM) extends the CommonMark specification with five additional\nsyntax features. These are the constructs that GitHub recognizes in README files, issues,\nand pull requests but that are not part of the base CommonMark spec.\n\nMultimark supports all five GFM extensions through the `extensions` parameter, which\naccepts a sequence of extension names. Extensions are disabled by default so that the\nparser remains strictly CommonMark-compliant unless you opt in.\n\n::: {#21a98102 .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import VALID_EXTENSIONS\n\nsorted(VALID_EXTENSIONS)\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n['autolink', 'strikethrough', 'table', 'tagfilter', 'tasklist']\n```\n:::\n:::\n\n\nEach extension is independent: you enable only the ones you need.\n\n## Tables\n\nThe `table` extension adds pipe-table syntax. Columns are separated by `|` characters,\nand a header row is separated from body rows by a line of dashes.\n\n::: {#49d46701 .cell execution_count=2}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html\n\ntable_md = \"\"\"\\\n| Feature | Status |\n|------------|--------|\n| Tables | ✓ |\n| Autolinks | ✓ |\n| Tasklists | ✓ |\n\"\"\"\n\nprint(markdown_to_html(table_md, extensions=[\"table\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<table>\n<thead>\n<tr>\n<th>Feature</th>\n<th>Status</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Tables</td>\n<td>✓</td>\n</tr>\n<tr>\n<td>Autolinks</td>\n<td>✓</td>\n</tr>\n<tr>\n<td>Tasklists</td>\n<td>✓</td>\n</tr>\n</tbody>\n</table>\n\n```\n:::\n:::\n\n\nColumn alignment is controlled with colons in the separator row: `:---` for left,\n`:---:` for center, and `---:` for right. The renderer emits `style=\"text-align: ...\"`\nattributes on the `<th>` and `<td>` elements.\n\n::: {#4268679a .cell execution_count=3}\n``` {.python .cell-code}\naligned = \"\"\"\\\n| Left | Center | Right |\n|:-----|:------:|------:|\n| a | b | c |\n\"\"\"\n\nprint(markdown_to_html(aligned, extensions=[\"table\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<table>\n<thead>\n<tr>\n<th align=\"left\">Left</th>\n<th align=\"center\">Center</th>\n<th align=\"right\">Right</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align=\"left\">a</td>\n<td align=\"center\">b</td>\n<td align=\"right\">c</td>\n</tr>\n</tbody>\n</table>\n\n```\n:::\n:::\n\n\n## Strikethrough\n\nThe `strikethrough` extension recognizes `~~text~~` as deleted content, rendering it\nwith `<del>` tags.\n\n::: {#27978579 .cell execution_count=4}\n``` {.python .cell-code}\nprint(markdown_to_html(\"This is ~~no longer~~ relevant.\", extensions=[\"strikethrough\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p>This is <del>no longer</del> relevant.</p>\n\n```\n:::\n:::\n\n\nStrikethrough works inline alongside other formatting. You can combine it with bold,\nitalic, and code spans without issue.\n\n::: {#b4cd2912 .cell execution_count=5}\n``` {.python .cell-code}\ncombined = \"~~**bold and struck**~~ and ~~`code struck`~~\"\nprint(markdown_to_html(combined, extensions=[\"strikethrough\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p><del><strong>bold and struck</strong></del> and <del><code>code struck</code></del></p>\n\n```\n:::\n:::\n\n\n## Autolinks\n\nThe `autolink` extension automatically converts bare URLs and email addresses into\nclickable links without requiring explicit Markdown link syntax.\n\n::: {#fa893dc9 .cell execution_count=6}\n``` {.python .cell-code}\ntext = \"\"\"\\\nVisit https://github.com for more info.\n\nSend feedback to user@example.com.\n\"\"\"\n\nprint(markdown_to_html(text, extensions=[\"autolink\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p>Visit <a href=\"https://github.com\">https://github.com</a> for more info.</p>\n<p>Send feedback to <a href=\"mailto:user@example.com\">user@example.com</a>.</p>\n\n```\n:::\n:::\n\n\nThis is the same behavior you see on GitHub: any URL starting with `http://` or\n`https://` becomes a link, and email addresses get `mailto:` links.\n\n## Tag Filtering\n\nThe `tagfilter` extension suppresses a specific set of HTML tags that could be used for\nXSS attacks, even when `unsafe=True` is set. The filtered tags are: `<textarea>`,\n`<style>`, `<xmp>`, `<iframe>`, `<noembed>`, `<noframes>`, `<script>`, and `<plaintext>`.\n\n::: {#508564cb .cell execution_count=7}\n``` {.python .cell-code}\nhtml_input = \"Before <script>alert('xss')</script> after\"\nprint(markdown_to_html(html_input, unsafe=True, extensions=[\"tagfilter\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p>Before &lt;script>alert('xss')&lt;/script> after</p>\n\n```\n:::\n:::\n\n\nThe tags are not removed entirely. Instead, the opening `<` is replaced with `&lt;`,\nrendering them inert while preserving the text content for visibility. This matches\nGitHub's behavior for user-generated content.\n\n## Task Lists\n\nThe `tasklist` extension renders list items that begin with `[ ]` or `[x]` as checkbox\nitems with a special CSS class.\n\n::: {#7deb568f .cell execution_count=8}\n``` {.python .cell-code}\ntasks = \"\"\"\\\n- [x] Write documentation\n- [x] Add tests\n- [ ] Publish release\n\"\"\"\n\nprint(markdown_to_html(tasks, extensions=[\"tasklist\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<ul>\n<li><input type=\"checkbox\" checked=\"\" disabled=\"\" /> Write documentation</li>\n<li><input type=\"checkbox\" checked=\"\" disabled=\"\" /> Add tests</li>\n<li><input type=\"checkbox\" disabled=\"\" /> Publish release</li>\n</ul>\n\n```\n:::\n:::\n\n\nThe checkboxes are rendered as `<input>` elements with `type=\"checkbox\"` and a\n`disabled` attribute (since they are static content, not interactive form elements).\n\n## Combining Extensions\n\nExtensions compose freely. Enable as many as you need by passing multiple names in the\n`extensions` list.\n\n::: {#61020ce1 .cell execution_count=9}\n``` {.python .cell-code}\ndoc = \"\"\"\\\n## Release Notes\n\n| Change | Status |\n|---------------|--------------|\n| ~~Old API~~ | Removed |\n| New API | Added |\n\nTasks remaining:\n\n- [x] Update docs at https://example.com/docs\n- [ ] Tag release\n\nContact: releases@example.com\n\"\"\"\n\nprint(markdown_to_html(doc, extensions=[\"table\", \"strikethrough\", \"tasklist\", \"autolink\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<h2>Release Notes</h2>\n<table>\n<thead>\n<tr>\n<th>Change</th>\n<th>Status</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><del>Old API</del></td>\n<td>Removed</td>\n</tr>\n<tr>\n<td>New API</td>\n<td>Added</td>\n</tr>\n</tbody>\n</table>\n<p>Tasks remaining:</p>\n<ul>\n<li><input type=\"checkbox\" checked=\"\" disabled=\"\" /> Update docs at <a href=\"https://example.com/docs\">https://example.com/docs</a></li>\n<li><input type=\"checkbox\" disabled=\"\" /> Tag release</li>\n</ul>\n<p>Contact: <a href=\"mailto:releases@example.com\">releases@example.com</a></p>\n\n```\n:::\n:::\n\n\nThe order of extension names in the list does not matter. The parser enables all\nrequested extensions before processing the input.\n\n## Extensions with Other Renderers\n\nGFM extensions work with all six output formats, not just HTML. Here is the same table\nrendered as LaTeX.\n\n::: {#074b0bc9 .cell execution_count=10}\n``` {.python .cell-code}\nfrom multimark import markdown_to_latex\n\nprint(markdown_to_latex(table_md, extensions=[\"table\"]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n\\begin{table}\n\\begin{tabular}{ll}\nFeature & Status \\\\\nTables & ✓ \\\\\nAutolinks & ✓ \\\\\nTasklists & ✓ \\\\\n\\end{tabular}\n\\end{table}\n\n```\n:::\n:::\n\n\nThe LaTeX renderer maps table structure to `tabular` environments. Each renderer\ntranslates extension syntax into its native equivalent where possible.\n\n",
6
6
  "supporting": [
7
- "gfm-extensions_files"
7
+ "gfm-extensions_files/figure-html"
8
8
  ],
9
9
  "filters": [],
10
10
  "includes": {}
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "023a16b9f7f807bb6afe4fed32c96202",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: \"Introduction\"\nguide-section: \"Getting Started\"\ntags: [Overview]\nbread-crumbs: false\n---\n\nThis page gives you a high-level understanding of what multimark does, why it exists, and what you can accomplish with it.\n\n## What Is Multimark?\n\nMultimark is a Python package that provides bindings to\n[cmark-gfm](https://github.com/github/cmark-gfm), GitHub's fork of the CommonMark\nreference parser. It gives you fast, spec-compliant Markdown parsing and rendering in\nsix output formats: HTML, LaTeX, groff man pages, XML, normalized CommonMark, and plain text.\n\nThe C library is vendored and compiled at install time via CFFI, so there are no system\ndependencies to manage. You get a single `pip install` and immediate access to the same\nMarkdown engine that powers GitHub.\n\n## Why Use Multimark?\n\nMost Python Markdown libraries are written in pure Python, which means they trade\nperformance for portability. Multimark takes a different approach: it wraps a\nbattle-tested C library that processes millions of documents daily on GitHub. This gives\nyou parsing speeds that are orders of magnitude faster than pure-Python alternatives,\nwith guaranteed spec compliance.\n\nBeyond speed, multimark supports the full set of GitHub Flavored Markdown (GFM)\nextensions: tables, strikethrough, autolinks, tag filtering, and task lists. These are\nthe same extensions that GitHub uses when rendering README files, issues, and pull\nrequests.\n\n## Output Formats at a Glance\n\nMultimark renders parsed Markdown into six distinct formats, each suited to different\nuse cases.\n\n::: {.details .open summary=\"Available formats\" icon=\"file-output\"}\n\n| Format | Function | Use Case |\n|--------|----------|----------|\n| HTML | `markdown_to_html()` | Web pages, documentation sites, email |\n| LaTeX | `markdown_to_latex()` | Academic papers, PDF generation |\n| Man page | `markdown_to_man()` | Unix manual pages |\n| XML | `markdown_to_xml()` | AST inspection, toolchain integration |\n| CommonMark | `markdown_to_commonmark()` | Normalization, round-trip formatting |\n| Plain text | `markdown_to_plaintext()` | Readable text without most Markdown formatting |\n\n:::\n\nAll renderers share the same parser and accept the same set of options, so switching\nbetween output formats requires changing only the function name.\n\n## A Quick Taste\n\nHere is the simplest possible use of multimark: converting a Markdown string to HTML.\n\n::: {#38e347d4 .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html\n\nmarkdown_to_html(\"Hello, **world**!\")\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n'<p>Hello, <strong>world</strong>!</p>\\n'\n```\n:::\n:::\n\n\nThe function returns the rendered output as a Python string. Every renderer works this\nway: pass in Markdown text, get back the rendered result.\n\n## Next Steps\n\nThe pages that follow will walk you through installation, a more thorough quickstart,\nand then progressively deeper topics. If you prefer to jump straight to the API\nreference, each function is fully documented with executable examples in the\n[Reference](../reference/index.qmd) section.\n\n",
6
+ "supporting": [
7
+ "introduction_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "83126c3409ab863b7bf518b82260050d",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: \"Options and Flags\"\nguide-section: \"Core Concepts\"\ntags: [Configuration, Options]\nbread-crumbs: false\n---\n\nThis page explains how to control parsing and rendering behavior through keyword arguments, the `Options` bitmask, or a combination of both.\n\n## Two Ways to Configure\n\nEvery renderer accepts configuration through two complementary mechanisms: boolean\nkeyword arguments and an `Options` bitmask. You can use either one or both together.\nThey are merged with a bitwise OR, so there is no conflict between them.\n\nThe keyword arguments cover the most commonly used flags:\n\n::: {#7dd3180c .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html\n\n# Using keyword arguments\nmarkdown_to_html(\"'Hello' -- world...\", smart=True)\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n'<p>‘Hello’ – world…</p>\\n'\n```\n:::\n:::\n\n\nThe `Options` enum covers every flag, including GFM-specific ones that have no keyword\nshortcut:\n\n::: {#b7c0e2d9 .cell execution_count=2}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html, Options\n\n# Using the Options bitmask\nmarkdown_to_html(\"'Hello' -- world...\", options=Options.SMART)\n```\n\n::: {.cell-output .cell-output-display execution_count=2}\n```\n'<p>‘Hello’ – world…</p>\\n'\n```\n:::\n:::\n\n\nBoth calls produce the same result. The keyword style is more readable for one or two\nflags; the bitmask style is more concise when combining many flags into a reusable\nconfiguration.\n\n## Available Keyword Arguments\n\nEvery renderer accepts these boolean keywords (all default to `False`):\n\n| Keyword | Effect |\n|---------|--------|\n| `hardbreaks` | Render soft line breaks as `<br />` (HTML) or equivalent |\n| `smart` | Convert ASCII quotes and dashes to typographic characters |\n| `normalize` | Consolidate adjacent text nodes in the AST |\n| `unsafe` | Allow raw HTML and dangerous URLs to pass through |\n| `footnotes` | Enable footnote syntax (`[^label]`) |\n\nAdditionally, `markdown_to_html` and `markdown_to_xml` accept `sourcepos` (include\nsource position data in the output), while `markdown_to_latex`, `markdown_to_man`,\n`markdown_to_commonmark`, and `markdown_to_plaintext` accept `width` (line wrapping\ncolumn, where `0` means no wrapping).\n\nFor plaintext output, `unsafe` has no effect: raw HTML is always omitted, including\nthe contents of raw HTML blocks. `hardbreaks=True` disables width-based wrapping.\n\n## The Options Enum\n\nThe `Options` class is an `IntFlag` enumeration. Each member corresponds to a cmark-gfm\noption bit. Because it is an `IntFlag`, members can be combined with the `|` operator.\n\n::: {#496a96e1 .cell execution_count=3}\n``` {.python .cell-code}\nfrom multimark import Options\n\n# Combine multiple flags\nopts = Options.SMART | Options.UNSAFE | Options.FOOTNOTES\nprint(f\"Combined value: {opts}\")\nprint(f\"Individual flags: {opts!r}\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nCombined value: 140288\nIndividual flags: <Options.UNSAFE|SMART|FOOTNOTES: 140288>\n```\n:::\n:::\n\n\n### All Available Flags\n\nThe full set of flags includes several GFM-specific options that have no keyword\nargument equivalent.\n\n::: {.details summary=\"Complete Options reference\" icon=\"list\"}\n\n| Flag | Keyword Equivalent | Description |\n|------|-------------------|-------------|\n| `DEFAULT` | (none needed) | No flags set (value `0`) |\n| `SOURCEPOS` | `sourcepos=True` | Include source position attributes |\n| `HARDBREAKS` | `hardbreaks=True` | Render soft breaks as hard breaks |\n| `UNSAFE` | `unsafe=True` | Allow raw HTML passthrough |\n| `NOBREAKS` | (none) | Render soft breaks as spaces |\n| `NORMALIZE` | `normalize=True` | Consolidate adjacent text nodes |\n| `VALIDATE_UTF8` | (none) | Replace invalid UTF-8 sequences |\n| `SMART` | `smart=True` | Typographic quote/dash conversion |\n| `GITHUB_PRE_LANG` | (none) | Use `lang` attribute on `<pre>` instead of `class` on `<code>` |\n| `LIBERAL_HTML_TAG` | (none) | Be more permissive with HTML tag parsing |\n| `FOOTNOTES` | `footnotes=True` | Enable footnote syntax |\n| `STRIKETHROUGH_DOUBLE_TILDE` | (none) | Require `~~` for strikethrough (not `~`) |\n| `FULL_INFO_STRING` | (none) | Include full info string in code block attributes |\n\n:::\n\n## Combining Keywords and Bitmask\n\nWhen you pass both keyword arguments and an `options` bitmask, they are merged together.\nThis lets you use keywords for common flags and the bitmask for GFM-specific ones.\n\n::: {#c7772f05 .cell execution_count=4}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html, Options\n\n# smart=True sets SMART, options adds GITHUB_PRE_LANG\nfence = \"```\"\ncode_block = f\"'Hello' -- world\\n\\n{fence}python\\nprint('hi')\\n{fence}\\n\"\nprint(markdown_to_html(\n code_block,\n smart=True,\n options=Options.GITHUB_PRE_LANG,\n))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p>‘Hello’ – world</p>\n<pre lang=\"python\"><code>print('hi')\n</code></pre>\n\n```\n:::\n:::\n\n\nNotice how the code block uses `<pre lang=\"python\">` instead of the default\n`<code class=\"language-python\">`. The `GITHUB_PRE_LANG` flag changed the attribute\nstyle, while `smart=True` handled the punctuation.\n\n## Reusable Configurations\n\nFor applications that render many documents with the same settings, define your options\nonce and reuse them.\n\n::: {#865dd475 .cell execution_count=5}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html, Options\n\n# A configuration for rendering user-generated content safely\nSAFE_GFM = Options.SMART | Options.VALIDATE_UTF8 | Options.STRIKETHROUGH_DOUBLE_TILDE\n\ndef render_comment(text: str) -> str:\n \"\"\"Render a user comment with safe defaults.\"\"\"\n return markdown_to_html(\n text,\n extensions=[\"table\", \"strikethrough\", \"autolink\", \"tasklist\"],\n options=SAFE_GFM,\n )\n\nrender_comment(\"'Hello' -- check out https://example.com\")\n```\n\n::: {.cell-output .cell-output-display execution_count=5}\n```\n'<p>‘Hello’ – check out <a href=\"https://example.com\">https://example.com</a></p>\\n'\n```\n:::\n:::\n\n\nThis pattern keeps rendering configuration centralized and easy to audit. If you later\nneed to adjust the options, you change one definition rather than updating every call\nsite.\n\n## The SAFE vs. UNSAFE Distinction\n\nThe `SAFE` and `UNSAFE` flags are complementary. `SAFE` is the legacy name for the\ndefault behavior (strip raw HTML). `UNSAFE` explicitly opts in to allowing raw HTML.\n\n::: {#8bc8a48f .cell execution_count=6}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html\n\nraw_html = \"<marquee>Dangerous!</marquee>\"\n\n# Default: raw HTML is stripped\nprint(\"Safe:\", markdown_to_html(raw_html))\n\n# With unsafe=True: raw HTML passes through\nprint(\"Unsafe:\", markdown_to_html(raw_html, unsafe=True))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nSafe: <p><!-- raw HTML omitted -->Dangerous!<!-- raw HTML omitted --></p>\n\nUnsafe: <p><marquee>Dangerous!</marquee></p>\n\n```\n:::\n:::\n\n\nWhen building applications that accept Markdown from untrusted sources, always leave\n`unsafe` at its default value of `False`. The cost of stripping raw HTML is negligible\ncompared to the security risk of XSS vulnerabilities.\n\n",
6
+ "supporting": [
7
+ "options-and-flags_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "e34cd738edf63f49a2b821d9d49bf5cc",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: \"Output Formats\"\nguide-section: \"Core Concepts\"\ntags: [HTML, LaTeX, XML]\nbread-crumbs: false\n---\n\nThis page explores the six output formats that multimark can produce from a single Markdown input, showing what each format looks like and when to reach for it.\n\n## Six Renderers, One Parser\n\nAll six output renderers share the same underlying parser. The Markdown is parsed once\ninto an abstract syntax tree (AST), and then a format-specific renderer walks the tree\nto produce output. This means that parsing behavior (extensions, options) is consistent\nregardless of which renderer you choose.\n\nThe renderers are:\n\n- `markdown_to_html()` for web content\n- `markdown_to_latex()` for typesetting\n- `markdown_to_man()` for Unix manual pages\n- `markdown_to_xml()` for AST inspection\n- `markdown_to_commonmark()` for normalized Markdown\n- `markdown_to_plaintext()` for readable text\n\nEach is a standalone function that you call with a Markdown string and optional\nparameters.\n\n## HTML\n\nHTML is the most common output format. It produces well-formed fragments suitable for\nembedding in web pages, documentation systems, or email templates.\n\n::: {#783b0cf9 .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import markdown_to_html\n\ndoc = \"\"\"\\\n## Features\n\nMultimark is **fast** and supports:\n\n1. CommonMark\n2. GFM extensions\n3. Multiple output formats\n\"\"\"\n\nprint(markdown_to_html(doc))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<h2>Features</h2>\n<p>Multimark is <strong>fast</strong> and supports:</p>\n<ol>\n<li>CommonMark</li>\n<li>GFM extensions</li>\n<li>Multiple output formats</li>\n</ol>\n\n```\n:::\n:::\n\n\nThe HTML renderer supports one parameter that the others do not: `sourcepos`. When\nenabled, each block-level element receives a `data-sourcepos` attribute indicating its\nline and column range in the original Markdown source. This is useful for building\neditors or tools that map rendered output back to source positions.\n\n::: {#d6358633 .cell execution_count=2}\n``` {.python .cell-code}\nprint(markdown_to_html(\"# Title\\n\\nParagraph\\n\", sourcepos=True))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<h1 data-sourcepos=\"1:1-1:7\">Title</h1>\n<p data-sourcepos=\"3:1-3:9\">Paragraph</p>\n\n```\n:::\n:::\n\n\n## LaTeX\n\nThe LaTeX renderer produces fragments suitable for inclusion in a `.tex` document.\nHeadings map to sectioning commands, inline formatting maps to text commands, and code\nblocks use `verbatim` environments.\n\n::: {#2f504177 .cell execution_count=3}\n``` {.python .cell-code}\nfrom multimark import markdown_to_latex\n\ndoc = \"\"\"\\\n# Introduction\n\nThis is **bold** and *italic* with `inline code`.\n\n> A block quote.\n\"\"\"\n\nprint(markdown_to_latex(doc))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n\\section{Introduction}\n\nThis is \\textbf{bold} and \\emph{italic} with \\texttt{inline code}.\n\n\\begin{quote}\nA block quote.\n\n\\end{quote}\n\n```\n:::\n:::\n\n\n### Line Wrapping\n\nThe `width` parameter controls line wrapping in the LaTeX output. A value of `0`\n(the default) disables wrapping entirely. Any positive value wraps lines at approximately\nthat column.\n\n::: {#19a6e3b3 .cell execution_count=4}\n``` {.python .cell-code}\nlong_para = \"This is a sentence that demonstrates line wrapping. \" * 5\nprint(markdown_to_latex(long_para, width=60))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nThis is a sentence that demonstrates line wrapping. This is\na sentence that demonstrates line wrapping. This is a\nsentence that demonstrates line wrapping. This is a sentence\nthat demonstrates line wrapping. This is a sentence that\ndemonstrates line wrapping.\n\n```\n:::\n:::\n\n\nWrapping makes the LaTeX source more readable and produces cleaner diffs in version\ncontrol.\n\n## Man Pages\n\nThe groff man page renderer produces output compatible with the `man` command and\nrelated roff-based toolchains. Formatting uses font-switching requests and standard man\nmacros.\n\n::: {#39e5f7dc .cell execution_count=5}\n``` {.python .cell-code}\nfrom multimark import markdown_to_man\n\ndoc = \"\"\"\\\n## Synopsis\n\n**multimark** - Python bindings for cmark-gfm\n\n## Description\n\nConverts *Markdown* to multiple output formats.\n\"\"\"\n\nprint(markdown_to_man(doc))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n.SS\nSynopsis\n.PP\n\\f[B]multimark\\f[] \\- Python bindings for cmark\\-gfm\n.SS\nDescription\n.PP\nConverts \\f[I]Markdown\\f[] to multiple output formats.\n\n```\n:::\n:::\n\n\nLike LaTeX, the man renderer supports `width` for line wrapping. Setting this to 72 or\n78 matches common man page formatting conventions.\n\n## XML\n\nThe XML renderer produces a structured representation of the parsed AST. Every Markdown\nconstruct becomes a named XML element, making this format ideal for debugging, testing,\nor feeding into XML-based toolchains.\n\n::: {#25761c31 .cell execution_count=6}\n``` {.python .cell-code}\nfrom multimark import markdown_to_xml\n\nsimple = \"A **bold** word.\\n\"\nprint(markdown_to_xml(simple))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n<document xmlns=\"http://commonmark.org/xml/1.0\">\n <paragraph>\n <text xml:space=\"preserve\">A </text>\n <strong>\n <text xml:space=\"preserve\">bold</text>\n </strong>\n <text xml:space=\"preserve\"> word.</text>\n </paragraph>\n</document>\n\n```\n:::\n:::\n\n\nThe output includes an XML declaration and DOCTYPE reference. Each element directly\ncorresponds to an AST node type: `<paragraph>`, `<strong>`, `<text>`, `<softbreak>`,\nand so on.\n\n### Inspecting Document Structure\n\nThe XML format is particularly valuable when you need to understand exactly how the\nparser interprets a given input. Ambiguous constructs or edge cases become immediately\nclear in the AST representation.\n\n::: {#a48b5e52 .cell execution_count=7}\n``` {.python .cell-code}\n# How does the parser handle nested emphasis?\ntricky = \"***bold and italic***\\n\"\nprint(markdown_to_xml(tricky))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n<document xmlns=\"http://commonmark.org/xml/1.0\">\n <paragraph>\n <emph>\n <strong>\n <text xml:space=\"preserve\">bold and italic</text>\n </strong>\n </emph>\n </paragraph>\n</document>\n\n```\n:::\n:::\n\n\n## CommonMark (Normalization)\n\nThe CommonMark renderer parses Markdown and re-renders it in a canonical form. Different\nbut semantically equivalent inputs produce identical output after normalization.\n\n::: {#a9664021 .cell execution_count=8}\n``` {.python .cell-code}\nfrom multimark import markdown_to_commonmark\n\n# These three inputs all mean the same thing\ninputs = [\n \"_hello_ **world**\\n\",\n \"*hello* __world__\\n\",\n \"*hello* **world**\\n\",\n]\n\nfor md in inputs:\n print(repr(markdown_to_commonmark(md)))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n'*hello* **world**\\n'\n'*hello* **world**\\n'\n'*hello* **world**\\n'\n```\n:::\n:::\n\n\nAll three inputs normalize to the same canonical form. This is useful for enforcing\nconsistent formatting across a document or codebase, and for testing that\ntransformations preserve semantics.\n\n### Round-Trip Stability\n\nA key property of the CommonMark renderer is round-trip stability: normalizing an\nalready-normalized document produces the same output. This means you can apply it\nidempotently.\n\n::: {#4289f9f5 .cell execution_count=9}\n``` {.python .cell-code}\noriginal = \"- First\\n- Second\\n- Third\\n\"\nonce = markdown_to_commonmark(original)\ntwice = markdown_to_commonmark(once)\n\nprint(f\"Stable: {once == twice}\")\nprint(once)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nStable: True\n - First\n - Second\n - Third\n\n```\n:::\n:::\n\n\n## Plain Text\n\nThe plaintext renderer removes heading, emphasis, link, and code delimiters while\nretaining their text. It keeps paragraph separation, list markers, code contents,\nand image descriptions, but drops link destinations and image URLs.\n\n::: {#c90af1d0 .cell execution_count=10}\n``` {.python .cell-code}\nfrom multimark import markdown_to_plaintext\n\ndoc = \"\"\"\\\n# Title\n\n**Bold** and *italic* with [a link](https://example.com).\n\"\"\"\nprint(markdown_to_plaintext(doc))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nTitle\n\nBold and italic with a link.\n\n```\n:::\n:::\n\n\nThis uses cmark-gfm's readable plaintext format, not strict removal of all markup:\n\n- GFM tables retain pipe-table syntax.\n- Task lists retain `[x]` and `[ ]` markers.\n- Strikethrough text is surrounded by single tildes, such as `~deleted~`.\n- Enabled footnotes retain numbered references and definitions.\n- Inline HTML tags are omitted; raw HTML blocks are omitted **including their text**.\n `unsafe=True` does not change this behavior.\n\nExtensions remain opt-in through `extensions=`, as with other renderers. Output\nwhitespace is not stripped, and empty input returns `\"\\n\"`.\n\n### Line Wrapping\n\n`width=0` disables automatic wrapping and preserves soft line breaks. A positive\nwidth reflows soft line breaks as spaces and wraps text at approximately that column.\nExplicit hard line breaks remain newlines, and code blocks are never wrapped.\n`hardbreaks=True` disables width-based wrapping and preserves soft line breaks.\n\n::: {#93e8c65a .cell execution_count=11}\n``` {.python .cell-code}\nprint(markdown_to_plaintext(\"A paragraph with **bold** text. \" * 5, width=60))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nA paragraph with bold text. A paragraph with bold text. A\nparagraph with bold text. A paragraph with bold text. A\nparagraph with bold text.\n\n```\n:::\n:::\n\n\n## Choosing a Format\n\nThe right renderer depends on your downstream pipeline. Here is a quick decision guide.\n\n::: {.details .open summary=\"When to use each format\" icon=\"compass\"}\n\n**HTML** when you are producing web content, documentation, or any output that will\nbe displayed in a browser.\n\n**LaTeX** when you are generating input for `pdflatex`, `xelatex`, or any TeX-based\ntypesetting system.\n\n**Man** when you are writing Unix manual pages for command-line tools.\n\n**XML** when you need to inspect the AST, run XPath queries, or feed structured data\ninto an XML pipeline.\n\n**CommonMark** when you want to normalize formatting, enforce style consistency, or\nverify round-trip stability of your Markdown processing pipeline.\n\n**Plain text** when you want readable text without most Markdown formatting, while\nretaining lists and paragraph structure.\n\n:::\n\n",
6
+ "supporting": [
7
+ "output-formats_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "hash": "4353d3a0e38184f768bcf0ffa7774292",
3
+ "result": {
4
+ "engine": "jupyter",
5
+ "markdown": "---\ntitle: \"Parsing and AST\"\nguide-section: \"Core Concepts\"\ntags: [Tutorial]\nbread-crumbs: false\n---\n\nmultimark exposes the full abstract syntax tree (AST) that cmark-gfm builds during\nparsing. This lets you inspect document structure, extract content, transform nodes,\nand render subtrees. This is all backed by the same C library that powers the renderers.\n\n## Parsing to an AST\n\nThe `parse()` function takes a Markdown string and returns the root `Node` of the\nparsed tree.\n\n::: {#981c3cf9 .cell execution_count=1}\n``` {.python .cell-code}\nfrom multimark import parse, NodeType\n\ndoc = parse(\"# Hello\\n\\nA paragraph with **bold** text.\\n\")\ndoc\n```\n\n::: {.cell-output .cell-output-display execution_count=1}\n```\n<Node document>\n```\n:::\n:::\n\n\nThe root node is always a `DOCUMENT`. Its children are the top-level block elements.\n\n::: {#b53252a0 .cell execution_count=2}\n``` {.python .cell-code}\nfor child in doc.children:\n print(child)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<Node heading level=1>\n<Node paragraph>\n```\n:::\n:::\n\n\n## Walking the Tree\n\nThe `walk()` method performs a depth-first traversal, yielding `(event, node)` pairs.\nContainer nodes produce both `\"enter\"` and `\"exit\"` events; leaf nodes produce only\n`\"enter\"`.\n\n::: {#8e3bb58f .cell execution_count=3}\n``` {.python .cell-code}\nfor event, node in doc.walk():\n if event == \"enter\":\n print(f\"{node.type_string:>15} {node.literal or ''}\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n document \n heading \n text Hello\n paragraph \n text A paragraph with \n strong \n text bold\n text text.\n```\n:::\n:::\n\n\nThis is the primary way to scan or transform a document. For example, extracting all\nlinks:\n\n::: {#d7ee465f .cell execution_count=4}\n``` {.python .cell-code}\nmd = \"See [Python](https://python.org) and [Rust](https://rust-lang.org).\\n\"\ndoc = parse(md)\n\nlinks = [\n (node.url, node.first_child.literal)\n for event, node in doc.walk()\n if event == \"enter\" and node.type == NodeType.LINK\n]\nlinks\n```\n\n::: {.cell-output .cell-output-display execution_count=4}\n```\n[('https://python.org', 'Python'), ('https://rust-lang.org', 'Rust')]\n```\n:::\n:::\n\n\n## Node Properties\n\nEach node type exposes relevant properties. Headings have a `heading_level`, links have\n`url` and `title`, code blocks have `fence_info`, and text nodes have `literal`.\n\n::: {#80941579 .cell execution_count=5}\n``` {.python .cell-code}\ndoc = parse(\"## Installation\\n\\nRun `pip install multimark`.\\n\")\n\nfor event, node in doc.walk():\n if event == \"enter\" and node.type == NodeType.HEADING:\n print(f\"Level {node.heading_level}: \", end=\"\")\n print(node.first_child.literal)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nLevel 2: Installation\n```\n:::\n:::\n\n\nSource positions are available on every node:\n\n::: {#2e018725 .cell execution_count=6}\n``` {.python .cell-code}\ndoc = parse(\"First paragraph.\\n\\nSecond paragraph.\\n\")\n\nfor child in doc.children:\n print(f\"Lines {child.start_line}–{child.end_line}: {child.type_string}\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nLines 1–1: paragraph\nLines 3–3: paragraph\n```\n:::\n:::\n\n\n## Mutating the Tree\n\nNodes support in-place mutation. You can change properties, add or remove nodes, and\nthen render the modified tree.\n\n::: {#8843e72a .cell execution_count=7}\n``` {.python .cell-code}\nfrom multimark import Node\n\ndoc = parse(\"Visit [example](http://example.com) for details.\\n\")\n\nfor event, node in doc.walk():\n if node.type == NodeType.LINK and node.url.startswith(\"http://\"):\n node.url = node.url.replace(\"http://\", \"https://\", 1)\n\nprint(doc.render_html())\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p>Visit <a href=\"https://example.com\">example</a> for details.</p>\n\n```\n:::\n:::\n\n\nYou can also build nodes from scratch:\n\n::: {#008e30f4 .cell execution_count=8}\n``` {.python .cell-code}\ndoc = parse(\"Some content.\\n\")\n\nheading = Node.new(NodeType.HEADING)\nheading.heading_level = 2\ntext = Node.new(NodeType.TEXT)\ntext.literal = \"Table of Contents\"\nheading.append_child(text)\ndoc.prepend_child(heading)\n\nprint(doc.render_html())\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<h2>Table of Contents</h2>\n<p>Some content.</p>\n\n```\n:::\n:::\n\n\n## Rendering Subtrees\n\nAny node can render itself independently, which is useful for extracting fragments.\n\n::: {#cd6e9d4b .cell execution_count=9}\n``` {.python .cell-code}\ndoc = parse(\"# Title\\n\\nFirst paragraph.\\n\\nSecond paragraph.\\n\")\n\nsecond_para = list(doc.children)[2]\nprint(second_para.render_html())\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<p>Second paragraph.</p>\n\n```\n:::\n:::\n\n\nAll six output formats are available: `render_html()`, `render_xml()`, `render_latex()`,\n`render_man()`, `render_commonmark()`, and `render_plaintext()`.\n\n::: {#8f235f85 .cell execution_count=10}\n``` {.python .cell-code}\nprint(second_para.render_plaintext())\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nSecond paragraph.\n\n```\n:::\n:::\n\n\n## Streaming Parser\n\nFor large documents or streamed input, the `Parser` class provides incremental feeding.\n\n::: {#739d3db1 .cell execution_count=11}\n``` {.python .cell-code}\nfrom multimark import Parser\n\nwith Parser(smart=True) as p:\n p.feed(\"# Chapter 1\\n\\n\")\n p.feed(\"Some text with \\\"quotes\\\" and -- dashes.\\n\")\n print(p.render_html())\n print(p.render_plaintext(width=72))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<h1>Chapter 1</h1>\n<p>Some text with “quotes” and – dashes.</p>\n\nChapter 1\n\nSome text with “quotes” and – dashes.\n\n```\n:::\n:::\n\n\nThe `Parser` also works as a context manager for automatic resource cleanup, and its\n`finish()` method returns the root `Node` for AST access:\n\n::: {#5c024a5d .cell execution_count=12}\n``` {.python .cell-code}\nwith Parser(extensions=[\"table\"]) as p:\n p.feed(\"| A | B |\\n|---|---|\\n| 1 | 2 |\\n\")\n doc = p.finish()\n print(doc.render_html())\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n<table>\n<thead>\n<tr>\n<th>A</th>\n<th>B</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>2</td>\n</tr>\n</tbody>\n</table>\n\n```\n:::\n:::\n\n\n## GFM Extensions with the AST\n\nExtensions like tables, strikethrough, and task lists produce their own node types in\nthe tree. These work with both `parse()` and `Parser`.\n\n::: {#80d1af15 .cell execution_count=13}\n``` {.python .cell-code}\ndoc = parse(\n \"- [x] Done\\n- [ ] Pending\\n\",\n extensions=[\"tasklist\"],\n)\n\nfor event, node in doc.walk():\n if event == \"enter\":\n print(f\"{node.type_string}: {node.literal or ''}\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\ndocument: \nlist: \ntasklist: \nparagraph: \ntext: Done\ntasklist: \nparagraph: \ntext: Pending\n```\n:::\n:::\n\n\n## Common Patterns\n\n### Extract all headings for a table of contents\n\n::: {#1e9bf94a .cell execution_count=14}\n``` {.python .cell-code}\ndoc = parse(\"# Intro\\n\\n## Setup\\n\\n### Details\\n\\n## Usage\\n\")\n\ntoc = []\nfor event, node in doc.walk():\n if event == \"enter\" and node.type == NodeType.HEADING:\n level = node.heading_level\n text = node.first_child.literal if node.first_child else \"\"\n toc.append((level, text))\n\ntoc\n```\n\n::: {.cell-output .cell-output-display execution_count=14}\n```\n[(1, 'Intro'), (2, 'Setup'), (3, 'Details'), (2, 'Usage')]\n```\n:::\n:::\n\n\n### Strip all formatting and extract plain text\n\n::: {#cf37c243 .cell execution_count=15}\n``` {.python .cell-code}\ndoc = parse(\"Hello **world**, visit [here](https://x.com).\\n\")\n\ntexts = [\n node.literal\n for event, node in doc.walk()\n if event == \"enter\" and node.type == NodeType.TEXT\n]\n\" \".join(texts)\n```\n\n::: {.cell-output .cell-output-display execution_count=15}\n```\n'Hello world , visit here .'\n```\n:::\n:::\n\n\nFor comparison, render the same tree directly:\n\n::: {#9d82c5e7 .cell execution_count=16}\n``` {.python .cell-code}\ndoc.render_plaintext()\n```\n\n::: {.cell-output .cell-output-display execution_count=16}\n```\n'Hello world, visit here.\\n'\n```\n:::\n:::\n\n\nThe manual approach collects only `TEXT` nodes and joins them with spaces. The\nrenderer also includes code contents and preserves list markers and paragraph\nbreaks. Some GFM markers remain, and raw HTML blocks are omitted including their\ntext. See [Plain Text](output-formats.qmd#plain-text) for the full behavior.\n\n",
6
+ "supporting": [
7
+ "parsing-and-ast_files/figure-html"
8
+ ],
9
+ "filters": [],
10
+ "includes": {}
11
+ }
12
+ }