Using mathsvex
Overview
We wrote mathsvex with the previous discussion on mdsvex in mind.
This site is built with mathsvex
Using mathsvex
md files
Just like in mdsvex, mathsvex preprocessors transform .md
files into Svelte components. Handling of
mathematical markup (powered by Temml) is built in.
Unlike mdsvex, however, we do not currently support frontmatter or mixing Svelte and markdown within .md
files.
math.js files
To mix Svelte and markdown, we author our content in a .math.js
(or ts) file. This file
should define a variable named contents
which is either a string (treated as Markdown)
or an Array with a mixture of strings and Svelte components.
Loading...
mathsvex starter
We have written a mathsvex starter for reference on how to get started.
Djot
We keep talking about Markdown, but mathsvex actually uses Djot instead of Markdown.
The Djot syntax is very similar to Markdown, with only a few main differences to take note of.
Markdown is awesome, but occasionally we run into edge cases where the output isn’t quite what we intended (or is different under different parsers/renderers). We have found working with Djot to be more consistent and easier to reason about.
We’re sorry for the false advertising, but for name recognition and developer tooling reason have decided to call it “Markdown”. We do hope that some day the project grows to a level where it has immediate name recognition.
Let’s build mathsvex together
mathsvex is a new project with limited functionality outside of what is presented above. We welcome discussion on Github for bug reports, and discussion on potential features going forward.