markdown-to-pug

1.0.11 • Public • Published

Markdown To PugJS

Convert your Markdown to PugJS

https://alexandremasy.github.io/markdown-to-pug/

CircleCI

Why?

Sometimes you like the simplicity of markdown to just express whatever you want to say, but want to keep control on how it will look like. This is what it is about, get control over the output while adding simple ways to take advantage of the PugJS functionalities like mixins and layout.

Install

NodeJS

npm --save install markdown-to-pug

or

yarn add markdown-to-pug

Dependencies

API

constructor(options)

Parameters

Property Type Description
options Object An object with the options.

Options

Option Description
newline Newline definition. Default value: \n
space Space definition. Default value: \t
linkify Allow the use of Linkify by MarkdownIt. Default value: true
typographer Allow the use of Typographer by MarkdownIt. Default value: true
langPrefix Prefix to use to generate class on code block. Default value: language-

.render(src)

Parameters

Property Type Description
src String The Markdown you like to convert

Return

Type Description
String The PugJS String

.md

The instance of markdown-it. Use it to add plugin support.

Example

var md2pug = new (require('markdown-to-pug'))();
 
var md = `![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")`;
var pug = md2pug.render(md);

Mixin support

With the folliwing PugJS mixin

mixin list
  ul
    li first
    li second
    li third    
<!-- +list -->

Layout support

<!-- extends layout.pug -->
 
<!-- block content -->
# Title

will yield to

extend layout.pug
 
block content
  h1 Title

Readme

Keywords

none

Package Sidebar

Install

npm i markdown-to-pug

Weekly Downloads

31

Version

1.0.11

License

MIT

Last publish

Collaborators

  • alexandremasy