Skip to content

template: Thai bilingual support, visuals, citations, and authoring spec#3

Merged
izolyte merged 3 commits into
mainfrom
template/bilingual-visuals-polish
Jun 20, 2026
Merged

template: Thai bilingual support, visuals, citations, and authoring spec#3
izolyte merged 3 commits into
mainfrom
template/bilingual-visuals-polish

Conversation

@izolyte

@izolyte izolyte commented Jun 20, 2026

Copy link
Copy Markdown
Owner

What & why

Lays the foundation every problem file needs: Thai rendering, a consistent
visual language, a citation/diagram toolkit, and the authoring spec that
documents all of it. Without this, -th siblings show tofu, there's no
enforced way to link theorems, and the header/footer are inconsistent.

Closes #2

Changes

Rendering

  • src/style.typ: Thai font fallback (fonts-thai-tlwg); CI installs it so -th siblings render correctly
  • src/template.typ: editorial header (eyebrow + accent rule), two-tone section headings, brand/page footer, end-of-solution mark, hyphenation; equations unnumbered by default; section menu adapts to what's used

Toolkit (src/components.typ)

  • cite(name, url:/ref:) — link a named result; no-source → red [ref?]
  • diagram(body, caption:) — CeTZ figure wrapper
  • answer(), numbered() helpers

Index + docs

  • scripts/build-index.sh: drops the difficulty column; skips -th siblings
  • docs/CONVENTIONS.md: bilingual sibling naming, sourcing-results invariant
  • docs/AUTHORING.md: full authoring spec (section order, quality bar, bilingual rules, tool reference)
  • problems/_TEMPLATE.typ: updated for new environments and section menu

Checklist

  • Compiles: make compile P=<topic>-### (every problem file compiles standalone; main stays green)
  • Index in sync: ran make index after touching metadata

Notes

_TEMPLATE.typ is the best place to review how the new environments fit together.
Screenshots of the rendered header/footer before and after are worth attaching.

Summary by CodeRabbit

  • New Features

    • Added Thai language support for problem authoring and rendering.
  • Documentation

    • New authoring guidelines document with problem structure, solution standards, and pre-commit checklist.
    • Updated conventions for Thai-language problem variants and citation requirements.
  • Chores

    • Removed difficulty ratings from problem index.
    • Simplified problem metadata structure.

izolyte added 2 commits June 18, 2026 03:06
- Thai font fallback in src/style.typ; CI installs fonts-thai-tlwg so -th
  sibling files render instead of showing tofu
- editorial header (eyebrow, accent rule), two-tone section headings,
  brand/page footer, end-of-solution mark, and hyphenation
- adaptive section menu with Answer / Idea / Application; equations are
  unnumbered by default
- components: cite() for linked theorem references, diagram() for CeTZ figures,
  plus answer() and numbered() helpers
- build-index: drop the difficulty column and skip -th siblings
- docs/CONVENTIONS: bilingual sibling naming and a sourcing-results invariant
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0afa5255-b4bd-4f33-8bb9-b81c53270447

📥 Commits

Reviewing files that changed from the base of the PR and between 3fca885 and be8fb22.

📒 Files selected for processing (4)
  • docs/AUTHORING.md
  • docs/CONVENTIONS.md
  • problems/_TEMPLATE.typ
  • src/style.typ
✅ Files skipped from review due to trivial changes (2)
  • docs/CONVENTIONS.md
  • docs/AUTHORING.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/style.typ
  • problems/_TEMPLATE.typ

📝 Walkthrough

Walkthrough

Four new Typst helper components (diagram, answer, numbered, cite) are added to src/components.typ. The doc() template drops difficulty and summary parameters, gains a redesigned title block with tag eyebrow and meta line, and adds Thai font fallbacks. CI installs Thai fonts via apt. The index script removes the Difficulty column and skips -th sibling files. A new docs/AUTHORING.md and updates to docs/CONVENTIONS.md and README.md document the new conventions.

Changes

Authoring Overhaul

Layer / File(s) Summary
New Typst components: diagram, answer, numbered, cite
src/components.typ
Adds diagram (captioned figure wrapper), answer (themed breakable box), numbered (forced equation numbering), and cite (URL link / footnote / red placeholder branching).
Thai font fallbacks and CI font install
src/style.typ, .github/workflows/ci.yml
Extends default-theme.font with "Norasi", "Leelawadee", "Tahoma" fallbacks and adds an apt-get step to install fonts-thai-tlwg in the CI compile job.
doc() signature and title block redesign
src/template.typ
Removes difficulty and summary parameters; disables default equation numbering; rewrites h1 rendering with counter; restructures footer as a two-column grid; replaces the heavy double-rule title block with a tag eyebrow, pipe-separated meta line, conditional tag pills, and a closing diamond mark.
Index script: drop difficulty, skip Thai siblings
scripts/build-index.sh
Rewrites problem_files() to skip _TEMPLATE.typ and *-th.typ; removes difficulty stars; updates per-problem rows to use date; changes the Markdown table schema to # | Problem | Topics | Source | Solved.
Problem _TEMPLATE.typ overhaul
problems/_TEMPLATE.typ
Imports cite/numbered/answer/diagram; removes difficulty/summary from doc.with(); restructures sections into a fixed menu order with new Answer, Idea, and Application slots; rewrites Solution guidance to require reason: and cite() per #step, ending with #theorem.
Authoring docs and README updates
docs/AUTHORING.md, docs/CONVENTIONS.md, README.md
Adds AUTHORING.md with full end-to-end authoring guidelines; extends CONVENTIONS.md with Thai sibling naming and citation sourcing rules; updates README.md to reflect the new index schema, Thai sibling behavior, and pinned CeTZ caching.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 A rabbit hops through the Typst grove,
Tags bloom as eyebrows, the double rule's retired,
Thai glyphs now render — no more tofu despaired!
cite() weaves footnotes where references are required,
And answer boxes shine, neatly attired. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main changes: Thai bilingual support, visual design (eyebrow header, footer), citation/diagram components, and authoring documentation. It accurately reflects the primary objectives.
Linked Issues check ✅ Passed The PR successfully addresses issue #2 by replacing the heavy double-rule title block design with a refined editorial header featuring an eyebrow and single accent rule, creating better visual hierarchy.
Out of Scope Changes check ✅ Passed All code changes are directly related to the PR objectives: Thai font support, template redesign with new visual elements, new component functions, documentation updates, and build script modifications. No unrelated changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch template/bilingual-visuals-polish

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/AUTHORING.md`:
- Around line 12-15: The fenced code block containing the "Problem Statement →
Answer → Setup & Notation → Idea → Solution → Verification → Reflection →
Application" statement is missing a language identifier, which violates the
MD040 linting rule. Add a language tag (such as `text`) immediately after the
opening triple backticks to specify the code block language and satisfy the
linter requirements.
- Line 103: The documentation at line 103 in AUTHORING.md references a `summary`
field that no longer exists in the current template metadata. Remove the mention
of the `summary` field from this line to prevent misleading authors about
available metadata fields. Keep only the accurate guidance about the fields that
are actually exposed in the current template.

In `@docs/CONVENTIONS.md`:
- Around line 69-72: The fenced code block in the CONVENTIONS.md file at the
location showing the example filenames (calc-001-gamma-integral.typ and
calc-001-gamma-integral-th.typ) is missing a language tag, which triggers the
MD040 linting rule. Add a language identifier after the opening triple backticks
of this code fence by specifying "text" as the language tag to indicate it is
plain text content.
- Around line 75-79: The phrase "so no script or CI change is needed" on line 75
is ambiguous and conflicts with the later mention of "CI installs them via
`fonts-thai-tlwg`". Clarify the scope by narrowing the statement to explicitly
indicate that no script or CI change is needed specifically for filename
validation (the make new numbering step), while acknowledging that font
installation via CI is already handled separately. Revise the wording to make it
clear that the "no change needed" only applies to the make new process, not to
the existing CI font installation.

In `@problems/_TEMPLATE.typ`:
- Line 6: The checklist comment on line 6 currently only references the
URL-based citation form with `cite(name, url:)`, but the template also supports
offline citations using `cite(name, ref: [...])`. Update the comment to
explicitly mention both citation forms so authors understand that either URL
citations or offline references (for books/papers) are acceptable citation
methods, removing the implication that only URL citations are supported.

In `@src/style.typ`:
- Around line 24-29: The comment in the font declaration block incorrectly
states that missing fonts are skipped with a harmless warning. Replace this
inaccurate statement with an accurate description of Typst's actual font
fallback behavior: when fallback is enabled (the default), missing fonts are
silently substituted with the best available match without generating warnings;
when fallback is disabled, missing glyphs render as replacement boxes instead.
Keep the accurate information about Norasi being provided by the fonts-thai-tlwg
package and the other font names.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f4834a9e-52c3-425c-a01d-1fd6134719d0

📥 Commits

Reviewing files that changed from the base of the PR and between 7f908b9 and 3fca885.

📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • README.md
  • docs/AUTHORING.md
  • docs/CONVENTIONS.md
  • problems/_TEMPLATE.typ
  • scripts/build-index.sh
  • src/components.typ
  • src/style.typ
  • src/template.typ

Comment thread docs/AUTHORING.md Outdated
Comment thread docs/AUTHORING.md Outdated
Comment thread docs/CONVENTIONS.md Outdated
Comment thread docs/CONVENTIONS.md Outdated
Comment thread problems/_TEMPLATE.typ Outdated
Comment thread src/style.typ
@izolyte izolyte added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 20, 2026
@izolyte izolyte merged commit 973d5de into main Jun 20, 2026
3 checks passed
@izolyte izolyte deleted the template/bilingual-visuals-polish branch June 20, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

style: simplify the heavy double rule in the title block

1 participant