目录

moonbit-brandbook

moonbit-brandbook is a MoonBit library and CLI demo for generating brand guidelines from structured design tokens. It renders Markdown and static HTML, and it audits a brand specification before export.

The project was created for the MoonBit August hackathon as a reusable design system documentation tool. It is intentionally small at the edges and broad in the core: tokens, components, validation, Markdown output, HTML output, and CLI demonstration are separate concerns.

Features

  • Logo usage rules: minimum size, clear space, allowed backgrounds.
  • Color tokens: semantic roles, CSS custom properties, Markdown tables.
  • Typography tokens: font stacks and type scale.
  • Component examples: anatomy, token dependencies, interaction states.
  • Incorrect usage examples with replacement guidance.
  • Static Markdown and HTML renderers.
  • CSS custom property export for color and typography tokens.
  • Color contrast helpers for foreground/background pairs.
  • Audit report for missing or malformed brand data.

Usage

Run the demo CLI:

moon run cmd/main

Use the library in MoonBit:

test {
  let book = moonbit_brandbook()
  let report = book.audit()
  inspect(report.summary(), content="0 errors, 0 warnings, 0 notes")
  assert_true(book.to_markdown().contains("## Logo Usage"))
  assert_true(book.to_css().contains("--brand-rabbit-blue"))
}

Validation

moon check
moon test
moon fmt --check
moon check --deny-warn
moon test --deny-warn
moon info
git diff --exit-code

Scope

The current implementation focuses on deterministic generation from in-memory tokens. Future extensions can add JSON/YAML input, richer image asset checks, theme exports, and package publishing to mooncakes.io.

Source And Authorship

All source files in this repository are authored for this hackathon submission by the repository owner. The bundled MoonBit sample brand tokens are hand-authored demonstration data, not copied from an official brand manual.

License

Apache-2.0

关于

MoonBit brand guideline generator for Markdown, HTML, CSS tokens, and audits

58.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号