0.2.0 • Published 2 years ago

@bookbox/core v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@bookbox/core

npm i @bookbox/core

API

import {createBook} from '@bookbox/core';

const {
    tokens, // array of tokens for view
    meta, // meta info: contents, media
    store, // store of elements and tokens
} = createBook({
    builder, // builder for view (html, markdown, ...)
    externalBuilder, // optional, for extensions
    schema, // ast tree from generator or raw tree from json/yaml
    resourceOptions, // optional, for custom resource paths
});

Elements

import type {BookElements} from '@bookbox/core';

type AllElementNames = keyof BookElements;
// -> "title" | "authors" | "header" | "strong" | "em" | "code" | ...

type CodePropNames = keyof BookElements['code']['props'];
// -> "lang" | "block" | "inline" | "position" | "key" | "meta"