How to get curly quotes with Marked.js
November 30, 2020
Marked.js is a library for parsing Markdown into HTML.
I personally think that curly or âsmartâ quotes look better in writing, like this:
"straight quotes"
âcurly quotesâ
straight apostrophe: they're
curly apostrophe: theyâre
To turn straight quotes into curly quotes when parsing with Marked.js, use the setOptions
function to turn âsmartypantsâ rendering on:
marked.setOptions({ smartypants: true });
marked.parse(/* markdown content */);
Now, marked.parse
will produce HTML with intelligently replaced curly quotes.
Subscribe to my newsletter!
A weekly round-up of new blog posts and updates to projects Iâm working on.