# Text Plugin for DocPad This plugin allows you to render variables within `templateData` using text elements E.g. if you have this in your `docpad.cson` ``` coffeescript { templateData: firstname: 'Benjamin' lastname: 'Lupton' fullname: 'firstname lastname' markdownExample: 'this is so **awesome**' markdownEcoExample: 'here is a random number: **<%- Math.random() %>**' } ``` Doing the following inside a document: ``` html My creator's firstname is: firstname My creator's lastname is: lastname My creator's fullname is: fullname The markdown example is: markdownExample The markdown eco example is: markdownEcoExample ``` Will output: ``` html My creator's firstname is: Benjamin My creator's lastname is: Lupton My creator's fullname is: Benjamin Lupton The markdown example is: this is so awesome The markdown eco example is: here is a random number: 0.5123213213123 ``` Which is incredibly useful for abstracting out common generic pieces of text from your templates and placing them inside your configuration files. A common use case for this is easy configurability of skeletons, as well as easier translation of your website. If you are embedding a text block into a text block, it is best that you name your text block like so `blah` that way our parser won't get confused as easily :) To use it with [coffeekup](http://coffeekup.org/) you'll do it like so `tag 'text', {render:"md"}, "your **markdown** content"`. [More info here.](https://github.com/bevry/docpad/issues/194#issuecomment-11363441). Alternatively, you can use the `t` template helper like so `@t('*markdown*', {render="markdown"})` ## Install To use this plugin with DocPad, simply run `npm install docpad-plugin-text` inside your website's directory. You'd probably also want to add `"docpad-plugin-text": "latest"` to your `package.json` dependencies. ## History You can discover the history inside the `History.md` file ## License Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
Copyright © 2012+ [Bevry Pty Ltd](http://bevry.me)