1.0.0 • Published 10 years ago

atypograf v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
10 years ago

atypograf

This is Node.js library for ArtLebedev's typograf http://www.artlebedev.ru/tools/typograf/

Usage

Library can be downloaded through npm easily npm install atypograf

Then atypograf is easy to use as the following:

var typograf = require('atypograf');

typograf.process('Abc - "1234абы"', {
	type: typograf.TYPE_MIXED_ENTITIES,
	useBr: 1,
	useP: 1,
	maxNobr: 1
}, function(err, text)
{
	if (err)
	{
		console.log('Error ocurred: ' + err.toString());
		return;
	}

	// Success
	console.log('Typografed string: ('+ text +')');
});

Options

ParameterDescription
typeDefines type of result entities that will be considered by typograf.Following consstants are defined in exported object:TYPE_HTML_ENTITIES, TYPE_XML_ENTITIES, TYPE_NO_ENTITIES (default) and TYPE_MIXED_ENTITIES.
useBr1 – if you want typograf to add br-s. 0 – otherwise (default)
useP1 – if you want typograf to add p-s. 0 – otherwise (default)
maxNobr(integer) max number of nobr-s. Default 0