Skip to content

Latest commit

 

History

History
81 lines (59 loc) · 2.43 KB

README.mkd

File metadata and controls

81 lines (59 loc) · 2.43 KB

pdc

a pandoc wrapper for node.js

Installation

npm install pdc

This package requires pandoc to be installed and to be in PATH.

Usage

var pandoc = require('pdc');

pandoc('# Heading', 'markdown', 'html', function(err, result) {
  if (err)
    throw err;

  console.log(result);
});

This will print:

<h1 id="heading">Heading</h1>

API

pandoc(src, from, to[, options], callback);
  • src is a string containing the entire source text, that shall be converted.
  • from is a string containing the type of the source text. (E.g. 'markdown')
  • to is a string containing the type of the destination text. (E.g. 'html')
  • options [optional] is an array with additional command line flags (E.g. [ '-v' ] for pandocs version).
  • callback is a function that is called after parsing. It takes two arguments (err, result), where err is an error or null and result is a string containing the converted text.

Bugs and Issues

If you encounter any bugs or issues, feel free to open an issue at github.

Credits

I’d like to thank John MacFarlane for creating such a great tool, that adds so many possibilities to Markdown, and of course John Gruber for creating Markdown itself.

License

Copyright © 2012 Paul Vorbach

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, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.