
Company News
Socket Joins the OpenJS Foundation
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.
marked-extras
Advanced tools
Extras for marked.js. Utils, language definitions, templates for custom headings and sensible defaults.

Extras, utils, language definitions and defaults for marked.js
If you find a bug or have a feature request, please create an issue.
Use npm to install the package
npm i marked-extras --save
var marked = require('marked');
var extras = require('marked-extras');
// Example node module
module.exports = function (str, options) {
options = options || {};
// Initialize marked extras
extras.init(options);
// Set marked.js options
marked.setOptions(extras.markedDefaults);
// do stuff...
// ...
// Convert markdown to HTML
return marked(str);
};
Also be sure to add the highlight.js scripts to your HTML:
<script src="js/highlight.js"></script>
<!-- or, a customized version -->
<script src="js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
The following example shows the actual defaults used in this lib, and how they can be customized:
var opts = {
renderer: renderer,
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
// highlight.js options
prefix: 'lang-',
tabReplace: ' ',
highlight: function (code, lang) {
console.log(languages[lang]);
try {
if (languages[lang]) {
lang = languages[lang];
} else {
return code;
}
return hljs.highlight(lang, code).value;
} catch(e) {
return hljs.highlightAuto(code).value;
}
}
};
var markedOpts = _.extend(extras.markedDefaults, opts);
// Define marked.js options
marked.setOptions(markedOpts);
In lieu of a formal styleguide, take care to maintain the existing coding style.
Jon Schlinkert
Brian Woodward
Copyright (c) 2014 Jon Schlinkert, Brian Woodward, contributors. Released under the MIT license
FAQs
Extras for marked.js. Utils, language definitions, templates for custom headings and sensible defaults.
The npm package marked-extras receives a total of 73 weekly downloads. As such, marked-extras popularity was classified as not popular.
We found that marked-extras demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.