CSL sanitizer for Hayagriva
可用于 Hayagriva 的 CSL 样式

Languages: 中文 | English (current)

Sanitize Citation Style Language (CSL) files for Hayagriva.

The targeted Hayagriva version: 2025-12-27 a137441, expected to be shipped with Typst v0.15.0.

Usage: Go to the CSL file list, or install the browser user script and view at Zotero Chinese community’s CSL styles page.

Motivation

Due to the diversity of implementations, many CSL files go beyond the CSL specification, and some even go beyond the CSL-M extension (because Zotero allows arbitrary extra CSL variables). Among 300+ Chinese CSL styles, about 74% are considered malformed by Hayagriva (the engine behind Typst), but all of them are accepted by citeproc-js (the engine behind Zotero).

Unfortunately, Hayagriva hardly provides clear error messages, making it very difficult to debug. It’s likely that you will have to comment out <macro>s and recompile bisectionally in order to locate the problem, even if you understand what Hayagriva is complaining about.

  • Failed to load CSL style (duplicate field layout)
  • Failed to load CSL style (data did not match any variant of untagged enum Term)

This project attempts to help you with these heavy work, letting CSL styles be accepted by Hayagriva.

However, please note that this does not mean the bibliography format will be strictly correct. Details on that can be found in Hayagriva’s support for GB/T 7714—2015 (not available in English at present). In general, Typst still has a considerable gap in Chinese support. Please combine this with other workarounds when necessary.

Chinese CSL styles sanitized for Hayagriva