Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lepture/mistune
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.8.4
Choose a base ref
...
head repository: lepture/mistune
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.1.1
Choose a head ref
Loading
Showing with 16,332 additions and 7,796 deletions.
  1. +11 −0 .editorconfig
  2. +8 −0 .github/FUNDING.yml
  3. +68 −0 .github/workflows/pypi.yml
  4. +55 −0 .github/workflows/tests.yml
  5. +8 −1 .gitignore
  6. +15 −0 .readthedocs.yaml
  7. +0 −18 .travis.yml
  8. +28 −0 BACKERS.md
  9. +0 −208 CHANGES.rst
  10. +1 −1 LICENSE
  11. +6 −5 MANIFEST.in
  12. +5 −28 Makefile
  13. +193 −0 README.md
  14. +13 −245 README.rst
  15. +0 −16 appveyor.yml
  16. +137 −0 benchmark/bench.py
  17. +17 −0 benchmark/cases/atx.txt
  18. +1 −0 benchmark/cases/auto_links.txt
  19. 0 benchmark/cases/blockcode.txt
  20. +41 −0 benchmark/cases/blockhtml.txt
  21. +7 −0 benchmark/cases/blockquote.txt
  22. +1 −0 benchmark/cases/emphasis.txt
  23. +30 −0 benchmark/cases/fenced.txt
  24. +31 −0 benchmark/cases/insane_ol.txt
  25. +41 −0 benchmark/cases/insane_ul.txt
  26. +16 −0 benchmark/cases/normal_ol.txt
  27. +37 −0 benchmark/cases/normal_ul.txt
  28. +264 −0 benchmark/cases/paragraph.txt
  29. +19 −0 benchmark/cases/ref_links.txt
  30. +24 −0 benchmark/cases/setext.txt
  31. +2 −0 benchmark/cases/std_links.txt
  32. +13 −170 docs/Makefile
  33. +1 −0 docs/_static/dark-icon.svg
  34. +1 −0 docs/_static/light-icon.svg
  35. +1 −0 docs/_static/logo-black.svg
  36. +1 −0 docs/_static/logo-white.svg
  37. +4 −0 docs/_templates/partials/globaltoc-above.html
  38. +0 −37 docs/_themes/LICENSE
  39. +0 −22 docs/_themes/flask_small/layout.html
  40. +0 −287 docs/_themes/flask_small/static/flasky.css_t
  41. +0 −10 docs/_themes/flask_small/theme.conf
  42. +0 −86 docs/_themes/flask_theme_support.py
  43. +152 −0 docs/advanced.rst
  44. +140 −0 docs/api.rst
  45. +117 −0 docs/changes.rst
  46. +71 −0 docs/cli.rst
  47. +6 −0 docs/community.rst
  48. +61 −226 docs/conf.py
  49. +184 −0 docs/directives.rst
  50. +110 −0 docs/guide.rst
  51. +39 −12 docs/index.rst
  52. +484 −0 docs/plugins.rst
  53. +186 −0 docs/renderers.rst
  54. +4 −0 docs/requirements.txt
  55. +63 −0 docs/upgrade.rst
  56. +0 −1,184 mistune.py
  57. +76 −0 pyproject.toml
  58. +30 −0 requirements-dev.lock
  59. +14 −0 requirements.lock
  60. +5 −0 serve-doc.py
  61. +0 −7 setup.cfg
  62. +1 −42 setup.py
  63. +96 −0 src/mistune/__init__.py
  64. +130 −0 src/mistune/__main__.py
  65. +496 −0 src/mistune/block_parser.py
  66. +256 −0 src/mistune/core.py
  67. +33 −0 src/mistune/directives/__init__.py
  68. +170 −0 src/mistune/directives/_base.py
  69. +156 −0 src/mistune/directives/_fenced.py
  70. +82 −0 src/mistune/directives/_rst.py
  71. +71 −0 src/mistune/directives/admonition.py
  72. +183 −0 src/mistune/directives/image.py
  73. +72 −0 src/mistune/directives/include.py
  74. +115 −0 src/mistune/directives/toc.py
  75. +147 −0 src/mistune/helpers.py
  76. +414 −0 src/mistune/inline_parser.py
  77. +265 −0 src/mistune/list_parser.py
  78. +124 −0 src/mistune/markdown.py
  79. +49 −0 src/mistune/plugins/__init__.py
  80. +111 −0 src/mistune/plugins/abbr.py
  81. +143 −0 src/mistune/plugins/def_list.py
  82. +175 −0 src/mistune/plugins/footnotes.py
  83. +196 −0 src/mistune/plugins/formatting.py
  84. +67 −0 src/mistune/plugins/math.py
  85. +110 −0 src/mistune/plugins/ruby.py
  86. +50 −0 src/mistune/plugins/speedup.py
  87. +91 −0 src/mistune/plugins/spoiler.py
  88. +205 −0 src/mistune/plugins/table.py
  89. +73 −0 src/mistune/plugins/task_lists.py
  90. +30 −0 src/mistune/plugins/url.py
  91. +2 −0 src/mistune/py.typed
  92. 0 src/mistune/renderers/__init__.py
  93. +76 −0 src/mistune/renderers/_list.py
  94. +157 −0 src/mistune/renderers/html.py
  95. +149 −0 src/mistune/renderers/markdown.py
  96. +150 −0 src/mistune/renderers/rst.py
  97. +126 −0 src/mistune/toc.py
  98. +81 −0 src/mistune/util.py
  99. +40 −0 tests/__init__.py
  100. +0 −101 tests/bench.py
  101. +56 −0 tests/fixtures/__init__.py
  102. +79 −0 tests/fixtures/abbr.txt
  103. +5,218 −0 tests/fixtures/commonmark.json
  104. +0 −3 tests/fixtures/data/math-paragraph.md
  105. +0 −3 tests/fixtures/data/math.md
  106. +0 −10 tests/fixtures/data/tree.md
  107. +172 −0 tests/fixtures/def_list.txt
  108. +76 −0 tests/fixtures/diff-commonmark.txt
  109. +0 −3 tests/fixtures/extra/autolink_lines.html
  110. +0 −2 tests/fixtures/extra/autolink_lines.text
  111. +0 −3 tests/fixtures/extra/blockquote_list_item.html
  112. +0 −4 tests/fixtures/extra/blockquote_list_item.text
  113. +0 −1 tests/fixtures/extra/case_insensitive_refs.html
  114. +0 −3 tests/fixtures/extra/case_insensitive_refs.text
  115. +0 −5 tests/fixtures/extra/double_link.html
  116. +0 −5 tests/fixtures/extra/double_link.text
  117. +0 −1 tests/fixtures/extra/escaped_angles.html
  118. +0 −1 tests/fixtures/extra/escaped_angles.text
  119. +0 −83 tests/fixtures/extra/footnotes.html
  120. +0 −55 tests/fixtures/extra/footnotes.text
  121. +0 −5 tests/fixtures/extra/gfm_code.html
  122. +0 −16 tests/fixtures/extra/gfm_code.text
  123. +0 −52 tests/fixtures/extra/gfm_code_hr_list.html
  124. +0 −53 tests/fixtures/extra/gfm_code_hr_list.text
  125. +0 −1 tests/fixtures/extra/gfm_del.html
  126. +0 −1 tests/fixtures/extra/gfm_del.text
  127. +0 −1 tests/fixtures/extra/gfm_em.html
  128. +0 −1 tests/fixtures/extra/gfm_em.text
  129. +0 −2 tests/fixtures/extra/gfm_links.html
  130. +0 −1 tests/fixtures/extra/gfm_links.text
  131. +0 −46 tests/fixtures/extra/gfm_tables.html
  132. +0 −26 tests/fixtures/extra/gfm_tables.text
  133. +0 −16 tests/fixtures/extra/gfm_tables_uneven.html
  134. +0 −3 tests/fixtures/extra/gfm_tables_uneven.text
  135. +0 −16 tests/fixtures/extra/hetero_list.html
  136. +0 −6 tests/fixtures/extra/hetero_list.text
  137. +0 −10 tests/fixtures/extra/hr_list_break.html
  138. +0 −6 tests/fixtures/extra/hr_list_break.text
  139. +0 −4 tests/fixtures/extra/lazy_blockquotes.html
  140. +0 −2 tests/fixtures/extra/lazy_blockquotes.text
  141. +0 −1 tests/fixtures/extra/list_item_text.html
  142. +0 −5 tests/fixtures/extra/list_item_text.text
  143. +0 −62 tests/fixtures/extra/loose_lists.html
  144. +0 −59 tests/fixtures/extra/loose_lists.text
  145. +0 −4 tests/fixtures/extra/main.html
  146. +0 −55 tests/fixtures/extra/main.text
  147. +0 −21 tests/fixtures/extra/nested_blockquotes.html
  148. +0 −7 tests/fixtures/extra/nested_blockquotes.text
  149. +0 −1 tests/fixtures/extra/nested_code.html
  150. +0 −1 tests/fixtures/extra/nested_code.text
  151. +0 −3 tests/fixtures/extra/nested_em.html
  152. +0 −3 tests/fixtures/extra/nested_em.text
  153. +0 −27 tests/fixtures/extra/nested_list.html
  154. +0 −7 tests/fixtures/extra/nested_list.text
  155. +0 −1 tests/fixtures/extra/nested_square_link.html
  156. +0 −1 tests/fixtures/extra/nested_square_link.text
  157. +0 −1 tests/fixtures/extra/not_a_link.html
  158. +0 −1 tests/fixtures/extra/not_a_link.text
  159. +0 −1 tests/fixtures/extra/ref_paren.html
  160. +0 −3 tests/fixtures/extra/ref_paren.text
  161. +0 −5 tests/fixtures/extra/same_bullet.html
  162. +0 −3 tests/fixtures/extra/same_bullet.text
  163. +0 −34 tests/fixtures/extra/toplevel_paragraphs.gfm.html
  164. +0 −37 tests/fixtures/extra/toplevel_paragraphs.gfm.text
  165. +0 −23 tests/fixtures/extra/tricky_list.html
  166. +0 −15 tests/fixtures/extra/tricky_list.text
  167. +129 −0 tests/fixtures/fenced_admonition.txt
  168. +166 −0 tests/fixtures/fenced_figure.txt
  169. +102 −0 tests/fixtures/fenced_image.txt
  170. +237 −0 tests/fixtures/fenced_toc.txt
  171. +123 −0 tests/fixtures/fix-commonmark.txt
  172. +45 −0 tests/fixtures/footnotes.txt
  173. +122 −0 tests/fixtures/hook_toc.txt
  174. +1 −0 tests/fixtures/include/hello.md
  175. +1 −0 tests/fixtures/include/hello.txt
  176. +1 −0 tests/fixtures/include/text.html
  177. +12 −0 tests/fixtures/include/text.md
  178. +62 −0 tests/fixtures/insert.txt
  179. +61 −0 tests/fixtures/mark.txt
  180. +57 −0 tests/fixtures/math.txt
  181. +0 −17 tests/fixtures/normal/amps_and_angles_encoding.html
  182. +0 −21 tests/fixtures/normal/amps_and_angles_encoding.text
  183. +0 −2 tests/fixtures/normal/auto_email.html
  184. +0 −1 tests/fixtures/normal/auto_email.text
  185. +0 −18 tests/fixtures/normal/auto_links.html
  186. +0 −13 tests/fixtures/normal/auto_links.text
  187. +0 −118 tests/fixtures/normal/backslash_escapes.html
  188. +0 −120 tests/fixtures/normal/backslash_escapes.text
  189. +0 −15 tests/fixtures/normal/blockquotes_with_code_blocks.html
  190. +0 −11 tests/fixtures/normal/blockquotes_with_code_blocks.text
  191. +0 −18 tests/fixtures/normal/code_blocks.html
  192. +0 −14 tests/fixtures/normal/code_blocks.text
  193. +0 −12 tests/fixtures/normal/code_spans.html
  194. +0 −12 tests/fixtures/normal/code_spans.text
  195. +0 −39 tests/fixtures/normal/headers.html
  196. +0 −36 tests/fixtures/normal/headers.text
  197. +0 −71 tests/fixtures/normal/horizontal_rules.html
  198. +0 −67 tests/fixtures/normal/horizontal_rules.text
  199. +0 −15 tests/fixtures/normal/inline_html_advanced.html
  200. +0 −15 tests/fixtures/normal/inline_html_advanced.text
  201. +0 −13 tests/fixtures/normal/inline_html_comments.html
  202. +0 −13 tests/fixtures/normal/inline_html_comments.text
  203. +0 −82 tests/fixtures/normal/inline_html_simple.html
  204. +0 −78 tests/fixtures/normal/inline_html_simple.text
  205. +0 −15 tests/fixtures/normal/links_inline_style.html
  206. +0 −15 tests/fixtures/normal/links_inline_style.text
  207. +0 −52 tests/fixtures/normal/links_reference_style.html
  208. +0 −71 tests/fixtures/normal/links_reference_style.text
  209. +0 −9 tests/fixtures/normal/links_shortcut_references.html
  210. +0 −20 tests/fixtures/normal/links_shortcut_references.text
  211. +0 −3 tests/fixtures/normal/literal_quotes_in_titles.html
  212. +0 −7 tests/fixtures/normal/literal_quotes_in_titles.text
  213. +0 −314 tests/fixtures/normal/markdown_documentation_basics.html
  214. +0 −306 tests/fixtures/normal/markdown_documentation_basics.text
  215. +0 −942 tests/fixtures/normal/markdown_documentation_syntax.html
  216. +0 −888 tests/fixtures/normal/markdown_documentation_syntax.text
  217. +0 −9 tests/fixtures/normal/nested_blockquotes.html
  218. +0 −5 tests/fixtures/normal/nested_blockquotes.text
  219. +0 −148 tests/fixtures/normal/ordered_and_unordered_lists.html
  220. +0 −131 tests/fixtures/normal/ordered_and_unordered_lists.text
  221. +0 −7 tests/fixtures/normal/strong_and_em_together.html
  222. +0 −7 tests/fixtures/normal/strong_and_em_together.text
  223. +0 −25 tests/fixtures/normal/tabs.html
  224. +0 −21 tests/fixtures/normal/tabs.text
  225. +0 −8 tests/fixtures/normal/tidyness.html
  226. +0 −5 tests/fixtures/normal/tidyness.text
  227. +299 −0 tests/fixtures/renderer_markdown.txt
  228. +250 −0 tests/fixtures/renderer_rst.txt
  229. +46 −0 tests/fixtures/rst_admonition.txt
  230. +223 −0 tests/fixtures/rst_toc.txt
  231. +70 −0 tests/fixtures/ruby.txt
  232. +74 −0 tests/fixtures/spoiler.txt
  233. +46 −0 tests/fixtures/strikethrough.txt
  234. +26 −0 tests/fixtures/subscript.txt
  235. +26 −0 tests/fixtures/superscript.txt
  236. +258 −0 tests/fixtures/table.txt
  237. +108 −0 tests/fixtures/task_lists.txt
  238. +22 −0 tests/fixtures/url.txt
  239. +0 −51 tests/test_cases.py
  240. +76 −0 tests/test_commonmark.py
  241. +93 −0 tests/test_directives.py
  242. +0 −161 tests/test_extra.py
  243. +29 −0 tests/test_hooks.py
  244. +137 −0 tests/test_misc.py
  245. +66 −0 tests/test_plugins.py
  246. +17 −0 tests/test_renderers.py
  247. +0 −191 tests/test_subclassing.py
  248. +12 −0 tests/test_syntax.py
  249. +0 −27 tox.ini
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root=true

[*]
insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 2

[*.py]
indent_size = 4
trim_trailing_whitespace = true
8 changes: 8 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# These are supported funding model platforms

github: [lepture]
patreon: lepture
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: pypi/mistune
custom: https://lepture.com/donate
68 changes: 68 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release to PyPI

permissions:
contents: write
id-token: write

on:
push:
tags:
- "v*"

jobs:
build:
name: build dist files
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.9

- name: install build
run: python -m pip install --upgrade build

- name: build dist
run: python -m build

- uses: actions/upload-artifact@v4
with:
name: artifacts
path: dist/*
if-no-files-found: error

publish:
environment:
name: pypi-release

name: release to pypi
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
name: artifacts
path: dist

- name: Push build artifacts to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

release:
name: write release note
runs-on: ubuntu-latest
needs: publish

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npx changelogithub --no-group
continue-on-error: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
55 changes: 55 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Run tests

on:
push:
branches-ignore:
- 'wip-*'
paths-ignore:
- 'docs/**'
pull_request:
branches-ignore:
- 'wip-*'
paths-ignore:
- 'docs/**'

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 6
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.8", "3.9", "3.10", "3.11", "pypy3.9"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }} on ${{ matrix.os }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov mypy
- name: Check types with Python ${{ matrix.python }} on ${{ matrix.os }}
run: |
mypy --strict src
mypy src tests
- name: Test with Python ${{ matrix.python }} on ${{ matrix.os }}
run: pytest

- name: Report coverage
run: pytest --cov=mistune --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: GitHub
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.pyc
*.pyo
*.egg-info
.idea
__pycache__
bin
build
@@ -16,4 +17,10 @@ cover/
*.bak
*.c
*.so
venv/
.venv/
.python-version
.coverage
htmlcov
.eggs
coverage.xml
demo.py
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: "ubuntu-20.04"
tools:
python: "3.10"

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

28 changes: 28 additions & 0 deletions BACKERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Sponsors and Backers

Many thanks to these awesome sponsors and backers.

[Support Me via GitHub Sponsors](https://github.com/sponsors/lepture)

## Sponsors

<table>
<tr>
<td><img align="middle" width="64" src="https://typlog.com/android-chrome-512x512.png"></td>
<td>Mistune is sponsored by Typlog, a blogging and podcast hosting platform, simple yet powerful. <a href="https://typlog.com/?utm_source=mistune&utm_medium=referral&utm_campaign=readme">Write in Markdown</a>.
</td>
</tr>
</table>

## Awesome Backers

<table>
<tr>
<td align="center">
<a href="https://github.com/lqez">
<img src="https://avatars.githubusercontent.com/u/579366?v=4" alt="Hyunwoo Park" width="48" height="48">
</a><br>
Hyunwoo Park
</td>
</tr>
</table>
Loading