Post

embedding markdown in HTML tag

ISSUE

When I try to use the markdown syntax in <details> HTML tags, for example, code blocks, encounter the problem of code blocks that cannot be rendered.

The source code is as follows:

1
2
3
4
5
6
7
<details>
<summary> aaa </summary>
` ` `cpp
int a = 1;
` ` `

</details> 

` char seems unable to be translated in code block, so I added space characters between them

It will display in browser as follows:



aaa ```cpp int a = 1; ```


SOLUTION

This issue seems to occur in the kramdowm markup process, rather than in GFM:

And in the link Embedding Markdown in Jekyll HTML, a solution is provided:

Use <details markdown="1"> instead <details>.

It will run as expected



aaa
1
int a = 1;


This post is licensed under CC BY 4.0 by the author.