highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

fix(app): #4101 Fixes parser to parse new lines directly to output

Open mohit-nagaraj opened this issue 1 year ago • 3 comments

Fixes parser to parse new lines directly to output.

Closes #4101

Changes

This modification to the addText method ensures that newline characters are properly handled and preserved in the token tree

Checklist

  • [ ] Added markup tests, or they don't apply here because...
  • [ ] Updated the changelog at CHANGES.md

mohit-nagaraj avatar Oct 09 '24 07:10 mohit-nagaraj

I think the needed fix here is much simpler. The issue (in my testing) was only when we have an illegal match on $ (end of line) that we then insert no content since technically $ matches an empty string not the \n itself... If you'd like to help you could add a markup test with a problematic sample of this - then I'll throw my simper fix and we'll see if things are still green.

joshgoebel avatar Oct 09 '24 22:10 joshgoebel

Could you please test https://github.com/highlightjs/highlight.js/pull/4142

joshgoebel avatar Oct 20 '24 20:10 joshgoebel

If you believe you have test cases that my PR doesn't solve, just point me to them and I'll take another look.

joshgoebel avatar Oct 20 '24 20:10 joshgoebel

@mohit-nagaraj ping. Could you test my fix against your test cases?

joshgoebel avatar Oct 31 '24 20:10 joshgoebel

I believe this is closed by https://github.com/highlightjs/highlight.js/pull/4142

joshgoebel avatar Dec 14 '24 14:12 joshgoebel