Socket
Socket
Sign inDemoInstall

metalsmith-markdown

Package Overview
Dependencies
9
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-markdown


Version published
Weekly downloads
1.4K
decreased by-28.39%
Maintainers
3
Install size
142 kB
Created
Weekly downloads
 

Changelog

Source

[1.3.0][] - 2019-10-30

  • Updated packages
    • marked v0.7.0
    • eslint
    • eslint-config-prettier
    • eslint-plugin-prettier
    • mocha
    • prettier

Readme

Source

metalsmith-markdown

npm version code style: prettier metalsmith: core plugin

Known Vulnerabilities

A Metalsmith plugin to convert markdown files.

Installation

$ npm install metalsmith-markdown

CLI Usage

Install via npm and then add the metalsmith-markdown key to your metalsmith.json plugins with any Marked options you want, like so:

{
  "plugins": {
    "metalsmith-markdown": {
      "pedantic": false,
      "gfm": true,
      "tables": true,
      "breaks": false,
      "sanitize": false,
      "smartLists": true,
      "smartypants": false,
      "xhtml": false
    }
  }
}

Javascript Usage

Pass options to the markdown plugin and pass it to Metalsmith with the use method:

var markdown = require('metalsmith-markdown');
var highlighter = require('highlighter');

metalsmith.use(markdown({
  highlight: function(code) {
    return require('highlight.js').highlightAuto(code).value;
  },
  pedantic: false,
  gfm: true,
  tables: true,
  breaks: false,
  sanitize: false,
  smartLists: true,
  smartypants: false,
  xhtml: false
}));

Custom Renderer

metalsmith-markdown uses marked, so to create a custom renderer get an instance of marked.Renderer()

var markdown = require('metalsmith-markdown');
var marked = require('marked');
var markdownRenderer = new marked.Renderer();

markdownRenderer.image = function (href, title, text) {
return `
  <figure>
    <img src="${href}" alt="${title}" title="${title}" />
    <figcaption>
      <p>${text}</p>
    </figcaption>
  </figure>`;
};

metalsmith.use(markdown({
  renderer: markdownRenderer,
  pedantic: false,
  gfm: true,
  tables: true,
  breaks: false,
  sanitize: false,
  smartLists: true,
  smartypants: false,
  xhtml: false
}));

History

History

License

MIT

FAQs

Last updated on 30 Oct 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc