Skip to content

Instantly share code, notes, and snippets.

View IbrahimTanyalcin's full-sized avatar
☸️
revisiting-old-concepts.reinventing-the-wheel.☸

Ibrahim Tanyalcin IbrahimTanyalcin

☸️
revisiting-old-concepts.reinventing-the-wheel.☸
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) {
@siberex
siberex / base64.js
Created September 17, 2012 19:48
Encodes binary data or UTF strings to base64 (javascript)
/**
* Base64 encoding. Fast enough.
*
*
* Usage example:
* base64("me@sib.li")
* result: "bWVAc2liLmxp"
*
* UTF strings are also accepted.
*