https://github.com/fourdim/shiki-tex
A beautiful syntax highlighter for LaTeX code listing based on Shiki.
https://github.com/fourdim/shiki-tex
highlight latex shiki syntax syntax-highlighting
Last synced: about 1 month ago
JSON representation
A beautiful syntax highlighter for LaTeX code listing based on Shiki.
- Host: GitHub
- URL: https://github.com/fourdim/shiki-tex
- Owner: fourdim
- License: mpl-2.0
- Created: 2025-05-10T03:14:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-04-01T22:47:22.000Z (2 months ago)
- Last Synced: 2026-04-30T06:39:53.274Z (about 1 month ago)
- Topics: highlight, latex, shiki, syntax, syntax-highlighting
- Language: TypeScript
- Homepage: https://shiki-tex.vercel.app
- Size: 284 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shiki-tex
A beautiful syntax highlighter for LaTeX code listing based on [Shiki](https://github.com/shikijs/shiki).
[🚀 Playground](https://shiki-tex.vercel.app/)
## Get Started
The [Playground](https://shiki-tex.vercel.app/) offers the simplest way to generate LaTeX code listings:
1. Paste your code into the editor
2. Select your preferred language and theme
3. Copy the generated LaTeX code
4. Paste it back into your LaTeX document
The syntax highlighting will be automatically applied when you compile your LaTeX document.
## Installation
You can also install `shiki-tex` via npm and use it programmatically in your projects:
```bash
npm install shiki-tex
```
## Core API
```ts
import { codeToLaTeX } from 'shiki-tex';
const code = `console.log("Hello, world!");`;
const [content, colorDefs] = await codeToLaTeX(code, {
lang: 'js',
theme: 'light-plus',
escapeInside: ['<@', '@>'],
});
console.log(Array.from(colorDefs.values()).join('\n'));
console.log(content);
```
## License
[MPL 2.0](./LICENSE)