0.0.5 • Published 8 years ago
magu v0.0.5
Magu
Markdown compiler to based on Marked
Install
yarn add magu
npm install magu
Usage
magu({ Methods of marked.Renderer }, [ Magu plugins ])
.process(`${__dirname}/path/to/file.md`)
.then(html => console.log(html));
.process()
method expects absolute path or content to be passed.
If the passed in is absolute path, there is a process of reading the contents of the file
Methods of marked.Renderer
Look at the marked#block-level-renderer-methods section.
magu({
headline(text, level) {
return `<h${level}>${text}<h${level}>`;
}
})
However, the only difference is that you can pass the string template. For that template, you can use the value passed to that method as is.
magu({
headline: '<h{level}>{text}<h{level}>';
})
Please think that sindresorhus/pupa is used for the development of this template, and it will be executed like this.
pupa('<h{level}>{text}<h{level}>', {text, level});
Make Plugin
The compiled html loaded with cheeriojs/cheerio will be passed as an argument.
plugin($, cheerio) -> ($ or string)
If you return $
or string
, Promise
is OK!
Plugins
License
The MIT License (MIT)
Copyright (c) 2016 nju33 nju33.ki@gmail.com