-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly handle yaml highlighting (#96)
- Loading branch information
Showing
8 changed files
with
88 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import katex from "katex"; | |
|
||
import { CSS, KATEX_CLASSES, KATEX_CSS } from "./style.ts"; | ||
export { CSS, KATEX_CSS, Marked }; | ||
import "https://esm.sh/[email protected]/components/prism-yaml"; | ||
|
||
Marked.marked.use(markedAlert()); | ||
Marked.marked.use(gfmHeadingId()); | ||
|
@@ -254,6 +255,8 @@ export function render(markdown: string, opts: RenderOptions = {}): string { | |
"line", | ||
"deleted", | ||
"inserted", | ||
"key", | ||
"atrule", | ||
...(opts.allowMath ? KATEX_CLASSES : []), | ||
], | ||
a: ["anchor"], | ||
|
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,18 @@ | ||
<div class="highlight highlight-source-yaml notranslate"><pre><span class="token key atrule">doe</span><span class="token punctuation">:</span> <span class="token string">"a deer, a female deer"</span> | ||
<span class="token key atrule">ray</span><span class="token punctuation">:</span> <span class="token string">"a drop of golden sun"</span> | ||
<span class="token key atrule">pi</span><span class="token punctuation">:</span> <span class="token number">3.14159</span> | ||
<span class="token key atrule">xmas</span><span class="token punctuation">:</span> <span class="token boolean">true</span> | ||
<span class="token key atrule">french-hens</span><span class="token punctuation">:</span> <span class="token number">3</span> | ||
<span class="token key atrule">calling-birds</span><span class="token punctuation">:</span> | ||
<span class="token punctuation">-</span> huey | ||
<span class="token punctuation">-</span> dewey | ||
<span class="token punctuation">-</span> louie | ||
<span class="token punctuation">-</span> fred | ||
<span class="token key atrule">xmas-fifth-day</span><span class="token punctuation">:</span> | ||
<span class="token key atrule">calling-birds</span><span class="token punctuation">:</span> four | ||
<span class="token key atrule">french-hens</span><span class="token punctuation">:</span> <span class="token number">3</span> | ||
<span class="token key atrule">golden-rings</span><span class="token punctuation">:</span> <span class="token number">5</span> | ||
<span class="token key atrule">partridges</span><span class="token punctuation">:</span> | ||
<span class="token key atrule">count</span><span class="token punctuation">:</span> <span class="token number">1</span> | ||
<span class="token key atrule">location</span><span class="token punctuation">:</span> <span class="token string">"a pear tree"</span> | ||
<span class="token key atrule">turtle-doves</span><span class="token punctuation">:</span> two</pre></div> |
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,20 @@ | ||
```yaml | ||
doe: "a deer, a female deer" | ||
ray: "a drop of golden sun" | ||
pi: 3.14159 | ||
xmas: true | ||
french-hens: 3 | ||
calling-birds: | ||
- huey | ||
- dewey | ||
- louie | ||
- fred | ||
xmas-fifth-day: | ||
calling-birds: four | ||
french-hens: 3 | ||
golden-rings: 5 | ||
partridges: | ||
count: 1 | ||
location: "a pear tree" | ||
turtle-doves: two | ||
``` |
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