node package manager

Introducing npm Enterprise add-ons. Integrate third-party dev tools into npm…


Markdown rendering for DocPad, using Robotskirt (sundown)

Robotskirt Plugin for DocPad

Markdown rendering for DocPad, using Robotskirt


npm install --save docpad-plugin-robotskirt

For information on customising your plugin configuration you can refer to the DocPad FAQ

You can customise the Robotskirt options using the robotskirtOptions object. By default we use:

            EXT_AUTOLINK: true
            EXT_FENCED_CODE: true
            EXT_LAX_SPACING: true
            EXT_NO_INTRA_EMPHASIS: true
            EXT_SPACE_HEADERS: true
            EXT_STRIKETHROUGH: true
            EXT_SUPERSCRIPT: true
            EXT_TABLES: true
            HTML_SKIP_HTML: false
            HTML_SKIP_STYLE: false
            HTML_SKIP_IMAGES: false
            HTML_SKIP_LINKS: false
            HTML_EXPAND_TABS: false
            HTML_SAFELINK: false
            HTML_TOC: false
            HTML_HARD_WRAP: false
            HTML_USE_XHTML: true
            HTML_ESCAPE: false

It makes "smart" punctuation. See more on its homepage. Default is true:

        smartypants: true

It supports highlighting code blocks at build time. Following is using highlight.js.

        highlight: (code, lang)->
            has = lang && hl.LANGUAGES.hasOwnProperty(lang.trim())
            open = if has then '<pre><code class="lang-'+lang.trim()+'">' else '<pre><code>'
            body = if has then hl.highlight(langcode).value else hl.highlightAuto(code).value
            close = '</code></pre>'
            return open + body + close

You can add your markup in only normal text blocks. Next example is Twitter tag exmaple. @pismute will be rendered <a href="">@pismute</a>:

        inline: (src, hash)->
            out = src
            #for people 
            out = out.replace /(^|[ \t]+)@([a-zA-Z0-9]+)/g(whole, m1, m2) ->
                hash m1 + '<a href="' + m2 + '">@' + m2 + '</a>'
            #for hash tag· 
            out = out.replace /(^|[ \t]+)#([ㄱ-ㅎ가-힣a-zA-Z0-9]+)/g(whole, m1, m2) ->
                hash m1 + '<a href="' + escapeURL(m2) + '&src=hash">#' + m2 + '</a>'
            return out

You can discover the history inside the file

Licensed under the incredibly permissive MIT License
Copyright © 2012 Bevry Pty Ltd