question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with code blocks inside of a list

See original GitHub issue

Description: Code blocks inside of a list render weirdly with a code block inside a code block.

Input:

1. test:
    ```python
    # coding: utf-8
    class TestClass:
        def __init__():
            pass
        
        def test():
            pass
    ```

Expected output:

<ol>
<li><p>test:</p>
<pre><code class="python language-python"># coding: utf-8
class TestClass:
    def __init__():
        pass
   
   def test():
    pass</code></pre></li></ol>

Actual Output:

<ol>
<li><p>test:</p>
<pre><code class="python language-python"># coding: utf-8
class TestClass:
    def __init__():
        pass<pre><code>def test():
    pass&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;</code></pre></ol>

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
aote777commented, Nov 23, 2021

核心问题就是pre里的<> 会被转义为字符实体。showdown只接受<>才会正常工作 The core problem is that < > in pre will be escaped into character entities. Showdown works only if it accepts < > https://github.com/aote777/anki-md-template

0reactions
aote777commented, Nov 23, 2021

大哥Have you solved this problem?

Nope. I don’t remember exactly what I did, but I think I moved away from showdown.

Thank you for your reply. I have found the reason for the problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdown rendered incorrectly when code block is inside ...
A code block within a nested list causes GitLab's Markdown renderer to incorrectly render the nested list items as code blocks.
Read more >
Common problems and solutions - Code::Blocks
Some parts of Code::Blocks or the back-end compiler may not support non ASCII characters (such as é) or possibly spaces. Try moving the...
Read more >
Markdown: Code blocks in numbered lists #1855 - GitHub
I was able to have code blocks inside numbered lists while retaining the order of the list. It looks the code block shouldn't...
Read more >
Code Block inside numbered lists and bullets, and more...
Code block is void of formatting. It is plain text. This contradicts the use of elements like bullet formatting - and it would...
Read more >
Markdown formatting bug with code blocks in lists
The formatted text contains spurious newlines and indentation errors (not to speak of the randomly inserted HTML escape sequence). Even deleting ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found