You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backticks (`) should be able to exist within codespans (as they do in the base markedjs and in this github issue) as long as the number of backticks used as delimiters is different from the number of backticks in any inner group of backticks.
For this given markdown input:
`codespan```codespan with one backtick (`)```codespan with many backticks (``````)`
The Codespan should remove only the outer backticks:
codespan codespan with one backtick (`) codespan with many backticks (``````)
Instead, all backticks are removed:
<p><code>codespan</code></p><p><code>codespan with one backtick ()</code></p><p><code>codespan with many backticks ()</code></p>
Using text instead of raw fixes it (I've used a custom renderer to test it).
I've made a proposal with the same name as this issue; it changes renderers/Codespan.svelte like this:
<script>
- export let raw+ export let text
</script>
- <code>{raw.replace(/`/g, '')}</code>+ <code>{text}</code>
The text was updated successfully, but these errors were encountered:
I've now realized raw was there for a reason; characters like " seem to be unescaped into their html codes (").
Here are two possible solutions:
Use raw.replace(/^`+|`+$/g, ''); to strip backticks from the beginning and end of the string (you don't have to worry about there being different numbers of backticks at each side; the lexer has already taken care of that). I've proposed it here.
Unescape the html codes: new DOMParser().parseFromString(text, "text/html").documentElement.textContent.
Backticks (`) should be able to exist within codespans (as they do in the base markedjs and in this github issue) as long as the number of backticks used as delimiters is different from the number of backticks in any inner group of backticks.
For this given markdown input:
The Codespan should remove only the outer backticks:
codespan
codespan with one backtick (`)
codespan with many backticks (``````)
Instead, all backticks are removed:
Using
text
instead ofraw
fixes it (I've used a custom renderer to test it).I've made a proposal with the same name as this issue; it changes renderers/Codespan.svelte like this:
The text was updated successfully, but these errors were encountered: