0
votes

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.


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

What is my mistake here?

2

2 Answers

3
votes

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}.

-1
votes
~~~c
#include <cstdio>

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

At the beginning and the end of the same number of (~). You can like it more beutiful code block.