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

(YAML) Multiline strings don't support empty lines

Open dmelikhov opened this issue 6 months ago • 3 comments

Describe the issue YAML multiline strings break on first empty line even when the rest of the block is properly indented.

Which language seems to have the issue? YAML

Are you using highlight or highlightAuto? highlight

Sample Code to Reproduce

foo:
  bar: |
    still: a string

    not: anymore

Additional context I was able to workaround the issue by replacing this regex with

[\\|>]([1-9]?[+-])?[ ]*\\n+( +)[^ ][^\\n]*\\n+(\\2[^\\n]+\\n*)*

It's not perfect and still has some false positives/negatives but should cover more valid cases.

dmelikhov avatar Aug 09 '24 00:08 dmelikhov