Hi - I’m working with Github Pages and Jekyll and I’ve run into an issue with the characters “<”, “>”, and “&” showing as HTML entities inside a code block when that code block is nested as follows:
<details>
<div>
```
code with > < & here
```
</div>
</details>
This particular case uses <details>
, but the shape seems to be what matters, as I ave also reproduced this issue with a <div>
as the outermost container.
In my _config.yml
I have the following settings on:
markdown: kramdown
kramdown:
parse_block_html: true
parse_span_html: true
syntax_highlighter_opts:
block:
line_numbers: true
In my markdown file I have the following block:
<details>
<summary markdown="0">
<h4>Test Example Code Here</h4>
</summary>
<div markdown="0">
Check out my code block below:
```bash
# We are in a code block
export VARIABLE=xxx
echo "VARIABLE" > test.txt
Less than: >
Greater than: <
Ampersand: &
```
</div>
</details>
And in my index.html
I am using:
{{ section.content | markdownify }}
This produces the following:
And to fix it, I have to replace the HTML entities before markdownify
is used:
{{ section.content | replace: "&", "&" | replace: "<", "<" | replace: ">", ">" | markdownify }}
Is this a bug? Is anyone aware of another way to do this?