-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: upgrade shiki and use markdownit
- Loading branch information
Showing
13 changed files
with
368 additions
and
923 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
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,33 @@ | ||
import { getHighlighter } from "shiki"; | ||
import MarkdownIt from "markdown-it"; | ||
import Shiki from "@shikijs/markdown-it"; | ||
import componentPartyShikiTheme from "./componentPartyShikiTheme.js"; | ||
|
||
const highlighter = await getHighlighter({ | ||
theme: componentPartyShikiTheme, | ||
langs: ["javascript", "svelte", "html", "hbs", "tsx", "jsx", "vue", "marko"], | ||
}); | ||
|
||
const md = MarkdownIt({ | ||
html: true, | ||
}); | ||
|
||
md.use( | ||
await Shiki({ | ||
theme: componentPartyShikiTheme, | ||
}) | ||
); | ||
|
||
export async function codeToHighlightCodeHtml(code, lang) { | ||
const html = await highlighter.codeToHtml(code, { | ||
lang, | ||
theme: componentPartyShikiTheme, | ||
}); | ||
|
||
return html; | ||
} | ||
|
||
export async function markdownToHighlightedHtml(markdownText) { | ||
const html = md.render(markdownText); | ||
return html; | ||
} |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.