A beautiful MkDocs-Material site for explaining Codeforces solutions - with runnable code, Mermaid diagrams, tag filters, and a live dashboard.
Live demo: LeoYan Solutions π
| Feature | How |
|---|---|
| π Markdown with LaTeX | MkDocs + MathJax |
| π Mermaid diagrams | pymdownx.superfences |
| π Dark / Light theme | Material palette toggle |
| π·οΈ Tags per problem | mkdocs-material tags plugin |
| π Tag filter + search | Custom JS on home page |
| π Dashboard charts | Chart.js (difficulty + topics) |
| Pyodide (WebAssembly) | |
| π Try C++ online | Opens Wandbox with your code |
| π Auto-deploy | GitHub Actions -> GitHub Pages |
git clone https://github.com/PilotLeoYan/leoyan-solutions.git
cd leoyan-solutionspip install -r requirements.txtIn mkdocs.yml, replace every PilotLeoYan and YOUR_CF_HANDLE:
site_url: https://PilotLeoYan.github.io/leoyan-solutions/
repo_url: https://github.com/PilotLeoYan/leoyan-solutionsmkdocs serveOpen http://127.0.0.1:8000.
-
Copy the template:
cp docs/problems/_template.md docs/problems/999X-my-problem.md
-
Edit the YAML frontmatter:
--- title: "999X β My Problem" problem_id: "999X" problem_url: "https://codeforces.com/problemset/problem/999/X" difficulty: 1400 date_solved: "2025-01-01" tags: - binary search - greedy ---
-
Write your explanation using any of:
=== "Python"/=== "C++17"tabbed code blocks```mermaiddiagrams!!! note "Complexity Analysis"admonitions$O(n \log n)$inline LaTeX
-
Add it to the
navsection inmkdocs.yml. -
Push:
git add docs/problems/999X-my-problem.md mkdocs.yml git commit -m "feat: add 999X My Problem" git push
GitHub Actions auto-builds and deploys in ~60 seconds.
leoyan-solutions/
βββ .github/workflows/
β βββ deploy.yml # CI/CD -> GitHub Pages
βββ docs/
β βββ overrides/
β β βββ home.html # Custom home page template
β βββ problems/
β β βββ _template.md # Copy this for new problems
β β βββ 4A-watermelon.md
β β βββ ...
β βββ data/
β β βββ problems.json # Auto-generated by MkDocs hook
β βββ javascripts/
β β βββ extra.js # Home dashboard (charts, filter)
β β βββ code-runner.js # Pyodide + Wandbox buttons
β β βββ mathjax.js # Render LaTeX
β βββ stylesheets/
β β βββ extra.css # Custom styles
β βββ index.md # Home page (uses home.html)
β βββ about.md
βββ scripts/
β βββ generate_data.py # MkDocs hook: builds problems.json
βββ mkdocs.yml
βββ requirements.txt
βββ README.md
- Push to
main. - GitHub Actions runs and pushes to the
gh-pagesbranch. - In your repo -> Settings -> Pages, set source to
gh-pagesbranch.
Switch between light and dark with the sun/moon toggle in the top-right.
To add more colour schemes, edit the palette section in mkdocs.yml:
palette:
- scheme: default # light
primary: deep-purple
accent: cyan
- scheme: slate # dark
primary: deep-purple
accent: cyanMIT - do whatever you like with it.