1.0.11 • Published 6 years ago

markdown-to-pug v1.0.11

Weekly downloads
23
License
MIT
Repository
github
Last release
6 years ago

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

PropertyTypeDescription
optionsObjectAn object with the options.

Options

OptionDescription
newlineNewline definition. Default value: \n
spaceSpace definition. Default value: \t
linkifyAllow the use of Linkify by MarkdownIt. Default value: true
typographerAllow the use of Typographer by MarkdownIt. Default value: true
langPrefixPrefix to use to generate class on code block. Default value: language-

.render(src)

Parameters

PropertyTypeDescription
srcStringThe Markdown you like to convert

Return

TypeDescription
StringThe 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
1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago