Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

Latest commit

 

History

History
100 lines (80 loc) · 2.34 KB

README.md

File metadata and controls

100 lines (80 loc) · 2.34 KB

grunt-pandoc

Pandoc Publish Runner for Grunt.

Markdown to Other Document Format Convert.

  • Markdown to EPUB
  • Markdown to HTML

Getting Started

This plugin requires

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-pandoc --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-pandoc');

The "pandoc" task

Overview

In your project's Gruntfile, add a section named pandoc to the data object passed into grunt.initConfig().

Markdown to EPUB

function myFilterFunc(context: string):string {
	return context;
}

grunt.initConfig({
  pandoc: {
    My_EPUB: { // OUTPUT file name
      configs: {
        "publish"   : 'EPUB',                 // Publish File Format.
        "title"     : "My EPUB Title",        // EPUB Title
        "metadata"  : "include/metadata.xml", // EPUB include META data File Path.
        "stylesheet": "include/style.css"     // EPUB include StyleSheet File Path.
        "filter"    : myFilterFunc            // Calling Before Execute Command.
      },
      files: {
        "chapters": [
          "chapters/header.md", // Require Header File.
          "chapters/content.md" // Chapter Files.
          ...
        ]
      }
    }
  }
})

Markdown to HTML

function myFilterFunc(context: string):string {
	return context;
}

grunt.initConfig({
  pandoc: {
    toHtml: {
      configs: {
        "publish"   : 'HTML',       // Publish File Format.
        "filter"    : myFilterFunc  // Calling Before Execute Command.
      },
      files: {
        "from": [
          "input/toHTML.md",
          "input/toHTML.md"
          ...
        ]
      }
    }
  }
})

Release History

  • 2013-07-02 0.2.3
    • Execute User Filter before Execute Command.
    • Publish Format Markdown to HTML.
  • 2013-07-01 0.2.1
    • Grunt 0.3 -> 0.4.1
    • Publish Format Markdown to EPUB.