@aewerdev/dokujs
Version:
Doku (.doku) compiler, builder and browser runtime for documentation, guides and books.
115 lines (92 loc) • 2.64 kB
Markdown
# Doku (.doku)
Doku is a simple documentation format and toolchain for building online docs, guides, and books.
- Write content in `.doku` files (Markdown + optional frontmatter in YAML `---` or TOML `+++`).
- Use the browser runtime to embed a doc: `<script src="/path/to/dokujs.js"></script>` then `<doku src="/docs/intro.doku"></doku>`.
- Use the CLI to compile files or build full projects.
## Install
Use your preferred package manager:
```bash
# npm
npm install -D dokujs
# pnpm
pnpm add -D dokujs
# yarn
yarn add -D dokujs
```
## CLI
Unified command `doku` with subcommands:
```bash
# Create project
npx doku new my-docs
# Build (HTML site)
npx doku build my-docs --format=html
# Build (Doku client output: emits .doku pages + client index)
npx doku build my-docs --format=doku
# Compile a single .doku to HTML
npx doku compile path/to/file.doku path/to/output.html
```
Legacy binaries (still available): `doku-new`, `doku-build`, `doku-compile`.
## Project Structure
```
my-doku/
doku.toml
version.yaml
config.json
index.html
src/
result.yaml
assets/
logo.svg
intro.md
intro.ru.md
chapter1.md
chapter1.ru.md
res/
index_<buildid>.html
index_<buildid>.js
assets/
... (copied from src/assets)
assets-manifest.json
```
## Browser Usage
```html
<script src="/path/to/dokujs.js"></script>
<doku src="/docs/intro.doku"></doku>
```
## Features
- i18n: `languages` and language-specific `nav` in `src/result.yaml`. The built site includes a language dropdown and persists selection.
- Theming: theme colors (`theme.primary`, `theme.accent`), dark/light theme toggle with highlight.js theme switching.
- Code highlighting: highlight.js via Marked; works server-side (build) and client-side (runtime).
- Icons & UI: Font Awesome + W3CSS + W3JS included in generated HTML.
- Assets & Logo:
- Put static files under `src/assets/`. They are copied unmodified to `res/assets/` on build.
- A manifest `res/assets-manifest.json` maps each relative asset path to a unique `id` (for stable references).
- Set a header logo via `logo: assets/logo.svg` in `src/result.yaml`.
### result.yaml (example)
```yaml
title: My Docs
repo: https://github.com/your/repo
author:
name: Your Name
url: https://example.com
avatar: https://...
theme:
primary: "#0f62fe"
accent: "#f1c21b"
logo: assets/logo.svg
languages:
- code: en
label: English
- code: ru
label: Русский
socials:
- icon: github
url: https://github.com/your
nav:
en:
- text: Introduction
file: intro.md
ru:
- text: Введение
file: intro.ru.md
```