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 March 8, 2025 16:19
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) {