Skip to content

Feather MD v1.8.0

Choose a tag to compare

@github-actions github-actions released this 07 Jun 15:01

This is a minor feature update adding advanced document extensions (math rendering and interactive diagrams) alongside user interface polishing and keyboard layout adjustments.

Summary:

  • Math Support: You can now write inline math (using $E = mc^2$) and block math (using $$...$$) directly in your markdown documents, which render smoothly in the preview pane.
  • Mermaid Diagrams: Fenced code blocks tagged with mermaid or mmd (e.g., Gantt charts, flowcharts, Git graphs) will now automatically render as rich, interactive diagrams.
  • Improved Printing: Printed outputs and PDF exports will now always use the clean, highly-readable "snow" (light) theme, ensuring diagrams and text remain perfectly legible regardless of your active editor theme.
  • Tuned Keyboard Controls: The leader-key system (used for Alt + T/F/D cycling) now disarms much faster (in 800 milliseconds instead of 2 seconds) once you finish cycling, meaning arrow keys return to normal text navigation almost immediately.
  • Reorganized Shortcuts Dialog: The shortcuts dialog is now grouped by category (File, View, Style, Editor, App), supports Escape key dismissal, and can be toggled using the Ctrl + . shortcut.
  • Updated Scratchpad: The welcome text has been refreshed with direct examples of KaTeX equations, Mermaid diagrams, and updated instructions.

Technical Details:

  • Dynamic Imports & Code-Splitting: Dynamic dynamic-imports are used to lazy-load the heavy katex and mermaid libraries only when the parser detects math delimiters or diagram code blocks. Highlighting modules are also fetched via Vite's import.meta.glob on-demand to keep initial startup memory under 30 MB.
  • Marked Extensions: Custom tokenizers parse blockMath and inlineMath before syntax highlighting or general markdown generation, parking raw TeX inside custom data-tex attributes so that it survives DOMPurify HTML sanitization.
  • LRU Caching: Bounded LRU caches (mathCache size 256, mermaidCache size 64) store rendered SVG/HTML output. This ensures active typing in the editor pane does not trigger redundant compilation passes for unmodified blocks.
  • Theme Parity for SVG Diagrams: Mermaid initializes dynamically with the correct light or dark variant. Theme shifts trigger refreshForThemeChange(), which re-renders SVG nodes in-place without restarting the entire markdown compiler. Height pinning prevents layout layout-shifts and viewport scrolling jumps during async re-renders.
  • Print Override: Intercepts window.print() to switch the top-level HTML data-theme attribute to snow and awaits Mermaid theme refresh before letting the browser print the layout. Restores the user's active theme in an afterprint listener.
  • Keyboard Chord Tuning: Modified armLeader inside src/core/keyboard.js to accept a custom timeout duration, updating the post-cycle re-arm to use LEADER_CYCLE_REARM_MS (800 ms) while leaving the initial chord window at LEADER_WINDOW_MS (2000 ms).
  • Test Coverage: Added tests/preview/math-mermaid.test.js written in Vitest to run tokenization checks, false-positive currency guards, invalid math error boundaries, and integration sanitization checks under jsdom.