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

Don't break when parsing html in strings in a highlighted codeblock #95

Open
earlAchromatic opened this issue Jul 30, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@earlAchromatic
Copy link
Contributor

For instance, this (from Notion, codeblock in a toggle) breaks the render very badly:
image

The culprit is here (the blocks html parser):

_mixedHTML(mixedHtml: string) {
    return mixedHtml.replaceAll(/[^<>]+?(?=<\/)/g, (match) => {
      // Must trim or Marked classifies text preceded by tabs as indented code.
      const tokens = marked.lexer(_.trim(match), this.markedOptions)
      return marked.parser(tokens, this.markedOptions)
    })

We could fix our regex or add a condition to avoid anything inside of a set of double quotes. This wouldn't be mixed html, but would just be a string representation.

@earlAchromatic earlAchromatic added the enhancement New feature or request label Jul 30, 2023
@earlAchromatic earlAchromatic added bug Something isn't working and removed enhancement New feature or request labels Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant