Skip to content

Add TeX/LaTeX equation rendering #2

@tiwa-cc

Description

@tiwa-cc

Add TeX/LaTeX equation support for scientific and technical DocIR documents.

This issue focuses on rendering mathematical expressions safely and consistently across supported renderers.

Goal

  • Add an equation-oriented DocIR block
  • Support TeX/LaTeX source as structured content
  • Keep rendering behavior renderer-managed
  • Avoid allowing arbitrary HTML inside equations
  • Preserve meaning when exporting to Markdown

Candidate block shape

* type: equation
  title: Mass-energy equivalence
  tex: |
  E = mc^2
  display: block
  variables:

  * symbol: E
    description: energy
    unit: J
  * symbol: m
    description: mass
    unit: kg
  * symbol: c
    description: speed of light
    unit: m/s

Renderer behavior

  • Plain HTML renderer should support readable equation output
  • Bootstrap renderer should render equations with suitable spacing and styling
  • Markdown renderer should export equations as TeX-compatible Markdown
  • TeX rendering should be optional and should not be required for normal documents

Possible rendering engines

  • KaTeX
  • MathJax

Configuration direction

engine = "katex"
mode = "cdn"

Possible modes

  • cdn
  • bundled
  • plain
  • pre_rendered

Acceptance criteria

  • An equation or math block schema is defined
  • TeX content is escaped and handled safely
  • Plain HTML and Bootstrap renderers can render or gracefully fallback
  • Markdown renderer exports TeX in a readable form
  • At least one sample document includes an equation
  • Invalid or unsupported math rendering modes produce readable errors

Non-goals

  • Do not implement a full TeX engine
  • Do not allow arbitrary HTML inside math blocks
  • Do not require math rendering for documents that do not use math blocks
  • Do not make KaTeX or MathJax mandatory for all renderers

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions