Reputation: 1515
I don't know if I'm doing something wrong (I'm not very experienced with markdown) but I have an .md file as such:
Here is some code:
~~~bash
my_command arg1 arg2
~~~
I'd like pandoc to recognize the fenced code block with github syntax, so I'm using this command:
pandoc -f markdown_github+fenced_code_blocks+fenced_code_attributes -t html -s
But pandoc doesn't recognize the code block. This is the output I get:
Here is some code:
~bash~
my_command arg1 arg2
If I add a newline before the code block it does work:
Here is some code:
~~~bash
my_command arg1 arg2
~~~
The proper output:
Here is some code:
my_command arg1 arg2
If I try my original .md file in GitHub, it's recognized as is. Is there some option in pandoc that I'm missing to make my original .md work?
Upvotes: 2
Views: 2186
Reputation: 19867
Pandoc's fenced_code_blocks
extension requires an empty lines. From the manual:
Like regular code blocks, fenced code blocks must be separated from surrounding text by blank lines.
Moreover, the github_markdown
reader in pandoc is not an independent reader (there are only markdown and Common Mark readers): it is merely reading regular markdown with some default extensions, different from the regular pandoc-flavoured markdown reader.
This means that even when writing in github markdown, you have to abide by this rule. I don't see a way around it except preprocessing the file to add a newline before compilation.
Upvotes: 2