Markade
The tool in three commands.
The tool in three commands.
First, you need node.js and npm. Follow the installation instructions from node.js.
Then, to install Markade you will need to have NPM and run npm install -g markade
. This will install Markade as a binary
allowing you to execute it anywhere.
Then you can edit your files or confirm that everyone is working okay by compiling the sample files that Markade includes.
You can do this with markade compile <directory>
to look for markade.json and compile all the files it finds.
You can then watch and run a local server to view the files with markade watch <directory>
.
npm install -g markade
markade
command line utility.markade init <directory>
. This will create a markade.json file and copy over the sample templates and data.markade compile <directory>
. This will look for markade.json you created earlier then look for data files in the data directory you specified and compare them against the templates in the following way:template: file.pug
specified."templates": {"file.pug": "file.md"}
output: file.xml
specified.data/about/index.md
-> public/about/index.html
.markade watch <directory>
The API takes an options object with the following set of options.
pug | object | Pug options |
template | string | Source Pug template string |
options | object | Options for markade and pug |
callback | function | A function to call on error or compilation with (err, html) as arguments |
Options for logging to console. Available options include:
Takes all options that the Pug API takes. Here are the most useful ones.
filename | string | The path to your filename, required for relative includes and extends |
pretty | boolean | Adds whitespace to the resulting html to make it easier for a human to read using ' ' as indentation. If a string is specified, that will be used as indentation instead (e.g. '\t' ). |
Compile a Pug string with a Markdown string to a HTML string.
data | string | Markdown stringng |
template | string | Source Pug template string |
options | object | Options for Markade and Pug (see above) |
callback | function | A function to call on error or compilation |
var markade = require("markade");
var data = "**bold** text";
var template = "| !{html}";
var options = {
pug: {
filename: options.template
}
};
markade(data, template, options, function(err, html) {
if (err) return console.error(err);
console.log(html);
});
// returns: <b>bold</b> text.