cwjohan / markdown-to-html

Command-line utility to convert Github Flavored Markdown to HTML.
MIT License
236 stars 86 forks source link

Inline HTML in markdown is not properly processed. #13

Open eyeszack opened 7 years ago

eyeszack commented 7 years ago

According to the markdown syntax description inline HTML is supported for those elements not represented in the syntax. When I include the following inline HTML it is not "passed" through to the output as HTML.

Inline HTML that I want written as is to output HTML:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

Instead it's parsed and rendered as follows:

<p>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/github.min.css&quot;&gt;  </p>
<p>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js&quot;&gt;&lt;/script&gt;<br>&lt;script&gt;hljs.initHighlightingOnLoad();&lt;/script&gt;  

</p>

This breaks the desired results when using the HTML file. Please refer to the inline section of the markdown syntax for more information.

https://daringfireball.net/projects/markdown/syntax#html

JESii commented 7 years ago

Same issue here; this code is not properly handled:

## API
<dl>
<dt><em><b>Digraph.new() </b></em>
<dd>Initialize the Directed Graph
<hl>

Surrounding each html tag with spaces does not resolve this issue.

This is a fatal flaw which makes this unusable in the general case.

larrykluger commented 6 years ago

Unfortunately I have the same issue. My thought is to use sed to convert the escaped entities back to their original form.

larrykluger commented 6 years ago

Solved!

You can run the output through the recode utility. StackOverflow info.

Example:

markdown changes.md | recode html..ascii > changes.htm
cwjohan commented 6 years ago

There's a sanitize option that defaults to true and there currently is no way to set it to false. So, I need to add a way to set sanitize to false. I'm putting this on my TODO list.

Sanitize means to convert any inline html into a display representation of the HTML. Setting it to false could open an application using marked to hacking exploits in some cases, but not in the case of markdown-to-html, so it should be safe to implement.

On Wed, Nov 15, 2017 at 1:50 PM, Larry Kluger notifications@github.com wrote:

Solved!

You can run the output through the recode utility. StackOverflow info. https://stackoverflow.com/questions/5929492/bash-script-to-convert-from-html-entities-to-characters

Example:

markdown changes.md | recode html..ascii > changes.htm

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cwjohan/markdown-to-html/issues/13#issuecomment-344740160, or mute the thread https://github.com/notifications/unsubscribe-auth/AH5q3Gcem0DcfmjoURkLN94l3KpXKpgEks5s21zAgaJpZM4L-Bcn .

mohsentaleb commented 6 years ago

@cwjohan I'm having the same issue with list items inside a table (<li>). Are you planning to fix this? I understand this thread is quite old, back to 2017.

cwjohan commented 6 years ago

Not planning to fix. No longer have a development environment. Many of the third party components are out of date. Needs an overhaul to update it to the latest software.

Sent from my iPhone

On May 14, 2018, at 3:29 AM, Mohsen Taleb notifications@github.com wrote:

@cwjohan I'm having the same issue with list items inside a table (

). Are you planning to fix? I understand this thread is quite old, back to 2017. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.