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

added fix for newline and updated tests #4111

Closed
wants to merge 4 commits into from

Conversation

Dxuian
Copy link
Contributor

@Dxuian Dxuian commented Sep 1, 2024

Resolves #4090
before
beforebig
beforeexample
beforesmall
after:
afterbig
afterexaple
aftersmall

Checklist

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

Copy link

github-actions bot commented Sep 1, 2024

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

3 files changed

Total change +3 B

View Changes
file base pr diff
es/core.min.js 8.18 KB 8.18 KB +1 B
es/highlight.min.js 8.18 KB 8.18 KB +1 B
highlight.min.js 8.22 KB 8.22 KB +1 B

Copy link

github-actions bot commented Sep 6, 2024

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

3 files changed

Total change +7 B

View Changes
file base pr diff
es/core.min.js 8.18 KB 8.18 KB +2 B
es/highlight.min.js 8.18 KB 8.18 KB +2 B
highlight.min.js 8.22 KB 8.22 KB +3 B

Copy link

github-actions bot commented Sep 7, 2024

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

3 files changed

Total change +3 B

View Changes
file base pr diff
es/core.min.js 8.18 KB 8.18 KB +1 B
es/highlight.min.js 8.18 KB 8.18 KB +1 B
highlight.min.js 8.22 KB 8.22 KB +1 B

// Optimized block scalar handling to avoid polynomial backtracking
const BLOCK_SCALAR = {
className: 'string',
begin: /[|>][-+\d]*\s*$/, // Block scalar indicator with modifiers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason the regex here around +-number is much fuzzier than the tighter one below?

Copy link
Contributor Author

@Dxuian Dxuian Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you referring to the regex on line 113 and 126 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referring to this looking much more correct:

'[\\|>]([-+]?[0-9]*)?[ ]*\\n'

ie, +- followed by digits, etc...

This regest would allow all sorts of -43+23423---13+++...

{ // multi line string
// Blocks start with a | or > followed by a newline
//
// Indentation of subsequent lines must be the same to
// be considered part of the block
className: 'string',
begin: '[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*'
begin: '[\\|>]([-+]?[0-9]*)?[ ]*\\n', // Support for block string indicators
relevance: 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have BLOCK_SCALAR which cases is this covering again?

@joshgoebel
Copy link
Member

ping

@joshgoebel
Copy link
Member

Closing for inactivity - this can be reopened at any time when you have time to work on it.

@joshgoebel joshgoebel closed this Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(YAML) Multiline strings don't support empty lines
2 participants