-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
Hi there,
I'm parsing markdown files with earkmark and hooking into the postprocess to highlight the code with makeup. I noticed that the code earmark parsed does not properly preserve whitespace and therefore also the highlighted code doesn't render correctly:
"""
```xml
<!-- Basic element with attributes -->
<book id="b1" category="fiction" inStock="yes">
<title>The Great Gatsby</title>
<!-- Multiple elements of same type -->
<author>F. Scott Fitzgerald</author>
<published>1925</published>
<!-- CDATA section for text with special characters -->
<description><![CDATA[A story about the American Dream & society in the 1920s]]></description>
</book>
```
"""
|> Earmark.as_html!(
escape: false,
postprocessor: fn
{"code", _attrs, [body], _meta} = node ->
IO.puts(body)
node
node ->
node
end
)
This outputs
<!-- Basic element with attributes -->
<book id="b1" category="fiction" inStock="yes">
<title>The Great Gatsby</title>
<!-- Multiple elements of same type -->
<author>F. Scott Fitzgerald</author>
<published>1925</published>
<!-- CDATA section for text with special characters -->
<description><![CDATA[A story about the American Dream & society in the 1920s]]></description>
</book>
while it should output
<!-- Basic element with attributes -->
<book id="b1" category="fiction" inStock="yes">
<title>The Great Gatsby</title>
<!-- Multiple elements of same type -->
<author>F. Scott Fitzgerald</author>
<published>1925</published>
<!-- CDATA section for text with special characters -->
<description><![CDATA[A story about the American Dream & society in the 1920s]]></description>
</book>
Using earmark 1.4.47.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels