Wednesday, 1 January 2020

Static html generation with prismjs - how to enable line-numbers?

I'm using node.js to generate html files from code, formatting them with prismjs.

const Prism = require('prismjs');
const loadLanguages = require('prismjs/components/');
loadLanguages(['csharp']);
const code = '<a bunch of C# code>';
const html = Prism.highlight(code, Prism.languages.csharp, 'csharp');

This works great. But I want to use the line-numbers plugin and don't see how to make it work. My <pre> has the line-numbers class, and I get a bigger left margin, but no line numbers.



from Static html generation with prismjs - how to enable line-numbers?

No comments:

Post a Comment