What is Matdown?

Matdown is a compact, dependency-free equation parser that turns lightweight math expressions into styled, semantic HTML - no LaTeX, no external libraries, no regrets.
It's inspired by the realization that game engines, like cloud services, are just real-time systems - and HTML/CSS are expressive primitives that deserve more credit.
 - -

Why ?

  • ✅ No parser generators
  • ✅ No ASTs
  • ✅ No LaTeX
  • ✅ No DOM hell
  • ✅ No stylesheets from the Math Wizard Society™ ruining your vibe Instead:
  • ✨ Uses recursive string parsing
  • ✨ Renders DOM directly (fractions, exponents, etc.)
  • ✨ Leverages the box model & inline layout
  • ✨ Comes with a modular, non-intrusive context menu UI  - -

Example Input

(1+x)² / (2x - 3)

⬇️ Becomes

class="fraction">
  class="numerator">(1+x)2
  class="denominator">(2x - 3)

 - -

🛠 How It Works

1. Recursive Descent Parsing

  • Function: buildNode(exp)
  • Splits expression by outermost operator
  • Recursively wraps sub-parts into semantic HTML containers

2. Parentheses Matching

  • Function: matchingParens(str)
  • Uses a counter-based matcher to balance () pairs safely

3. Operator Precedence

  • Left-to-right scan
  • Evaluates only outermost operators unless overridden by parentheses
  • Fast and linear for common math expressions

4. Symbol Search Filtering

  • Smart input filtering using .filter() on a static symbol list
  • Zero-cost search experience for inline math menus  - -

Why Not KaTeX or LaTeX?

They're bloated, margin-fighting, box-model-reinventing beasts.
You don't need a compiler to render a fraction.

You need a

. Matdown leans into browser-native layouts - because HTML is the universal rendering target anyway.

 - -

📦 Install / Use

Matdown is zero-dependency and browser-ready.

Image description

 - -

Philosophy

hakuna matata what a wonderful phrase - just making sure you are still there.
 - -

🧩 Roadmap

  • [ ] Inline editing
  • [ ] Touch-friendly symbol picker
  • [ ] Expand support for integrals/summations
  • [ ] Export to SVG or Canvas  - -

Built By

Daniel Chahla 
Matdown was born from frustration - and built for clarity.
 - -

Github -> https://github.com/dchahla/Project-Matdown

See the Pen
Matdown: Interactive Math Algorithm Composer
by Daniel Chahla (@urdoingitwrong)
on CodePen.

📜 License

MIT License - Bop it, fork it, remix it. Just don't LaTeX it.