Package Exports
- shiki
- shiki/dist/index.browser.mjs
- shiki/dist/index.esm.js
- shiki/dist/index.js
- shiki/languages/html.tmLanguage.json
- shiki/languages/javascript.tmLanguage.json
- shiki/languages/json.tmLanguage.json
- shiki/languages/markdown.tmLanguage.json
- shiki/languages/typescript.tmLanguage.json
- shiki/languages/vue.tmLanguage.json
- shiki/languages/yaml.tmLanguage.json
- shiki/themes/github-dark.json
- shiki/themes/github-light.json
- shiki/themes/monokai.json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (shiki) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Shiki
Shiki is a beautiful Syntax Highlighter. Demo.
Usage
npm i shikiconst shiki = require('shiki')
shiki
.getHighlighter({
theme: 'nord'
})
.then(highlighter => {
console.log(highlighter.codeToHtml(`console.log('shiki');`, { lang: 'js' }))
})
// <pre class="shiki" style="background-color: #2e3440"><code>
// <!-- Highlighted Code -->
// </code></pre><script src="https://unpkg.com/shiki"></script>
<script>
shiki
.getHighlighter({
theme: 'nord'
})
.then(highlighter => {
const code = highlighter.codeToHtml(`console.log('shiki');`, { lang: 'js' })
document.getElementById('output').innerHTML = code
})
</script>Clone shikijs/shiki-starter to play with Shiki, or try it out on Repl.it.
Seen
- Shiki Docs: https://shiki.matsu.io
- Interactive Demo on CodeSandbox (with Next.js): https://codesandbox.io/s/shiki-next-js-cir0y
- VS Code website, such as in the Notebook API page.
- TypeScript website, such as in the Basic Types documentation page.
- Markdown Preview Shiki Highlighting, a VS Code plugin to use Shiki's highlighting in Markdown preview.
- Shiki LaTeX, a Shiki renderer for LaTeX. Compatible with minted, replacing Pygments.
- Fatih Kalifa's website
- Blockstack Documentation
Contributing
Credits
- Shiki uses vscode-oniguruma
- A lot of code is based on vscode-textmate
Sponsorship
If you find Shiki useful, please consider sponsoring my Open Source development. Thank you 🙏
https://github.com/sponsors/octref
License
MIT © Pine Wu