JSPM

  • Created
  • Published
  • Downloads 9121534
  • Score
    100M100P100Q219508F
  • License MIT

shiki

Package Exports

  • shiki
  • shiki/dist/index.browser.mjs
  • shiki/dist/onigasm.wasm
  • 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/themes/github-dark.json
  • shiki/themes/github-light.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 shiki
# yarn add shiki
const shiki = require('shiki')

shiki
  .getHighlighter({
    theme: 'nord'
  })
  .then(highlighter => {
    console.log(highlighter.codeToHtml(`console.log('shiki');`, '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');`, 'js')
    document.getElementById('output').innerHTML = code
  })
</script>

Clone shikijs/shiki-starter to play with Shiki, or try it out on Repl.it.

Seen

Contributing

Credits

Sponsorship

If you find Shiki useful, please consider sponsoring my Open Source development. Thank you 🙏

https://github.com/sponsors/octref

License

MIT © Pine Wu