Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indented code block containing HTML incorrectly parsed as inline HTML #440

Closed
mappu opened this issue Jun 23, 2014 · 5 comments
Closed

Indented code block containing HTML incorrectly parsed as inline HTML #440

mappu opened this issue Jun 23, 2014 · 5 comments

Comments

@mappu
Copy link

mappu commented Jun 23, 2014

Hi! Cool project.

I am trying to create documentation including inline HTML code samples, i expect the inline HTML samples to be formatted as code. However they are being included verbatim.

Repro is as follows:

var marked = require('marked');
console.log( marked("#Samples\nHere is an HTML code sample\n    <iframe src=''>\n    </iframe>\n") );

Produces

<h1 id="samples">Samples</h1>
<p>Here is an HTML code sample
<iframe src=''>
</iframe></p>

Expected <pre><code>&gt;iframe src=''&lt;&gt;/iframe&lt;</code></pre> or something similar...

Or is there meant to be an alternative way of creating a code block, rather than a four-space indent?

marked@0.3.2

@jipiboily
Copy link

Yeah, with GFM, you do this: https://help.github.com/articles/github-flavored-markdown#syntax-highlighting

Note that for html, you need to use markup apparently.

That said, it looks like it's escaping it...I am currently looking for a work around though...

leighquince pushed a commit to leighquince/dillinger that referenced this issue Aug 28, 2014
Added it but still doesn;t make a differences might be something to do
with this issue in marked markedjs/marked#440
@rymohr
Copy link

rymohr commented Mar 9, 2015

Related to #378

@Ryn830
Copy link

Ryn830 commented Apr 29, 2015

+1

@joshbruce
Copy link
Member

#983

@Feder1co5oave
Copy link
Contributor

Indented code blocks cannot interrupt paragraphs. So you need to put an empty line between the first paragraph and the code block:

$ bin/marked
# Samples
Here is an HTML code sample

    <iframe src=''>
    </iframe>
<h1 id="samples">Samples</h1>
<p>Here is an HTML code sample</p>
<pre><code>&lt;iframe src=&#39;&#39;&gt;
&lt;/iframe&gt;
</code></pre>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants