0.2.3 • Published 1 month ago

@rshirohara/repixe v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

repixe

LICENSE

unified processor with support for parsing and serializing pixiv novel format input/output.

Contents

What is this?

This package is a unified processor with support for parsing and serializing pixiv novel format input/output by using unified with repixe-parse and repixe-stringify.

  • unified is a project that transforms content with abstract syntax trees (ASTs).
  • repixe adds support for pixiv novel format to unified.
  • pxast is the pixiv novel AST that repixe uses.

Install

This package is ESM only. in Node.js (18.0+), Install with npm:

npm install @rshirohara/repixe

Use

Say we have the following module example.js:

import { repixe } from "@rshirohara/repixe";

main();

async function main() {
  const source = [
    "これが一段落目\n\n",
    "ここから二段落目",
    "[[rb:二行目>にぎょうめ]]",
    "[[jumpuri:リンク>https://example.com]]も使える。"
  ].join("\n");
  const file = await repixe().process(source);

  console.log(String(file));
}

Running that with node example.js yields:

これが一段落目

ここから二段落目
[[rb: 二行目 > にぎょうめ]]
[[jumpuri: リンク > https://example.com]]も使える。

API

repixe()

Create a new (unfrozen) unified processor that already uses repixe-parse and repixe-stringify. See unified for more information.

Syntax

Pixiv novel format is parsed and serialized according to official article and pixiv-novel-parser.

Syntax tree

The syntax tree format used in repixe is pxast.

Types

This package is fully typed with TypeScript. There are no extra exported types.

License

MIT