# pixiv-novel-parser

> pixiv novel parser.

Latest version **0.3.0** (published 2015-08-08) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install pixiv-novel-parser
pnpm add pixiv-novel-parser
yarn add pixiv-novel-parser
bun add pixiv-novel-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2015-08-08 |
| First published | 2015-07-06 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | ne_Sachirou |
| Maintainers | zonuexe, hakatashi |
| Keywords | pixiv |

## Links

- npm: https://www.npmjs.com/package/pixiv-novel-parser
- Repository: https://github.com/pixiv/pixiv-novel-parser
- Homepage: https://github.com/pixiv/pixiv-novel-parser#readme
- Issues: https://github.com/pixiv/pixiv-novel-parser/issues
- npm.io page: https://npm.io/package/pixiv-novel-parser

## Recent versions

- 0.3.0 (latest) — 2015-08-08
- 0.2.0 — 2015-07-13
- 0.1.2 — 2015-07-10
- 0.1.1 — 2015-07-10
- 0.1.0 — 2015-07-06

## README

# pixiv-novel-parser

[pixiv novel](http://www.pixiv.net/novel/) parser powered by [PEG.js](http://pegjs.org/).

## Getting Started

### node.js

Once you installed [node.js](https://nodejs.org/), install with:

    $ npm install pixiv-novel-parser --save

And require it from your project:

```javascript
var Parser = require('pixiv-novel-parser').Parser;
Parser.parse('[chapter: pixiv[[rb:小説 > しょうせつ]]]');
```

### Web Browser

  Download the [ZIP Package][zip], or use [bower](http://bower.io):

    $ bower install pixiv-novel-parser --save

[zip]: https://github.com/pixiv/pixiv-novel-parser/archive/master.zip

And include it from HTML:

```html
<script src="dist/pixiv-novel-parser.min.js"></script>
<script>
  var Parser = PixivNovelParser.Parser;
  Parser.parse('[chapter:pixiv[[rb:小説>しょうせつ]]]');
</script>
```

## Compatibility

- IE 7+
- Firefox 29+
- Google Chrome 42+
- Opera 21+
- node.js 0.10+
- io.js 3
- PECL V8js 0.1.3

## API

### JavaScript API

Currently pixiv-novel-parser exports object with only one legal property `Parser`. This is JavaScript Class that can be used statically or dynamically.

#### Static Method

##### Parser.parse(text)

Parse text into AST (Abstract Syntax Tree).

* **text**: (`String`) the text to parse
* **Return**: [AST Object](#ast)

```javascript
console.log(Parser.parse('[chapter:見出し]本文[newpage]'));
```

Result:

```
[ { type: 'tag', name: 'chapter', title: [ [Object] ] },
  { type: 'text', val: '本文' },
  { type: 'tag', name: 'newpage' } ]
```

#### Dynamic Method / Property

##### parser.parse(text)

Parse text into AST (Abstract Syntax Tree) and store the result.

* **text**: (`String`) the text to parse
* **Return**: [AST Object](#ast)

```javascript
var parser = new Parser();
parser.parse('[chapter:見出し]本文[newpage]');
console.log(parser.tree);
```

##### parser.tree

Parsed AST Object

##### parser.toJSON()

Serialize parsed AST into JSON.

* **Return**: JSON string that represents AST

## AST

No docs here but approximately it's just an array of tokens. See [test/test.js](test/test.js).

## Contribute

See [CONTRIBUTING](CONTRIBUTING.md)

## Copyright

[Mozilla Public License, version 2.0](https://www.mozilla.org/MPL/2.0/)

> Copyright 2015 pixiv Inc., All Right Reserved.
>
> This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at [http://mozilla.org/MPL/2.0/](http://mozilla.org/MPL/2.0/).

### pixiv-novel-editor

`pixiv-novel-editor/src/app/index.js` is licensed under GPLv3.

> ```
> /**
>  * @license GPLv3 ne_Sachirou <utakata.c4se@gmail.com>
>  */
> ```

---
_Source: https://npm.io/package/pixiv-novel-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
