A beautiful syntax highlighter for LaTeX code listing based on Shiki.
The Playground offers the simplest way to generate LaTeX code listings:
- Paste your code into the editor
- Select your preferred language and theme
- Copy the generated LaTeX code
- Paste it back into your LaTeX document
The syntax highlighting will be automatically applied when you compile your LaTeX document.
You can also install shiki-tex via npm and use it programmatically in your projects:
npm install shiki-teximport { 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);