Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dcdunkan/deno_shiki
Shiki ported to Deno
https://github.com/dcdunkan/deno_shiki
deno shiki shiki-highlighter
Last synced: 2 months ago
JSON representation
Shiki ported to Deno
- Host: GitHub
- URL: https://github.com/dcdunkan/deno_shiki
- Owner: dcdunkan
- License: mit
- Created: 2022-09-12T20:07:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-15T11:44:43.000Z (over 2 years ago)
- Last Synced: 2024-10-04T14:21:12.173Z (3 months ago)
- Topics: deno, shiki, shiki-highlighter
- Language: TypeScript
- Homepage: https://deno.land/x/shiki
- Size: 1.04 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![](./assets/readme_image.png)
# Shiki
Shiki is a beautiful Syntax Highlighter. [Demo](http://shiki.matsu.io).
Deno port of [Shiki main repository](https://github.com/shikijs/shiki) and the
packages (except the Vuepress plugin). Give the original repository a star! All
credits goes to the actual authors and maintainers.```ts
import { getHighlighter } from "https://deno.land/x/shiki/shiki/mod.ts";const highlighter = await getHighlighter({ theme: "nord" });
const code = `console.log("A beautiful Syntax Highlighter.");`;
const highlighted = highlighter.codeToHtml(code, { lang: "js" });
console.log(highlighted);
```It is recommended to set a local or remote oniguruma WASM file by yourself. By
default it is set to the [onig.wasm](./assets/onig.wasm) file from this
repository. You can find the origin file
[here](https://github.com/microsoft/vscode-oniguruma/blob/v1.6.2/out/onig.wasm).To configure one by yourself:
```ts
import { setWasm } from "https://deno.land/x/shiki/shiki/mod.ts";// Local file
await setWasm("./local_onig_wasm_file.wasm");
// Remote file (fetched before continuing)
await setWasm(
"https://raw.githubusercontent.com/microsoft/vscode-oniguruma/v1.6.2/out/onig.wasm",
);// ... Rest of your code
```### Modules
This repository contains the following ported packages.
- [Shiki](./shiki)
- [SVG Renderer](./renderer/svg)
- [Path Renderer](./renderer/path)Modules are confirmed as working as far as I've tested.
Go to the [examples](./examples/) directory to play with Shiki, or try it out on
[a Deno Deploy playground](https://dash.deno.com/playground/shiki-pg).