executablebooks / markdown-it-py

Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed. Now in Python!
https://markdown-it-py.readthedocs.io
MIT License
706 stars 68 forks source link

👌 Centralise indented code block test #260

Closed chrisjsewell closed 1 year ago

chrisjsewell commented 1 year ago

For CommonMark, the presence of indented code blocks prevent any other block element from having an indent of greater than 4 spaces. Certain Markdown flavors and derivatives, such as mdx and djot, disable these code blocks though, since it is more common to use code fences and/or arbitrary indenting is desirable. Currently, disabling code blocks does not remove the indent limitation, since most block elements have the 3 space limitation hard-coded. This commit therefore centralises the logic of applying this limitation, and only applies it when indented code blocks are enabled. Note, this is a potential breaking change and divergence from upstream markdown-it, for this niche case, but I feel makes sense and could even be upstreamed.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 84.84% and project coverage change: -0.14 :warning:

Comparison is base (d1852a5) 96.07% compared to head (2ef6f3a) 95.94%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #260 +/- ## ========================================== - Coverage 96.07% 95.94% -0.14% ========================================== Files 62 62 Lines 3236 3253 +17 ========================================== + Hits 3109 3121 +12 - Misses 127 132 +5 ``` | Flag | Coverage Δ | | |---|---|---| | pytests | `95.94% <84.84%> (-0.14%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks) | Coverage Δ | | |---|---|---| | [markdown\_it/main.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvbWFpbi5weQ==) | `86.89% <66.66%> (-2.42%)` | :arrow_down: | | [markdown\_it/rules\_block/blockquote.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvcnVsZXNfYmxvY2svYmxvY2txdW90ZS5weQ==) | `100.00% <100.00%> (ø)` | | | [markdown\_it/rules\_block/code.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvcnVsZXNfYmxvY2svY29kZS5weQ==) | `100.00% <100.00%> (ø)` | | | [markdown\_it/rules\_block/fence.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvcnVsZXNfYmxvY2svZmVuY2UucHk=) | `100.00% <100.00%> (ø)` | | | [markdown\_it/rules\_block/heading.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvcnVsZXNfYmxvY2svaGVhZGluZy5weQ==) | `100.00% <100.00%> (ø)` | | | [markdown\_it/rules\_block/hr.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvcnVsZXNfYmxvY2svaHIucHk=) | `100.00% <100.00%> (ø)` | | | [markdown\_it/rules\_block/html\_block.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvcnVsZXNfYmxvY2svaHRtbF9ibG9jay5weQ==) | `100.00% <100.00%> (ø)` | | | [markdown\_it/rules\_block/lheading.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvcnVsZXNfYmxvY2svbGhlYWRpbmcucHk=) | `98.18% <100.00%> (ø)` | | | [markdown\_it/rules\_block/list.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvcnVsZXNfYmxvY2svbGlzdC5weQ==) | `98.88% <100.00%> (ø)` | | | [markdown\_it/rules\_block/reference.py](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-bWFya2Rvd25faXQvcnVsZXNfYmxvY2svcmVmZXJlbmNlLnB5) | `97.70% <100.00%> (ø)` | | | ... and [2 more](https://codecov.io/gh/executablebooks/markdown-it-py/pull/260?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.