@rshirohara/rekurke
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

rekurke

LICENSE

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

Contents

What is this?

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

  • unified is a project that transforms content with abstract syntax trees (ASTs).
  • rekurke add support for kakuyomu novel format to unified.
  • kkast is the kakuyomu novel AST that rekurke uses.

Install

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

npm install @rshirohara/rekurke

Use

Say we have the following module example.js:

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

main();

async function main() {
  const source = [
    "これが一段落目。\n",
    "これが二段落目。",
    "これは|ルビ振《るびふ》り。\r\n\n",
    "ここから三段落《さんだんらく》目。",
    "これは《《強調》》。",
  ].join("\n");
  const file = await rekurke.process(source);

  console.log(String(file));
}

Running that with node example.js yields:

これが一段落目。

これが二段落目。
これは|ルビ振《るびふ》り。


ここから|三段落《さんだんらく》目。
これは《《強調》》。

API

rekurke()

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

Syntax

Kakuyomu novel format is parsed and serialized according to the official article.

Syntax Tree

The syntax tree format used in rekurke is kkast.

types

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

License

MIT

Package Sidebar

Install

npm i @rshirohara/rekurke

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

5.91 kB

Total Files

7

Last publish

Collaborators

  • rshirohara