Permalink
Browse files

release candidate v 0.1.0

  • Loading branch information...
1 parent 7c48a98 commit ecc6f12368e844fdabe726ea4e7d426d547f29ab @bylexus committed Mar 17, 2013
View
@@ -0,0 +1,3 @@
+node_modules
+npm-debug.log
+tmp
View
@@ -0,0 +1,14 @@
+{
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "sub": true,
+ "undef": true,
+ "boss": true,
+ "eqnull": true,
+ "node": true,
+ "es5": true
+}
View
@@ -0,0 +1,81 @@
+/*
+ * grunt-md2html
+ * https://github.com/bylexus/grunt-md2html
+ *
+ * Copyright (c) 2013 Alexander Schenkel
+ * Licensed under the MIT license.
+ */
+
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ jshint: {
+ all: [
+ 'Gruntfile.js',
+ 'tasks/*.js',
+ '<%= nodeunit.tests %>',
+ ],
+ options: {
+ jshintrc: '.jshintrc',
+ },
+ },
+
+ // Before generating any new files, remove any previously-created files.
+ clean: {
+ tests: ['tmp'],
+ },
+
+ // Configuration to be run (and then tested).
+ md2html: {
+ multiple_files: {
+ options: {
+ layout: 'test/fixtures/layout.html',
+ basePath: 'test/fixtures'
+ },
+ files: [{
+ expand: true,
+ cwd: 'test/fixtures/multiple_files',
+ src: ['**/*.md'],
+ dest: 'tmp/multiple_files',
+ ext: '.html'
+ }]
+ },
+ one_file: {
+ options: {
+ separator: '\n\n'
+ },
+ files: [{
+ src: ['test/fixtures/one_file/**/*.md'],
+ dest: 'tmp/one_file/output.html'
+ }]
+ }
+ },
+
+
+
+ // Unit tests.
+ nodeunit: {
+ tests: ['test/*_test.js'],
+ }
+
+ });
+
+ // Actually load this plugin's task(s).
+ grunt.loadTasks('tasks');
+
+ // These plugins provide necessary tasks.
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-clean');
+ grunt.loadNpmTasks('grunt-contrib-nodeunit');
+
+ // Whenever the "test" task is run, first clean the "tmp" dir, then run this
+ // plugin's task(s), then test the result.
+ grunt.registerTask('test', ['clean', 'md2html', 'nodeunit']);
+
+ // By default, lint and run all tests.
+ grunt.registerTask('default', ['jshint', 'test']);
+
+};
View
@@ -0,0 +1,22 @@
+Copyright (c) 2013 Alexander Schenkel
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
View
@@ -1,4 +1,159 @@
-grunt-md2html
-=============
+# grunt-md2html
-Small Grunt MultiTask to convert Markdown files to HTML, supporting Grunt >= 0.4.0
+> Small Grunt MultiTask to convert Markdown files to HTML, supporting Grunt >= 0.4.0
+
+## Getting Started
+This plugin requires Grunt `~0.4.0`
+
+If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
+
+```shell
+npm install grunt-md2html --save-dev
+```
+
+One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
+
+```js
+grunt.loadNpmTasks('grunt-md2html');
+```
+
+## The "md2html" task
+
+### Overview
+In your project's Gruntfile, add a section named `md2html` to the data object passed into `grunt.initConfig()`.
+
+```js
+grunt.initConfig({
+ md2html: {
+ options: {
+ // Task-specific options go here.
+ },
+ your_target: {
+ // Target-specific file lists and/or options go here.
+ },
+ },
+})
+```
+
+### Options
+
+#### options.layout
+Type: `String`
+Default value: `null`
+
+A path to a layout file: A Layout file defines the global surrounding layout,
+e.g. an HTML header / footer. Within the Layout file you can then include the
+actual processed .md-file content.
+
+Example layout file:
+```html
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="{BASEPATH}style.css">
+ <title></title>
+ </head>
+ <body>
+ {DOC}
+ </body>
+</html>
+```
+This layout file adds an HTML skeleton around each processed output file, replacing BASEPATH
+and DOC (the processed content).
+
+
+#### options.basePath
+Type: `String`
+Default value: `null`
+
+If basePath is set, you can use `'{BASEPATH}'` in your .md / layout file, which is expanded
+to a relative path from the actual output file to the given basePath. Useful to link
+static resources like stylesheets in the layout file
+
+#### options.separator
+Type: `String`
+Default value: `'\n\n'`
+
+A string value that is used to concatenate the .md files if used in one-outputfile mode
+
+### Replacements
+
+The following strings are replaced during the md-to-html process:
+
+* `{DOC}`: Contains the processed HTML code for a destination file. Useful for a Layout file.
+* `{BASEPATH}`: Points relatively to the `dest` path of the actual output, or to the given basePath in the options.
+* `{DEST}`: The relative path to the actual destination file.
+
+
+### Usage Examples
+
+#### Single HTML file output
+In this example, all found .md files are converted to HTML and ONE html output file is generated:
+
+
+```js
+grunt.initConfig({
+ md2html: {
+ one_file: {
+ options: {
+ },
+ files: [{
+ src: ['my/md/files/**/*.md'],
+ dest: 'out/output.html'
+ }]
+ }
+ }
+})
+```
+
+#### One HTML file per md file output
+In this example, all found .md files are converted to an HTML file in the same directory.
+Note that this is a base functionality of grunt's file expanding facility:
+
+
+```js
+grunt.initConfig({
+ md2html: {
+ multiple_files: {
+ },
+ files: [{
+ expand: true,
+ cwd: 'base/path/to/md/files',
+ src: ['**/*.md'],
+ dest: 'output',
+ ext: '.html'
+ }]
+ }
+ }
+})
+```
+
+#### Options example
+This example just demonstrates the different options:
+
+* layout: A layout file used for each processed output file
+* basePath: The `'{BASEPATH}'` variable which can be used within the docs points relatively to the basePath
+* separator: concatenator string when using multiple md files which go to one output file
+
+
+```js
+grunt.initConfig({
+ md2html: {
+ multiple_files: {
+ },
+ files: [{
+ expand: true,
+ cwd: 'base/path/to/md/files',
+ src: ['**/*.md'],
+ dest: 'output',
+ ext: '.html'
+ }]
+ }
+ }
+})
+```
+
+
+## Release History
+
+* 0.1.0: Very first release, no testing yet
View
@@ -0,0 +1,47 @@
+{
+ "name": "grunt-md2html",
+ "description": "Small Grunt MultiTask to convert Markdown files to HTML, supporting Grunt >= 0.4.0",
+ "version": "0.1.0",
+ "homepage": "https://github.com/bylexus/grunt-md2html",
+ "author": {
+ "name": "Alexander Schenkel",
+ "email": "alex@alexi.ch",
+ "url": "http://www.alexi.ch/"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/bylexus/grunt-md2html.git"
+ },
+ "bugs": {
+ "url": "https://github.com/bylexus/grunt-md2html/issues"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://github.com/bylexus/grunt-md2html/blob/master/LICENSE-MIT"
+ }
+ ],
+ "main": "Gruntfile.js",
+ "engines": {
+ "node": ">= 0.8.0"
+ },
+ "scripts": {
+ "test": "grunt test"
+ },
+ "dependencies": {
+ "node-markdown": "~0.1.1"
+ },
+ "devDependencies": {
+ "grunt-contrib-jshint": "~0.1.1",
+ "grunt-contrib-clean": "~0.4.0",
+ "grunt-contrib-nodeunit": "~0.1.2",
+ "grunt": "~0.4.0",
+ "node-markdown": "~0.1.1"
+ },
+ "peerDependencies": {
+ "grunt": "~0.4.0"
+ },
+ "keywords": [
+ "gruntplugin"
+ ]
+}
Oops, something went wrong.

0 comments on commit ecc6f12

Please sign in to comment.