Skip to content

Fenced code blocks not escaped when converting Markdown to HTML5 #5627

Closed
@PhantomOverride

Description

@PhantomOverride

Hey,

I'm trying to convert example.md from Markdown to HTML using pandoc. File is attached.
example.md.txt

The command I'm using is:
pandoc --from markdown -t html5 -o 'out.html' 'example.md'

The version I'm using is:

pandoc --version
pandoc 2.7.3
Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.8.1
Default user data directory: /Users/user/.local/share/pandoc or /Users/user/.pandoc
Copyright (C) 2006-2019 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose

The problem I'm running into is that the fenced code is not escaped as HTML, which makes the fenced JavaScript code execute when viewing the document.

I guess this is because I'm a horrible person using HTML comment tags within the escaped sections, though I would expect pandoc to handle this since they are inside the fenced areas.

Could you please confirm if this is a bug, and if there is any workaround? I can't escape the characters within the fences because that would cause pandoc to double-encode them :(.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions