-
Notifications
You must be signed in to change notification settings - Fork 36
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
🚀 Feature: Add an option to disable special character escaping #63
Labels
type: feature
New enhancement or request
Comments
JoshuaKGoldberg
added
type: feature
New enhancement or request
status: in discussion
Not yet ready for implementation or a pull request
labels
Jul 25, 2023
Personally I would be considered about having different behaviour depending on how its called given you can do:
which cannot be detected as a template literal |
Actually having thought about it a bit more, I think that default actually makes sense in reflection of the use-case:
|
JoshuaKGoldberg
removed
the
status: in discussion
Not yet ready for implementation or a pull request
label
Jul 27, 2023
JoshuaKGoldberg
added a commit
that referenced
this issue
Jul 30, 2023
Fixes #26. Fixes #63. As described in #63, this introduces the concept of options with single option, `escapeSpecialCharacters`. The option defaults to: * `true` when called for a template literal's string tag * `false` when called as a function ```js // "\$hello!" dedent.options({ escapeSpecialCharacters: false })` $hello! `; ``` I'd played with allowing passing it in as a first argument instead of a string or template literal strings array, but that got complex. I suppose we can do that as a followup if people really want. cc @G-Rath @sirian - what do you think?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This pulls together #2, #26, #45, #46:
dedent
is used with template literal strings.$
and{
characters are not handled correctly #45 -> fix: consume first level of escaping of$
and{
characters #46dedent
is used as a function, users aren't expecting that special character escapingI think the "right" (or: least unexpected) way would be to add an option with a not-very-savory name like
escapeSpecialCharacters
. The option would default to:true
when called for a template literal stringfalse
when called as a functionProposal:
$
and{
characters #46, to resolve this issue and 26Thoughts @G-Rath @sirian?
The text was updated successfully, but these errors were encountered: