Created
August 11, 2023 15:36
-
-
Save tayiorbeii/da522195ac66b23509b43b26eb393a03 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| let MarkdownIt = await npm("markdown-it") | |
| import shiki from "shiki" | |
| import "@johnlindquist/kit" | |
| // Name: Markdown to HTML (Light Mode) | |
| // Description: Paste Markdown to generate HTML with syntax highlighting | |
| // Author: Taylor Bell | |
| shiki.getHighlighter({ | |
| theme: "light-plus" | |
| }).then(async highlighter => { | |
| let mdown = MarkdownIt({ | |
| html: true, | |
| highlight: (code, lang) => { | |
| return highlighter.codeToHtml(code, {lang}) | |
| } | |
| }) | |
| let inputMd = await editor("Paste Markdown (result will be copied to clipboard)") | |
| const html = mdown.render(inputMd) | |
| const out = ` | |
| <link rel="stylesheet" href="https://unpkg.com/shiki/themes/light-plus.min.css"> | |
| ${html} | |
| ` | |
| await copy(out) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment