Skip to content

forward resync stripped a MyST directive argument: {raw} jupyter -> {raw} (sir_model, v0.17.0) #119

Description

@mmcky

The resync stripped the argument from a MyST directive, turning {raw} jupyter into a bare {raw} and breaking the strict build.

What happened

In lectures/sir_model.md in lecture-python.zh-cn, the standard QuantEcon notebook-header directive opens with {raw} jupyter. After the resync it opened with a bare {raw} — the jupyter argument was gone. The directive body (the qe-notebook-header div) was untouched.

Under a strict build this fails with:

sir_model.md:24: Directive 'raw': 1 argument(s) required, 0 supplied

The English source is correct — it carries {raw} jupyter — so this is introduced in translation, not inherited.

Scope

Isolated, but from a large population. Across lecture-python.zh-cn:

count
lectures with a correct {raw} jupyter 50
lectures with the argument stripped 1 (sir_model)

So 50 files round-tripped the same directive correctly and one did not. That rules out a systematic transformation and points at something non-deterministic — most likely the translator model touching a line it should have passed through verbatim.

Why it wasn't caught

The edition's CI lacked -n -W on the notebook build (since fixed in QuantEcon/lecture-python.zh-cn#185), so the malformed directive did not fail the build at merge time. It surfaced only on a later cold strict build, alongside the unrelated corruption in #118.

Fixed downstream

Repaired in QuantEcon/lecture-python.zh-cn#183.

Likely relation to #65

#65 reports the translator dropping MyST label anchors like (label)= before headings. This looks like the same underlying class — the translator mutating MyST structural syntax it does not recognise as non-prose — with a different surface symptom. Filing separately because the affected construct and the failure mode differ, but they may well share a fix: whatever mechanism is meant to hold MyST directive lines constant through translation is not holding.

Suggested guard

A directive-shape assertion on write would catch both this and #65 cheaply: for every fenced directive in the output, the info string should match the corresponding directive in the source, argument included. Any divergence in the {directive} arg line is a translation defect by definition — those lines are never legitimately translated.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions