— The VS Code Compatible Syntax Highlighting API.

Remark JS Client

🚨 This client is still very much a work in progress. Please open issues! 🚨

View it on github at

The Torchlight Remark client is a JS plugin for Remark, a markdown processor powered by plugins.


To install, require the package using NPM or Yarn

1npm i remark-torchlight
1yarn add remark-torchlight

Adding the Plugin

To add the plugin, you can import remark-torchlight and use it in your markdown chain:

1import remark from 'remark'
2import html from 'remark-html'
+import torchlight from 'remark-torchlight'
5export default async function markdownToHtml(markdown) {
6 return await remark()
7 .use(html)
+ .use(torchlight)
9 .process(markdown)
10 .toString()


To configure your Torchlight integration, you can pass through an options object with a config key:

1export default async function markdownToHtml(markdown) {
2 return await remark()
3 .use(html)
4 .use(torchlight, {
5 // All API configuration goes under `config`.
6 config: {
7 token: 'my-token',
8 theme: 'material-theme-palenight'
9 }
10 })
11 .process(markdown)
12 .toString()

If you're running in Node, you can pass a string through to a configuration file location:

1export default async function markdownToHtml(markdown) {
2 return await remark()
3 .use(html)
4 .use(torchlight, {
5 // Read from a config file.
6 config: 'torchlight.config.js'
7 })
8 .process(markdown)
9 .toString()

Available Configuration Options

These are the available options you can use to configure your Torchlight highlighting.

2 // Your token from
3 token: 'my-test-token',
5 // The Torchlight client caches highlighted code blocks. Here you
6 // can define which directory you'd like to use. You'll likely
7 // want to add this directory to your .gitignore. Set to
8 // `false` to use an in-memory cache. You may also
9 // provide a full cache implementation.
10 cache: 'cache',
12 // Which theme you want to use. You can find all of the themes at
14 theme: 'material-theme-palenight',
16 // The Host of the API.
17 host: '',
19 // Global options to control block-level settings.
21 options: {
22 // Turn line numbers on or off globally.
23 lineNumbers: false,
25 // Control the `style` attribute applied to line numbers.
26 // lineNumbersStyle: '',
28 // Turn on +/- diff indicators.
29 diffIndicators: true,
31 // If there are any diff indicators for a line, put them
32 // in place of the line number to save horizontal space.
33 diffIndicatorsInPlaceOfLineNumbers: true,
35 // When lines are collapsed, this is the text that will
36 // be shown to indicate that they can be expanded.
37 // summaryCollapsedIndicator: '...',
38 },

Torchlight Token

Set your token from (Torchlight is completely free for personal and open source projects.) It defaults to the TORCHLIGHT_TOKEN environment variable. You can hardcode it if you please.


Torchlight caches code blocks based on their contents and configuration, so that blocks that have already been rendered won't be rendered again. Use the cache key to control the directory in which the cache lives.

If you'd prefer to not use a file cache, you can set this to false and Torchlight will use an in-memory cache, which is only useful when watching files.

You can also provide your own cache implementation object. Take a look at the Memory Cache to see what methods you need to implement.


You can change the theme of all your code blocks by adjusting the theme key in your configuration. To view all of the themes provided by Torchlight, head over to


These are options that you can set to control every code block on your site. Read more in the options section.

A Hammerstone, LLC Product.
Built with Love & Care by Aaron in Dallas, Texas.