Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buggy, fragile list behavior #701

Open
soypat opened this issue Aug 30, 2022 · 0 comments
Open

Buggy, fragile list behavior #701

soypat opened this issue Aug 30, 2022 · 0 comments

Comments

@soypat
Copy link

soypat commented Aug 30, 2022

Using blackfriday v2.1.0, default parameters

The following markdown has 3 list items.

7. Defina
	```python
	> greet_user("esteban")
	```

11. Dado
	```python
	resultado = simple()
	```

12. Examine
	```python
	def convertir_a_float(cadena):
	```

Here is the html result. Some observations:

  • It unexpectedly nests a list
  • Second item code is inline, inconsistent with other code blocks (and unexpected
<ol>
<li><p>Defina</p>

<pre><code class="language-python">&gt; greet_user(&quot;esteban&quot;)
</code></pre>
<ol>
<li>Dado
<code>python
resultado = simple()
</code></li>
</ol></li>

<li><p>Examine</p>

<pre><code class="language-python">def convertir_a_float(cadena):
</code></pre></li>
</ol>

If we remove the third item from the markdown list we get the following. Few observations:

  • First item info string escaping the code block? what?
  • Second item is still inline.
  • Now the second item is no longer a list item, The whole markdown content has been interpreted as a single list node. Not sure what could possibly be causing this...
<ol>
<li>Defina
<code>python
&gt; greet_user(&quot;esteban&quot;)
</code>
11. Dado
<code>python
resultado = simple()
</code></li>
</ol>

Something similar happens if we delete the first item of the list.

<ol>
<li>Dado
<code>python
resultado = simple()
</code>
12. Examine
<code>python
def convertir_a_float(cadena):
</code></li>
</ol>

Please note the tabs in front of the code blocks have no effect on the bug.

soypat added a commit to soypat/blackfriday that referenced this issue Sep 2, 2022
`isFenceLine` was being called within `listItem` for finding code blocks. It was unable to detect code blocks with an info string since a nil string pointer was being passed in. Now the pointer is not nil so info-string code blocks are correctly parsed within lists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant