Skip to content

hanwenguo/weibian

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weibian: A Note System Powered by Typst

Weibian1 is a software for taking scientific notes in the spirit of Forester, using Typst as the markup language. It compiles Typst notes to HTML, then post-processes the HTML to resolve transclusion, internal links, and backmatter (backlinks/contexts/references/related notes).

There is a demo site showcasing Weibian's features, built with Weibian itself as a live example.

Requirements

  • Typst CLI available on your PATH (typst)
  • Rust toolchain only if building from source

Installation

Install from source (local checkout)

cargo install --path .

Install from Git

cargo install --locked --git https://github.com/hanwenguo/weibian.git

Note that the binary will be named wb.

Download a release binary

If a release is available for your platform, download it from:

https://github.com/hanwenguo/weibian/releases

Place the binary on your PATH.

Quick start

Using the installed binary:

wb compile

By default, Weibian reads Typst sources from typ/, compiles HTML in-memory, copies assets from public/, and outputs the final site to dist/. Override paths if needed:

wb compile \
  --input typ \
  --public-dir public \
  --output dist

Features

  • Utilizes Typst HTML export: just use your templates/styles
  • Out-of-the-box dark mode support
  • Transclusion of notes
  • Backmatter generation (backlinks, contexts, references, related notes)
  • TOC generation
  • Include/exclude notes based on glob patterns

Planned

  • Customizable post-processing hooks
  • Datalog-based querying of notes
  • Generalized backmatter

After the above features are implemented, Weibian will be feature-comparable to Forester. There are also some other nice-to-have features:

  • Watch mode
  • Pre-processing hook on source files (this can enable generating PDFs, for example)
  • More templating support
  • Parallel processing of notes

These will be on the roadmap for version 2.0.

Differences from Similar Projects

Weibian is following the spirit of Forester. Main differences are now:

  • Forester uses its own markup language and LaTeX/KaTeX for math, and Weibian uses Typst for everything.
  • Forester, as for now, is more mature than Weibian.
  • Forester now generates XML and Weibian generates HTML.

Kodama is a similar project that uses Typst and Markdown to manage notes. The main difference is that Kodama uses Markdown as the primary note format with good Typst support, while uses Typst as the only note format.

Typsite is a project that uses Typst to generate static sites. It is very similar to Weibian in that they both generate a static site from a collection of Typst files. However, Typsite aims to be a general purpose static site generator, and provides many features (e.g. schema, rewriting, etc.) for that. Weibian is more focused on being a tool for taking scientific notes, thus more opinionated and less flexible.

License

This project is licensed under the GNU General Public License v3.0.

Footnotes

  1. Weibian (simplified Chinese: 韦编; traditional Chinese: 韋編; Chinese Pinyin: wéi biān; IPA: [weɪ˧˥ pjɛn˥˥]; roughly “Way-Byen”) means the ancient Chinese technology of bookmaking. Before the invention of paper, Chinese scholars wrote on narrow vertical slips of bamboo or wood (simplified Chinese: 简牍; traditional Chinese: 簡牘) which were then bound together with leather straps to form a book. “韦” (weí) refers to the leather straps used to bind the bamboo slips, and “编” (biān) means to weave, bind, organize or compile. Just as leather straps bind scattered bamboo slips into a scroll, this project aims to weave your notes into a structured, cohesive knowledge base. The name is also a tribute to the spirit of learning and researching. According to 《史记》 (Shiji, or the Records of the Grand Historian), Confucius studied 《易经》(Yijing, or I Ching, or the Book of Changes) with such intensity that the leather bindings of his bamboo book wore out and snapped multiple times. The source text reads: “读《易》,韦编三绝” (“[Confucius] read the Yijing [so frequently that] the leather bindings broke multiple times”). By naming this project Weibian, I honor both the structure of knowledge (the binding) and the persistence required to master it.