Closed galopin closed 11 months ago
Output comparison:
Appears to be limited to uninterpolated backticks in HTML cells.
I believe the following is happening here:
htl.html`<i>\`\`</i>`
\`
as two separate characters.That's it. A clumsy but temporarily effective work-around would be to use a Markdown cell to prevent this from happening… Thank you! 🍺
This is a general limitation of tagged template literals that use the raw value of the string.
The only way to interpolate a backtick into a raw tagged template literal is to pass it as an interpolated value:
`a\`b` // a`b
String.raw`a\`b` // a\`b (literal backslash)
String.raw`a${'`'}b` // a`b
It's true that library maintainers can implement their own logic to transform \`
into `
within raw string segments, but that's not the default behavior.
This is not a bug in HTL but rather in the Observable compiler. Thank you for the report; I will file an appropriate internal bug and transfer this to the feedback repository.
Apologies for the delay here. We have a fix for this now and it should be released next week.
Excellent!
Confirmed that this is now fixed. Thank you for the report!
Describe the bug
It seems that backquotes are automatically escaped in HTML cells ⁉️
I don't get the rationale behind this behavior…
To Reproduce
\`\`
``
Compare the output…
It gets even worse when querying the text content of the above nodes:
Array(2) [ 0: "\\`\\`" 1: "``" ]
Expected behavior
I expect the output to be the same whether I use a JavaScript or HTML cell, e.g.
``