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

Handle escaped backticks is wrong when dedent used as function #26

Closed
sirian opened this issue Dec 26, 2018 · 1 comment · Fixed by #65
Closed

Handle escaped backticks is wrong when dedent used as function #26

sirian opened this issue Dec 26, 2018 · 1 comment · Fixed by #65
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(

Comments

@sirian
Copy link

sirian commented Dec 26, 2018

dedent("\\`") === "`"

Bug in this line https://github.com/dmnd/dedent/blob/master/dedent.js#L17

@JoshuaKGoldberg
Copy link
Collaborator

👋 @sirian! Recognizing this is a few years old - if it's still something you have both time and interest for, I posted a proposal for adding an option in #63. Seeking input if you have time!

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
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants