QIAOPANG.COM · SELECTED ESSAYS (2013–2026) · 260 ESSAYSBrowse Chronologically (2013 → 2026) ↗
QiaoPang · Programmers LifeSelected Essays · Systems, Craft & Agentic Era
Timeline ↗

Reading the Zizhi Tongjian in a Different Posture?

Reading the Zizhi Tongjian in a Different Posture?

It begins in tu wei da yuan xian.

Anyone who has read the Tongjian will smile at that opening move. It is a piece of Tongjian cant, a shibboleth as good as “the earth shakes the high ridge; one stream, one range, a thousand years of splendor.”

As a programmer who has read the Records of the Grand Historian from cover to cover (skipping the “Treatises” and the “Tables”), I still found a doorstop like the Zizhi Tongjian remarkably inconvenient to read. First, the time cost is steep — a single page often takes half an hour to an hour, and there is no avoiding the dictionary for the pronunciation and meaning of obscure characters. Second, deep reading is hard — the relations among a great mass of place names, personal names, and dates cannot be sorted out quickly, so I come away from the intricate web of events still muddled. Third, notes are difficult to handle, whether I am reading a physical book or an e-book: portraits of the figures and maps of the events (mostly battles) cannot be set cleanly against the text. And finally, three million characters in two hundred ninety-four juan tends to make readers give up before they even begin.

What a pity! Prose this exquisite, allusions this vivid, a learning of how to enter the world and how to withdraw from it so profound — a vast and magnificent work that lets one know the rise and fall of dynasties, distinguish right from wrong, and mirror the future — abandoned by us for no better reason than a pile of “inconveniences”!

So the idea of a filmstrip edition of the Zizhi Tongjian took root. My reading time comes in fragments, so I wanted to be able to read a small passage in idle moments, without sighing over a brick of a book I could not lift. I wanted the document itself to be alive — the condiments that aid understanding (annotations, images, maps) added continuously, in a simple and lightweight way. And I wanted the document itself to be beautiful, easy on the eye. Those were the original goals of this filmstrip edition.

A programmer tackling something like this puts efficiency first: whatever code can do, brute force must not. So the goal was broken down:

  • Select a high-quality plain-text edition of the Zizhi Tongjian
  • Split the text into 294 juan, one filmstrip per juan
  • Automatically generate filmstrips in the marp format, with some formatting cleanup
  • Generate distinct formats for quotations
  • Place an audio tag on every slide so the audio material for that page can play, e.g. 臣光曰
  • Recruit friends to record the audio for every slide Generate the audio for every slide automatically
  • Read it all through, adding annotations, relevant images, and maps

Splitting the document is something csplit handles beautifully — no code required at all. Turning the text into audio material and filmstrips takes more thought: I need a small script to convert each sliced-out juan into a JSON array, for later use in generating filmstrips or audio.

The JSON array looks like this — besides the content itself, it carries a field for whether audio should be generated:

[
  {
    "text": "# 周纪 第三章 周纪三"
  },
  ...
  {
    "text": "魏惠王薨,子襄王立。孟子入见而出,语人曰:“望之不似人君,就之而不见所畏焉。卒然问曰:‘天下恶乎定?’吾对曰:‘定于一。’‘孰能一之?’对曰:‘不嗜杀人者能一之。’‘孰能与之?’对曰:‘天下莫不与也。王知夫苗乎?七八月之间旱,则苗槁矣。天油然作云,沛然下雨,则苗浡然兴之矣。其如是,孰能御之?’”",
    "audio": "6.mp3"
  },
  ...
]

For the audio I first considered pooling the efforts of volunteers, but then found that iFlytek’s TTS is already quite good — in nearly every case the pronunciation and word segmentation are correct — so I decided to generate it automatically.

The filmstrips are made with a tool called marp, which supports a rich set of Markdown syntax and extensions and meets my needs for image layout, annotations, and footnotes.

The finished slides look like this:

Reading the Zizhi Tongjian in a Different Posture?

Reading the Zizhi Tongjian in a Different Posture?

Reading the Zizhi Tongjian in a Different Posture?

Video:

The first ten juan have now been largely completed, and you can page through them yourself. Because of API rate limits, audio generation has only reached juan 74. You are welcome to read and contribute at the same time — for contributions see github.com/tyrchen/tongjian; to read, go directly to https://tyrchen.github.io/tongjian.

In the future I will go through it juan by juan, tidying up notes along the way. Automatic generation of podcasts for iTunes and Google Play is also in the works; if you have thoughts after reading, share them with me. After all, to delight alone is not as good as to delight together.

A Moment of Zen

Your servant Guang says: The I Ching says, “The noble person accumulates much knowledge of past words and deeds in order to cultivate his virtue.” Confucius said, “In speech, it is enough that the meaning be conveyed.” So then, history is one facet of the Ru teaching, and letters are its bywork; as for the emptiness and nothingness of Laozi and Zhuangzi, that assuredly is not fit to be taught. Learning exists for the sake of seeking the Way; there are not two Ways under heaven — how could there be four studies!

MORE IN Essays & Reading

Further Reading in This Column

View all essays in “Essays & Reading” →

Happy New Year!

In the blink of an eye, a twelfth of 2020 is gone — has your New Year plan kept pace? After a month of outrage over attacks on doctors and anxiety over Wuhan's outbreak, I send New Year wishes along with a guide to a long holiday without regret: books, Rust, and time with the kids.

Book Next Chronicles (2013–2020)3,608 chars · 8 min read