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

fix(yaml) - correct escaping behavior in single-quoted YAML strings #4159

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

guuido
Copy link
Contributor

@guuido guuido commented Nov 4, 2024

Fixes wrong escaping behavior in single-quoted strings

Resolves #4068

Changes

Before, backslashes in single-quoted strings were incorrectly treated as escape characters:

image

Now single-quoted strings follow YAML specification where only single quotes can be escaped (by doubling them):

image

Checklist

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

Copy link

github-actions bot commented Nov 4, 2024

Build Size Report

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

2 files changed

Total change +38 B

View Changes
file base pr diff
es/languages/yaml.min.js 876 B 895 B +19 B
languages/yaml.min.js 877 B 896 B +19 B

src/languages/yaml.js Outdated Show resolved Hide resolved
src/languages/yaml.js Outdated Show resolved Hide resolved
@joshgoebel
Copy link
Member

Lets also make sure we add a single quote escaping to our markup tests - esp if we go with char.escape.

Copy link

github-actions bot commented Nov 6, 2024

Build Size Report

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

2 files changed

Total change +68 B

View Changes
file base pr diff
es/languages/yaml.min.js 876 B 910 B +34 B
languages/yaml.min.js 877 B 911 B +34 B

@joshgoebel joshgoebel merged commit e11c88b into highlightjs:main Nov 6, 2024
19 checks passed
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) Handling of '\'
2 participants