-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Markdown-it-py plugin to add language-none class code fences without …
…a language. Always load Prismjs styles. Consequent changes in JS flow and tests.
- Loading branch information
1 parent
c60b1e2
commit d63c59b
Showing
5 changed files
with
25 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Markdown-it-py plugin to add language-none class to code fence tokens.""" | ||
|
||
from markdown_it import MarkdownIt | ||
from markdown_it.renderer import RendererHTML | ||
|
||
|
||
def fence_extend_plugin(md: MarkdownIt, **opts) -> None: | ||
def fence(self, tokens, idx, options, env): | ||
output = RendererHTML.fence(self, tokens, idx, options, env) | ||
output = output.replace('<pre><code>', '<pre><code class="language-none">') | ||
return output | ||
|
||
md.add_render_rule('fence', fence) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters