2.0.0 • Published 4 years ago

markdown-to-pug-cli v2.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Markdown to Pug CLI

Convert your markdown code to pug easily from the command line.

Install

Globally

npm i -g markdown-to-pug-cli

Local as dev dependency

npm i --save-dev markdown-to-pug-cli

Usage

$ node md2pug -h
Usage: md2pug [options]

Convert your markdown files into pug code

Options:
  -v, --version          output the current version
  -a, --anchor           use markdown-it-anchor plugin
  -f, --file <file>      file to convert
  -d, --directory <dir>  convert every file in directory
  -o, --output <dir>     set where to save the converted file (only directory)
  -r, --recursive        convert directory recursively
  -S, --safe             will show the input, output dirertories and files, and prompt for accepting it before converting
  -V, --verbose          verbose mode
  -h, --help             display help for command

You can specify a file with the -f switch, and it will create a file next to it with the same name, but .pug format.

If you want to convert a whole directory, use the -d switch. It will do the same as the -f, but for every file.

To make it recursive in directory mode, use -r.

You can specify an output directory via the -o switch. It will keep the same directory structure as the input directory.

For the markdown-it-acnhor plugin, use -a.

Example

md2pug -f mySite.pug

Creates mySite.pug

md2pug -f src/mySite.pug -o public/

Creates mySite.pug in the /public folder.

md2pug -r -d src/ -o public/

Converts every file in the src/ folder into public/.

src/projects/md2pug.md will created at public/projects/md2pug.pug. src/projects/subDir/md2pug.md will created at public/projects/subDir/md2pug.pug.

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

Contribution

Please report bugs, and feel free to help, make suggestions or issues.

GitHub