pixiv2html

2.0.0 • Public • Published

pixiv2html

Converts markuped text of pixiv novel into HTML.

Build Status Coverage Status Greenkeeper badge

Install

npm install pixiv2html

Usage

const pixiv2html = require('pixiv2html');
 
pixiv2html('[chapter: foo]'); //=> ['<h1>foo</h1>']
pixiv2html(`pixiv
 
is
[newpage]
awesome`); //=> ['<p>pixiv</p><br><p>is</p>', '<p>awesome</p>']
 
pixiv2html('[chapter: <bar>]', {
    transforms: {
        chapter: title => `<h4>${title}</h4>`
    },
}); //=> ['<h4>&lt;bar&gt;</h4>']

API

This API exposes a single function such as pixiv2html = require('pixiv2html').

pixiv2html(text[, options])

  • text: [string] Input text markuped with pixiv novel style
  • options: [object]
    • options.transforms: [object] Hash of functions to customize the output of tag conversion
      • options.transforms.chapter: [function(title)]
      • options.transforms.pixivimage: [function(illustID, pageNumber)]
      • options.transforms.jump: [function(pageNumber)]
    • options.type: [string] String to switch the output to 'html' or 'xhtml'. Defaults to 'html'.
  • return: [string[]] Array of pages of converted HTML

Package Sidebar

Install

npm i pixiv2html

Weekly Downloads

0

Version

2.0.0

License

MIT

Last publish

Collaborators

  • hakatashi