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

(markdown) no support for 4 backticks to escape code including 3 backticks #2350

Closed
cjh9 opened this issue Jan 10, 2020 · 6 comments · Fixed by #2382
Closed

(markdown) no support for 4 backticks to escape code including 3 backticks #2350

cjh9 opened this issue Jan 10, 2020 · 6 comments · Fixed by #2382
Labels
enhancement An enhancement or new feature help welcome Could use help from community language

Comments

@cjh9
Copy link

cjh9 commented Jan 10, 2020

Highlight version: 9.17.0
Built from source, last commit 701184e

Input:

code = "Code
================================
``` py
a = 'This is a code block in python'
```
`this is inline code` in a paragraph

Questions
================================
"

Output:

hljs.highlight('markdown', code).value

Results in output:

"<span class="hljs-section">Code
================================</span>
<span class="hljs-code">```</span> py
a = 'This is a code block in python'
<span class="hljs-code">```
`this is inline code` in a paragraph

Questions
================================
</span>"
@joshgoebel
Copy link
Member

joshgoebel commented Jan 11, 2020

Our rules say that the end quotes MUST start on a new line (for triple quotes). Is this not correct?

@joshgoebel joshgoebel changed the title Markdown possible error in highlight (markdown) possible error with triple backticks Jan 11, 2020
@cjh9
Copy link
Author

cjh9 commented Jan 12, 2020

In this case I'm surrounding the block with four backticks, and explaining markdown:

```` md
Code
================================
``` py
a = 'This is a code block in python'
```
`this is inline code` in a paragraph

Questions
================================
````

But only the above goes into the highlighter.

@joshgoebel joshgoebel added enhancement An enhancement or new feature help welcome Could use help from community labels Jan 15, 2020
@joshgoebel
Copy link
Member

I'd say the real problem is we don't support four backticks... so those are probably just registering as jumping in and out of normal strings, which is never going to work with. :-)

@joshgoebel joshgoebel changed the title (markdown) possible error with triple backticks (markdown) no support for 4 backticks to escape code including 3 backticks Jan 15, 2020
@joshgoebel
Copy link
Member

In this case I'm surrounding the block with four backticks, and explaining markdown:

Is there someplace I can find this 4 backpack syntax documented?

@hlovdal
Copy link

hlovdal commented Jan 9, 2022

The four (N+1) backticks syntax is supposed to make it easier to embed code with three (N) backticks inside.

https://bookdown.org/yihui/rmarkdown/markdown-syntax.html
https://github.github.com/gfm/

@joshgoebel
Copy link
Member

Thanks, I've since used them. :-) This should work find now since #2382.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature help welcome Could use help from community language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants