Skip to content

fix: handle backslashes in embedded template language reasonably #714

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

Merged
merged 2 commits into from
May 21, 2025

Conversation

kt3k
Copy link
Contributor

@kt3k kt3k commented May 20, 2025

closes #713

This PR updates the handling of template literals with embedded langauges.

This change unescape \\ sequence before applying external formatters, and escape it back after it.

Some css classes needs to use \ to escape it in css level, and that becomes \\ in template literals. The use of \\ causes syntax error in css formatter (malva, See g-plane/malva#35 ). This change avoids that error.

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

Makes sense. LGTM

@dsherret dsherret merged commit 903d7f1 into dprint:main May 21, 2025
3 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.

Need to unescape escape sequences before passing text to embedded formatter
2 participants