{"name":"grunt-markdown","description":"Compile markdown to html. GFM and code highlighting support!","version":"0.3.0","homepage":"https://github.com/treasonx/grunt-markdown","author":{"name":"James Morrin","email":"treasonx@gmail.com"},"contributors":[{"name":"Thomas Welton","email":"thomaswelton@me.com"},{"name":"Matt Dawson","email":"matthewtdawson@gmail.com"}],"repository":{"type":"git","url":"git://github.com/treasonx/grunt-markdown"},"bugs":{"url":"https://github.com/treasonx/grunt-markdown/issues"},"licenses":[{"type":"MIT","url":"https://github.com/treasonx/grunt-markdown/blob/master/LICENSE-MIT"}],"main":"grunt.js","engines":{"node":"*"},"scripts":{"test":"grunt nodeunit"},"devDependencies":{"grunt":"~0.4.0","grunt-contrib-jshint":"~0.3.0","grunt-contrib-nodeunit":"~0.1.2","grunt-contrib-watch":"~0.3.1"},"keywords":["gruntplugin"],"dependencies":{"highlight.js":"~7.3.0","marked":"~0.2.5","grunt-lib-contrib":"~0.3.0","lodash":"~0.9.1"},"_id":"grunt-markdown@0.3.0","dist":{"shasum":"38aa71bbb042e9c827e357cbbfa5d1af5eb49acf","tarball":"http://registry-npm.ywwl.com/grunt-markdown/download/grunt-markdown-0.3.0.tgz","integrity":"sha512-jgbO986MOqJ+65Npp2CCC7HIYGImj6HOHC5QsM+jaYbfwMeR1mFE8sa40cyeus0PdlqM5pTrLc7Ca2za9LvYJQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFRdUqVZ2noB7qtsOVOWRbHUZHiTxFyMBc3R2DiarRniAiEArZ5d6yR4I6oJACJRldD085CQjK3W5AiOHiKAi+M/zBU="}],"size":5363,"noattachment":false,"key":"/grunt-markdown/-/grunt-markdown-0.3.0.tgz"},"_from":".","_npmVersion":"1.2.25","_npmUser":{"name":"treasonx","email":"treasonx@gmail.com"},"maintainers":[{"name":"treasonx","email":"treasonx@gmail.com"}],"directories":{},"readme":"# grunt-markdown\n\n[![Build Status](https://travis-ci.org/treasonx/grunt-markdown.png?branch=master)](https://travis-ci.org/treasonx/grunt-markdown)\n\nThis grunt task takes a set of markdown files and converts them to HTML. It supports [GFM](http://github.github.com/github-flavored-markdown/) with code highlighting. The code highlighting is done using [highlight.js](http://softwaremaniacs.org/soft/highlight/en/).\n\n## Getting Started\nInstall this grunt plugin next to your project's [grunt.js gruntfile](http://gruntjs.com/getting-started) with:\n\n```bash\nnpm install grunt-markdown --save-dev\n```\n\nThen add this line to your gruntfile:\n\n```javascript\ngrunt.loadNpmTasks('grunt-markdown');\n```\n\n## Documentation\nCreating a markdown task is simple. For the basic functionality add the following config in your gruntfile:\n\n```javascript\ngrunt.initConfig({\n  markdown: {\n    all: {\n      files: [\n        {\n          expand: true,\n          src: 'docs/src/*.md',\n          dest: 'docs/html/',\n          ext: '.html'\n        }\n      ]\n    }\n  }\n});\n\n```\n\nHere is an example config using all of the options:\n\n```javascript\ngrunt.initConfig({\n  markdown: {\n    all: {\n      files: [\n        {\n          expand: true,\n          src: 'docs/src/*.md',\n          dest: 'docs/html/',\n          ext: '.html'\n        }\n      ],\n      options: {\n        template: 'myTemplate.jst',\n        preCompile: function(src, context) {},\n        postCompile: function(src, context) {},\n        templateContext: {},\n        contextBinder: false,\n        contextBinderMark: '@@@',\n        autoTemplate: true,\n        autoTemplateFormat: 'jst',\n        markdownOptions: {\n          gfm: true,\n          highlight: 'manual',\n          codeLines: {\n            before: '<span>',\n            after: '</span>'\n          }\n        }\n      }\n    }\n  }\n});\n\n```\nThese are the properties that the `markdown` task accepts:\n\n* `files`: This plugin supports use of the [files API](http://gruntjs.com/configuring-tasks#files) introduced in Grunt 0.4.0. Files may be specified using any one of the [Compact Format](http://gruntjs.com/configuring-tasks#compact-format), [Files Objects Format](http://gruntjs.com/configuring-tasks#files-object-format), or [Files Array Format](http://gruntjs.com/configuring-tasks#files-array-format) (as in the above example).\n* `options`: options to be passed to the markdown parser \n    * `template`: If you wish to specify your own html template, use the `template` option. Include the following line: `<%=content%>` where you want the compiled markdown inserted in your template\n    * `markdownOptions`: Options passed directly to the markdown parser.\n    * `preCompile`: is run before the markdown is compiled\n    * `postCompile`: is run after the markdown has been compiled\n    * `templateContext`: the default context for template expansion\n    * `contextBinder`: this option is useful when we want to bind some parameters directly from markdown files. All data is stored in `templateContext` object.\n    * `contextBinderMark`: with this option we can pass any marker between which we can grab your special parameters from markdown templates.\n    * `autoTemplate`: if this option is set to true, script will search for template automatically. Template must be placed in this same catalog where markdown files are.\n    * `autoTemplateFormat`: the template format when `autoTemplate` is `true`.\n\n### modifying content with preCompile and postCompile\n\nSometimes there is a need to modify the markdown content prior to compilation.\nThis is most commonly used to augment the template context with meta data before\nexpanding the html template. \n\n#### preCompile\n\nThis function is run prior to the compilation of md to html. It has the\nfollowing format: \n\n```javascript\n  function(src, context) {\n    //do stuff to src and context\n    //optionally return the modified src\n  }\n```\n\n#### postCompile\n\nThis function is run after the md has been converted to html. It has the\nfollowing format:\n\n```javascript\n  function(src, context) {\n    //do stuff to src and context\n    //optionally return the modified src\n  }\n```\n### templateContext\n\nThis object is used to expand your html template. Any data added to this object\nwill be available in the template using the template syntax `<%=myAttr%>`. \n\nThis can also be a function which is expected to return a context object.\n\n### markdownOptions\n\nMost markdown options are passed as-is to the [marked](https://github.com/chjj/marked) markdown parser. The only option that is processed prior to compiling the markdown is the `highlight` option. If you specify 'auto' or 'manual' the task will handle highlighting code blocks for you using highlight.js. If you pass a custom function as the highlight option it will be used to highlight the code.\n\n* `auto`: Will try to detect the language\n* `manual`: will pass the language name from markdown to the highlight function\n* `codeLines`: specify text that should wrap code lines\n\n### contextBinder\n\nBelow you can see example how to use this option.\n\n```javascript\n  markdown: {\n    all: {\n      files: [\n        {\n          expand: true,\n          src: 'docs/src/*.md',\n          dest: 'docs/html/',\n          ext: '.html'\n        }\n      ],\n      options: {\n        template: 'myTemplate.jst',\n        preCompile: function(src, context) {},\n        postCompile: function(src, context) {},\n        templateContext: {},\n        contextBinder: true,\n        contextBinderMark: '@@@',\n        markdownOptions: {\n          gfm: true,\n          highlight: 'manual',\n          codeLines: {\n            before: '<span>',\n            after: '</span>'\n          }\n        }\n      }\n    }\n  }\n```\n\nThen inside markdown file we have to put: `<!-- @@@key:value@@@ -->` and it will be equal to:\n\n```javascript\ntemplateContext: {\n  key: 'value'\n}\n```\n\n## License\nCopyright (c) 2012-2013 James Morrin\nLicensed under the MIT license.\n","publish_time":1371158807926,"_cnpm_publish_time":1371158807926,"dist-tags":{"latest":"0.7.0"}}