@hanology/cham-browser
v0.4.49
Published
CHAM — browser-compatible parser, serializer, and site generator for Classical Han Annotated Markdown
Readme
@hanology/cham-browser
Site generator for CHAM (Classical Han with Annotations Markup) — generates a complete static website from CHAM content.
Includes parser, serializer, transformation pipeline, Vue 3 frontend template, and CLI.
Install
npm install @hanology/cham-browserCLI
# Generate a static site from CHAM content
npx cham-browser --config config.yamlconfig.yaml
# Branding
name: 漢流
nameEn: Hanology
subtitle: 古典詩文圖書館
# Content paths (relative to config.yaml)
libraryDir: library/content
authorsFile: library/data/authors.yaml
# Build options
outputDir: dist
pretty: trueAPI
Parser & Serializer (browser-compatible)
import { parse, serialize } from '@hanology/cham-browser'
const doc = parse(chamSource)
const output = serialize(doc)Pipeline (pure functions, no Node.js fs)
import {
buildPieceFromCham,
buildBookData,
buildLibraryIndex,
buildAuthorsJson,
buildDynastiesJson,
} from '@hanology/cham-browser'
const piece = buildPieceFromCham(
chamSource, bookConfig, authors, bookId,
proseFiles, layerFiles,
)Architecture
| Layer | Description |
|-------|-------------|
| pipeline.ts | Pure transformation functions (CHAM → JSON) |
| cli.ts | I/O adapter: reads files, calls pipeline, runs vite-ssg |
| template/ | Vue 3 + vite-ssg frontend (components, views, styles) |
Requirements
Node.js 20+
License
MIT
