Fork me on GitHub

markx

anything => html

Markx is a command line tool for node.js to generate static sites. It will convert markdown, jade and any code snippets into html. It also has the ability to preview your files live with auto refresh.

Markx is great for github pages, phonegap projects and simple, static sites.

Install

npm install -g markx

Usage

Usage: markx [file]

Options:

    -h, --help             output usage information
    -V, --version          output the version number
    -n, --nohl             Disable syntax highlighting
    -p, --preview <port>   Start a server to get a live preview
    -h, --head <file>      Custom head file
    -f, --foot <file>      Custom foot file
    -t, --template <file>  Jade template file

Examples:

    # convert markdown and code blocks to html
    $ markx blog.md > blog.html

    # convert jade to html
    $ markx index.jade > index.html

    # convert markdown with jade template to html
    $ markx --template template.jade blog.md > blog.html

    # live preview of your markdown file
    $ markx --preview 8001 blog.md

    # live preview of your markdown file with a custom header/footer
    $ markx --preview 8001 --head head.html --foot foot.html blog.md

Example

Markdown

#This is a heading

This is a paragraph

    var a = '123';
    var f = function() {
        return 4;
    }

Output

<h1>This is a heading</h1>
<p>This is a paragraph</p>
<pre><code><span class="keyword">var</span> a = <span class="string">'123'</span>;
<span class="keyword">var</span> f = <span class="function"><span class="keyword">function</span><span class="params">()</span> {</span>
<span class="keyword">return</span> <span class="number">4</span>;

Set Syntax Language

If the auto detection isn't working, you can either pass in the language using --lang or you can set it in your markdown file using `[lang]. See below for an example.

#This is a heading

This is a paragraph

    `javascript
    var a = '123';
    var f = function() {
        return 4;
    }

Live Preview

The --preview option lets you preview your markdown files before generating them as html. When you open your browser to your live preview, you don't have to bother with refreshing every time you make a change to your markdown file, markx will automatically refresh your browser when it detects a change. How cool is that?

CSS for Syntax Highlighter

Here are some css files that will style the code blocks.

Support Languages

Here are the supported languages for syntax highlighting.

History

0.0.6

0.0.5

0.0.4

0.0.3

0.0.2

0.0.1

Future