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

Markdown intercepts indented HTML blocks #357

Closed
xduseko opened this issue Mar 13, 2017 · 11 comments
Closed

Markdown intercepts indented HTML blocks #357

xduseko opened this issue Mar 13, 2017 · 11 comments
Assignees
Labels

Comments

@xduseko
Copy link

xduseko commented Mar 13, 2017

Deeply nested HTML tags are not rendered properly, markdown somehow intercepts.

<div>
  <div>
    <div>
      <div>
        text
      </div>
      <div>
        text
      </div>
    </div>
  </div>
</div>

Renders into

text
text
</div>

See codepen http://codepen.io/anon/pen/wJedgq

@obedm503
Copy link

remember that indentation affects how the markdown is rendered

http://codepen.io/anon/pen/aJwLBx

@xduseko
Copy link
Author

xduseko commented Mar 14, 2017

It shouldn't be processed at all unless I use markdown attribute.

<div markdown>
  <div>
    <div>
      <div>
        text
      </div>
      <div>
        text
      </div>
    </div>
  </div>
</div>

@tivie tivie self-assigned this Mar 15, 2017
@tivie
Copy link
Member

tivie commented Mar 28, 2017

This is indeed a bug but a hard one to tackle, due to efficiency constraints. I have a fix, but it slows down the parser considerably.

@tivie
Copy link
Member

tivie commented Mar 30, 2017

Until I can find a suitable fix, that doesn't slow down the parser too much, the workaround is not indenting html code.

@petebacondarwin
Copy link

Why do you have this ^ {0,3} constraint on the start tags?

text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<' + blockTags[i] + '\\b[^>]*>', '</' + blockTags[i] + '>', 'gim');

It can't be to avoid capturing indented code blocks as these are hashed away already, no?

@petebacondarwin
Copy link

Ah I see that indented code blocks are processed later.

@tivie
Copy link
Member

tivie commented Apr 8, 2017

Yes, they have to be processed AFTER HTML is hashed

@petebacondarwin
Copy link

@tivie - you talk about performance issues with your possible solution. Can you give me a pointer to how to run the performance tests as I would be interested in offering a PR for this issue but not if my solution also suffers from performance degradation.

@tivie
Copy link
Member

tivie commented Apr 9, 2017

If you install dev dependencies, you can run the command grunt performance and compare the results with previous implementations

@tivie
Copy link
Member

tivie commented Apr 9, 2017

Although performance degradation, in this case, is best seen with documents with "indented HTML".

@tivie
Copy link
Member

tivie commented May 28, 2017

This should (hopefully) be fixed now, without much performance issues.

@tivie tivie closed this as completed in 6fbc072 Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants