Skip to content

A markdown/latex viewer that can also renders some wave signals as Fourier polynomials

Notifications You must be signed in to change notification settings

diamond2016/vmark

Repository files navigation

VMark — Markdown + LaTeX Viewer with Server-side Fourier Graphs

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: true
    • graph_type: fourier
    • n: integer, number of harmonics (1..10)
    • omega: float, angular frequency (example: 2.0 for T=π)
    • wave: triangle or square (optional; defaults to triangle)

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).

Example (triangle wave)

graph: true graph_type: fourier n: 5 omega: 2.0 wave: triangle

Then include your LaTeX formula in the body (MathJax will typeset it), and use the placeholder image syntax: ![Triangle Wave Graph]({{ graph|safe }})

Run locally

  1. Install dependencies: python3 -m pip install -r requirements.txt

  2. 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.

About

A markdown/latex viewer that can also renders some wave signals as Fourier polynomials

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published