Search code examples
markdownpelican

Pelican: markdown codeblock '>' turned into '>'


I am using Pelican 4.0.1 (under Debian stretch). In my markdown document I have a short piece of shell code in a codeblock:

foo > bar.txt

Unexpectedly, Pelican turned the > into the html equivalent > which is not ideal in a code block:

foo > bar.txt

What am I missing, here?

Edit:

the above line is what I see in my browser. The actual html source code of the resulting page is foo > bar.txt – so, aparently, Pelican does the html encoding twice...


Solution

  • After some more research I found out that this indeed a bug in Pelican 4.01 or one of it's dependencies (probably python-markdown). See this issue on github: https://github.com/getpelican/pelican/issues/2493

    I also found a workaround that works for me: the bug seems to only affect simple indented codeblocks like this:

    some text
    
         foo > bar.txt
    
    more text
    

    The problem does not occur when the triple backtick syntax is used:

     some text
     ```
          foo > bar.txt
     ```
     more text