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

Languages: 中文 | English (current)

Sanitize Citation Style Language (CSL) files for Hayagriva.

The targeted Hayagriva version: 2026-06-05 v0.10.0, shipped with Typst v0.15.0-rc.1.

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).

However, error messages provided by Hayagriva are not very clear, making it difficult to debug. Even if you understand what Hayagriva is complaining about, you may still have to correct errors one by one and keep recompiling to finally fix a CSL style.

  • 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