repixe plugin to add support for parsing pixiv novel format.
This package is a unified plugin that defines how to take pixiv novel format as input and turn it into a syntax tree.
This plugin uses pixiv-novel-parser
for parsing pixiv novel format text into tokens
and turns those into pxast syntax trees.
This package is ESM only. in Node.js (18.0+), Install with npm:
npm install @rshirohara/repixe-parse
Say we have the following module example.js
:
import { unified } from "unified";
import { repixeParse } from "@rshirohara/repixe-parse";
main();
async function main() {
const source = [
"これが一段落目\n\n",
"ここから二段落目",
"[[rb:二行目>にぎょうめ]]",
"[[jumpuri:リンク>https://example.com]]も使える。"
].join("\n");
const ast = await unified().use(repixeParse).parse(source);
console.log(ast);
}
Running that with node example.js
yields:
{
type: "root",
children: [
{
type: "paragraph",
children: [
{type: "text", value: "これが一段落目"}
]
},
{
type: "paragraph",
children: [
{type: "text", value: "ここから二段落目"},
{type: "break"},
{type: "ruby", value: "二行目", ruby: "にぎょうめ"},
{type: "break"},
{type: "link", url: "https://example.com", children: [
{type: "text", value: "リンク"}
]},
{type: "text": value: "も使える"}
]
}
]
}
Add support for parsing pixiv novel format input. There are no options.
Pixiv novel format text is parsed according uses pixiv-novel-parser
.
The syntax tree format used in repixe is pxast.
This package is fully typed with TypeScript. There are no extra exported types.