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

HTML parsing issue? #507

Closed
greggman opened this issue Nov 11, 2014 · 3 comments
Closed

HTML parsing issue? #507

greggman opened this issue Nov 11, 2014 · 3 comments

Comments

@greggman
Copy link

I ran into this issue. Here's some markdown

tstfoo

<div class="webgl_bottombar">
a = b * c;
var displayWidth  = gl.canvas.clientWidth  * realToCSSPixels;
var displayHeight = gl.canvas.clientHeight * realToCSSPixels;
</div>

And here's what gets generated

<p>tstfoo</p>
<div class="webgl_bottombar">
a = b <em> c;
var displayWidth  = gl.canvas.clientWidth  </em> realToCSSPixels;
var displayHeight = gl.canvas.clientHeight * realToCSSPixels;
</div>

Is that expected? I thought markdown was supposed to pull out the HTML so those * shouldn't become <em> marks.

Here's a test

var marked  = require('marked');

var content = [
'tstfoo',
'',
'<div class="webgl_bottombar">',
'a = b * c;',
'var displayWidth  = gl.canvas.clientWidth  * realToCSSPixels;',
'var displayHeight = gl.canvas.clientHeight * realToCSSPixels;',
'</div>',
].join("\n");

var html = marked(content);
console.log(html);
@rymohr
Copy link

rymohr commented Mar 9, 2015

Related to #378.

@greggman
Copy link
Author

Here's another parsing issue

var marked  = require('marked');

marked.setOptions({
  pedantic: true,  // true or false this doesn't matter.
});

var content = [
'some markdown',
'',
'<iframe src="someurl.html"></iframe>',
'<a href="someurl.html">foo</a>',
'',
'    should be code',
'',
'<iframe src="someurl.html"></iframe>',
'',
'some markdown',
'',
].join("\n");

var html = marked(content);
console.log(html);

The part ' should be code', does not get turned into code. In fact adding some console.logs to marked.js I see that it sees

<iframe src="someurl.html"></iframe>
<a href="someurl.html">foo</a>

    should be code

<iframe src="someurl.html"></iframe>

as one block of HTML instead of 2 blocks of HTML and a block of markdown in the middle.

Changing it to

<iframe src="someurl.html"></iframe>
<a href="someurl.html">foo</a>

some markdown

    should be code

some more markdown

<iframe src="someurl.html"></iframe>

doesn't help.

Adding <div>s does

<div>
  <iframe src="someurl.html"></iframe>
  <a href="someurl.html">foo</a>
</div>

some markdown

    should be code

some more markdown

<div>
  <iframe src="someurl.html"></iframe>
</div>

now produces the correct result. Any idea how to get it to work without the divs?

@joshbruce
Copy link
Member

#985

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

3 participants