@phiresky/pandoc-filter
Pandoc filtering for Node.js
Last updated 6 months ago by phiresky .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @phiresky/pandoc-filter 
SYNC missed versions from official npm registry.

About

Node.js port of the Python pandocfilters for filtering with Pandoc

Install

npm install -g pandoc-filter

Example

#!/usr/bin/env node

// Pandoc filter to convert all text to uppercase

var pandoc = require('pandoc-filter');
var Str = pandoc.Str;

function action(type,value,format,meta) {
	if (type === 'Str') return Str(value.toUpperCase());
}

pandoc.stdio(action);

Async using native promise

#!/usr/bin/env node
'use strict';

var pandoc = require('../../../index');
var rp = require('request-promise-native');
var Str = pandoc.Str;

async function action(type,value,format,meta) {
	if (type === 'Str') return rp({
		uri: value,
		json: true
	}).then(function (data) {
		return Str(data.places[0]["post code"]);
	})
}

pandoc.stdioAsync(action);

Compatibility Notes

Required node >=v7.6 for async/await/promise support.

v0.1.6 is required for pandoc versions after 1.17.2 to support the new JSON format. See this issue for details.

Credits

Thanks to John MacFarlane for Pandoc.

License

MIT

Current Tags

  • 2.0.0                                ...           latest (6 months ago)

1 Versions

  • 2.0.0                                ...           6 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (5)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |