Allow to live edit markdown with math (rendered by katex) and to render external markdown page containing math formulas.
There is no common solution to manage math in markdown. Several options
are available
but none of them offer the elegance, practicality and ease of use
that mathdown
allows.
mathdown
use marked for generating HTML from markdown. Thus mathdown
supports CommonMark and Github flavored markdown.
Additionally, mathdown
support mathematic formulas using katex.
Inline and math mode are supported.
Inline mode:
Let's define the matrix `$A$`.
Math mode:
The projection then is:
```math
$$p=A\hat x$$
```
The advantage of this solution is that if the markdown engine does not
support math rendering, your equations remain readable as text enclosed in
<code>
blocks.
Download the package through npm:
npm install mathdown
or through git
git clone https://github.com/jdmichaud/mathdown
cd mathdown
npm install
Create a config file:
cat > config.yml << EOF
static_path: static/
port: 8000
template: static/template.mustache
EOF
static_path
points to the static file path.port
is the web server port.template
is the template used to render external markdown. A sample is provided in thestatic
folder.
Launch the server:
node index.js -c config.yml
Go to the root page of your serveur, and a basic live editor can be used to test markdown with math.
http://mathdown.novidee.com/
Once you markdown file is hosted somewhere (github, gist, bitbucket, etc),
you can render it by passing a url to mathdown
:
http://mathdown.novidee.com/toHtml?url=http://your.markdown/url