lepture/mistune

Tab indented block after heading is rendered as code

Closed this issue · 2 comments

Here's an odd behavior of mistune version 3.0.2.
If you indent a line with text with a tab after a heading (level does not matter), mistune automatically renders the following block as code.

If you indent with spaces, it renders correctly.
If you add a different line before, it renders correctly.

>>> mistune.__version__
'3.0.2'
>>> mistune.markdown("""# Test
...   test with spaces""")
'<h1>Test</h1>\n<p>test</p>\n'
>>> mistune.markdown("""# Test
...     test with tab""")
'<h1>Test</h1>\n<pre><code>test</code></pre>\n'
>>> mistune.markdown("""# Test
...   first a line with spaces
...     test with tabs""")
'<h1>Test</h1>\n<p>first a line with spaces\ntest with tabs</p>\n'
>>> mistune.markdown("""# Test
...     test with tabs
...     and many more
...     lines""")
'<h1>Test</h1>\n<pre><code>test with tabs\nand many more\nlines</code></pre>\n'

It is correct behavior.