week-5-module-2 / docs /03_rendering_protocol.md
iurbinah's picture
Upload 4 files
46302e8 verified

Protocol: Rendering Mathematical Notation

1. The Standard: Unicode

To ensure simplicity, performance, and a dependency-free codebase, all mathematical notation in this application MUST be written using standard Unicode characters.

Rationale

Using Unicode for mathematical symbols (e.g., p̂₁, , Σ) instead of a complex typesetting library like KaTeX or MathJax offers several advantages for this project:

  • Simplicity: Content is human-readable directly in the source code.
  • No Dependencies: The application does not need to load any external libraries, fonts, or stylesheets for math rendering. This improves load times and reduces potential points of failure.
  • Performance: Rendering is instantaneous as symbols are native text characters.

2. Implementation

All mathematical symbols should be entered directly into the strings within src/data/slides.ts.

  • Correct: 'The difference we observe is simply p̂₁ - p̂₂.'
  • Correct: { type: 'formula', tex: 'SE(p̂₁ - p̂₂) = √((p₁(1-p₁)/n₁) + (p₂(1-p₂)/n₂))' }

Basic HTML tags like <strong> and <em> can be used within text strings for emphasis. These will be rendered using dangerouslySetInnerHTML, which is considered safe as the content is developer-controlled and static.

3. Forbidden Practices

  • Do not use TeX or LaTeX syntax (e.g., \hat{p}_1, \frac{}{}).
  • Do not add any math rendering libraries like KaTeX or MathJax to the project.
  • Do not use images for formulas. All math must be text-based.