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

Inline html tags followed by a newline break rich text rendering #133

Closed
b-kelly opened this issue May 26, 2022 · 1 comment
Closed

Inline html tags followed by a newline break rich text rendering #133

b-kelly opened this issue May 26, 2022 · 1 comment
Labels
bug Something isn't working commonmark Relates to commonmark round-tripping or syntax html Issue with html parsing or rendering
Milestone

Comments

@b-kelly
Copy link
Collaborator

b-kelly commented May 26, 2022

Describe the bug

Reported on MSE.

When inline html tags appear on their own line, rich text mode parses the result incorrectly.

https://meta.stackexchange.com/q/379037/395497

To Reproduce

  1. In markdown mode, add the following content:
Any text here, doesn't matter what.

<sub>
Any text is fine here, but note the html on their own lines
</sub>
  1. Switch over to rich text mode
  2. Note that the editor is completely empty

Expected behavior

At the very least, the opening paragraph and the text between the tags should be appearing. The tags should either be:

  1. shown as plain text
  2. used as intended to add a sub mark to the text inside

Additional context

This looks like an issue in the way we're parsing inline html tokens. The markdown-it parser demo parses the tokens as:

p_open + (inline > text) + p_close +
html_block

while we're parsing them as:

p_open + (inline > text) + p_close +
p_open + (inline > sub_open) + p_close +
p_open + (inline > text) + p_close +
p_open + (inline > sub_close) + p_close +
@b-kelly b-kelly added bug Something isn't working commonmark Relates to commonmark round-tripping or syntax html Issue with html parsing or rendering labels May 26, 2022
@b-kelly b-kelly added this to the Beta 1 milestone May 26, 2022
@b-kelly b-kelly closed this as completed in 4f0d9f6 Jun 1, 2022
@b-kelly
Copy link
Collaborator Author

b-kelly commented Jun 1, 2022

Updated code to only parse inline html tags if the opening and closing tags are on the same line

b-kelly added a commit that referenced this issue Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working commonmark Relates to commonmark round-tripping or syntax html Issue with html parsing or rendering
Projects
Status: Done
Development

No branches or pull requests

1 participant