Masked Man Masked Man - 9 months ago 86
Markdown Question

doxygen markdown fails to parse fenced code block

Doxygen fails to parse fenced code blocks in a markdown file. Here's my snippet:

~~~~~~~~~~~~~~~~~~~~{.cpp}
#include <cstdio>

int main() {
printf("Hello World");
}
~~~~~~~~~~~~~~~~~~~~~~~~~~


This appears in the output as plaintext.


~~~~~~~~~~~~~~~~~~~~{.cpp} #include

int main() { printf("Hello World"); } ~~~~~~~~~~~~~~~~~~~~~~~~~~


What is my mistake here?

Answer Source

This looks trivial in hindsight, but I spent a lot of time debugging it, so thought I should share it with the community. The problem was that the number of tildes ~ at the start and end of the fenced block should be equal.

Minimum 3 tildes are required to mark a fenced block, but to make the fenced block more easily visible, I like extending them to the complete line. I had originally copy-pasted the starting line at the end, but I then removed a few ~s to make room for the {.cpp}.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download