What this repo does
- Renders Markdown files (with LaTeX via MathJax) in a simple Flask app.
- Supports one inline server-generated graph per Markdown file via YAML frontmatter.
- Computes Fourier partial sums (exponential form) server-side using NumPy + Matplotlib and embeds the PNG as a base64 data-URL.
Authoring Markdown with a graph
- Put YAML frontmatter at the very top of the file (begin with
---). - Required frontmatter keys:
graph: truegraph_type: fouriern: integer, number of harmonics (1..10)omega: float, angular frequency (example: 2.0 for T=π)wave:triangleorsquare(optional; defaults totriangle)
The document body can still include arbitrary Markdown or LaTeX formulas rendered by MathJax, while the YAML block drives the Fourier plot (triangle, square, or the new saw wave example in fourier_3.md).
Then include your LaTeX formula in the body (MathJax will typeset it), and use the placeholder image syntax: 
Run locally
-
Install dependencies: python3 -m pip install -r requirements.txt
-
Start server (option A: open a specific markdown file on start): python3 app.py fourier_1.md
Option B: start server and upload files in the UI: python3 app.py Open http://127.0.0.1:5000
Testing
- Unit tests for the graph renderer are in
tests/test_graph_renderer.py. Run: pytest -q
Notes
- Inputs are validated:
1 <= n <= 10. Invalid params produce an inline error box instead of an image.
Examples: render fourier_1.md, fourier_2.md, and fourier_3.md demonstrate triangle, square, and saw wave graphs respectively.