A Markdown documentation and book generator written in MoonBit
moon add spectacleCase/moonbook@0.3.1moon run --target native cmd/main -- init my-book
moon run --target native cmd/main -- build my-book
moon run --target native cmd/main -- serve my-book 3000my-book/
├── moonbook.toml
└── src/
├── SUMMARY.md
├── README.md
└── getting-started.mdmoonbook init [目录] 初始化书籍工程,不覆盖已有文件
moonbook build [目录] 检查并生成静态站点
moonbook check [目录] 只检查,不写入构建结果
moonbook serve [目录] [端口] 构建并启动本地预览,默认端口 3000[book]
title = "MoonBit 学习指南"
authors = ["作者"]
language = "zh-CN"
src = "src"
[build]
build-dir = "book"
incremental = true
[output.html]
theme = "light"
template = ""
static-dir = "static"
additional-css = ["theme/custom.css"]
additional-js = ["theme/custom.js"]
[output.html.search]
enable = true# Summary
# 第一部分
- [简介](README.md)
- [安装](guide/install.md)
---
- [附录](appendix.md)///|
let config = @moonbook.parse_config(config_text)
///|
let items = @moonbook.parse_summary(summary_text)
///|
let html = @moonbook.render_markdown("# Hello")
///|
let output = @moonbook.build_site(config_text, summary_text, sources)spectacleCase/moonbook/config
spectacleCase/moonbook/book
spectacleCase/moonbook/renderer
spectacleCase/moonbook/search
spectacleCase/moonbook/buildmoon fmt
moon check --target all --deny-warn
moon test --target all --deny-warn
moon build --target native
moon infopub(all) struct BuildContext {
previous_hashes : Map[String, String]
template : String?
force : Bool
}pub(all) struct BuildOutput {
files : Array[GeneratedFile]
diagnostics : Array[Diagnostic]
skipped : Int
manifest : String
}pub(all) struct Chapter {
title : String
source_path : String
output_path : String
level : Int
number : String
}pub(all) struct MoonBookError {
kind : String
line : Int
message : String
}impl Show for MoonBookErrorpub(all) struct Section {
title : String
id : String
level : Int
}fn build_site(config_text : String, summary_text : String, sources : Array[SourceFile]) -> Result[BuildOutput, MoonBookError]fn build_site_with_context(config_text : String, summary_text : String, sources : Array[SourceFile], context : BuildContext) -> Result[BuildOutput, MoonBookError]fn content_hash(source : String) -> Stringfn render_markdown(source : String) -> StringInstall
Download zipA Markdown documentation and book generator written in MoonBit