Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maximilianschmitt/docpad-plugin-shortcodeparser

Easy shortcodes for DocPad using shortcode-parser
https://github.com/maximilianschmitt/docpad-plugin-shortcodeparser

Last synced: about 1 month ago
JSON representation

Easy shortcodes for DocPad using shortcode-parser

Awesome Lists containing this project

README

        

# docpad-plugin-shortcodeparser

Easy shortcodes for DocPad using [shortcode-parser](https://github.com/derdesign/shortcode-parser).

## Usage

### 1. Add Shortcodes

To add shortcodes, edit your docpad.js-file to include a custom configuration for shortcodeparser:

```
module.exports = {
shortcodeparser: {
codes: [
// [img src="path.png" alt="text"] becomes text
{
tag: 'img',
cb: function(buf, opts, templateData) {
return '' + opts.alt + '';
}
},

// [b]Bold text![/b] becomes Bold text!
{
tag: 'b',
cb: function(buf, opts, templateData) {
return '' + buf + '';
}
}
]
}
};
```

### 2. Use File Extensions

Now you can use shortcodes, for example, in your markdown-documents by adjusting the file-extension to "document-name.html.md.sc". You can also set a custom file-extension in your docpad.js-file by setting the key `shortcodeparser.extension`.