Skip to content

Instantly share code, notes, and snippets.

View lightpohl's full-sized avatar

Josh Pohl lightpohl

View GitHub Profile
@lightpohl
lightpohl / marked-and-prism.js
Last active February 17, 2024 23:06
Use marked and prism.js to parse markdown and add syntax highlighting in Node.js
// Versions: marked v0.6.2, prismjs v1.15.0
let marked = require('marked');
let prism = require('prismjs');
let loadLanguages = require('prismjs/components/');
loadLanguages(['javascript', 'jsx', 'css', 'markup', 'bash', 'json']);
marked.setOptions({
highlight: function(code, lang) {