How to clean integrate latex equation inside markdown files ?
See original GitHub issueHello !
I’m not quite used to the nuxt/content module, and I’ve never integrated latex in nuxt before, so I prefer asking you !
I’d like to write latex equations un mardown files, fetch the files thanks to the nuxt/content module, and display each articles with their equations.
At the end, I’d like to nuxt generate
and serve the website with netlify.
I tried integrating through npm, and by including mathjax script in the nuxt.config.js
head, but none of this worked, and I’d like to know the “best practice” to make a clean website.
Thanks !
edit : I forgot to say, I checked the remark plugin remark-html-katex
and I thought installing it with npm
and adding it to the markdown.plugins section of nuxt.config.js
would have been a success, but it seems nothing happens when I write an equation in a markdown file.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Hey @mathieunicolas,
First of all, to make a clean website, I’d start by using create-nuxt-app:
Then add the
content
module:and register it inside
nuxt.config.js
:Then to support math equations you will need to use remark-math and rehype-katex (
yarn add remark-math rehype-katex
).However, a PR is actually ongoing to extend rehype plugins in the content module, so until it’s merged and released you can set the @nuxt/content dependency to the PR inside your
package.json
:Then in your
nuxt.config.js
, you can register the two plugins:At this point it should be working, you can then write a markdown file with LaTex inside the
content
folder and fetch it in your pages:I’ve made you an example here: https://github.com/benjamincanac/nuxt-content-latex
How can I specify options for the Katex? For example, I’d like it to output HTML instead of MathML as Chrome no longer supports it. https://katex.org/docs/next/options.html Thank you!