Skip to content

Instantly share code, notes, and snippets.

@tayiorbeii
Created August 11, 2023 15:36
Show Gist options
  • Save tayiorbeii/da522195ac66b23509b43b26eb393a03 to your computer and use it in GitHub Desktop.
Save tayiorbeii/da522195ac66b23509b43b26eb393a03 to your computer and use it in GitHub Desktop.
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