Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Katex rendering not working with MDX #1391

Closed
sonapraneeth-a opened this issue Dec 18, 2020 · 5 comments
Closed

Katex rendering not working with MDX #1391

sonapraneeth-a opened this issue Dec 18, 2020 · 5 comments
Labels
👀 no/external This makes more sense somewhere else

Comments

@sonapraneeth-a
Copy link

sonapraneeth-a commented Dec 18, 2020

Subject of the issue

Math blocks not rendering properly when using KaTeX with MDX

Your environment

  • OS: Ubuntu 20.04 (But the issue is not related to OS)
  • Packages:
    • gatsby-plugin-mdx
    • katex
    • gatsby-remark-katex
  • Env:
    • yarn: 1.22.5
System:
    OS: Linux 4.4 Ubuntu 20.04 LTS (Focal Fossa)
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 14.15.1 - ~/Softwares/node/bin/node
    Yarn: 1.22.5 - /usr/bin/yarn
    npm: 6.14.8 - ~/Softwares/node/bin/npm
  npmPackages:
    gatsby: 2.28.1 => 2.28.1
    gatsby-image: 2.7.0 => 2.7.0
    gatsby-plugin-manifest: 2.8.0 => 2.8.0
    gatsby-plugin-mdx: 1.6.0 => 1.6.0
    gatsby-plugin-offline: 3.6.0 => 3.6.0
    gatsby-plugin-react-helmet: 3.6.0 => 3.6.0
    gatsby-plugin-sharp: 2.10.1 => 2.10.1
    gatsby-remark-katex: ^3.6.0 => 3.6.0
    gatsby-source-filesystem: 2.7.0 => 2.7.0
    gatsby-transformer-sharp: 2.8.0 => 2.8.0
  npmGlobalPackages:
    gatsby: 2.28.1

Steps to reproduce

Tell us how to reproduce this issue. Please provide a working and simplified example.

Repo link

  1. Clone the repository
  2. npm install
  3. npm run develop
  4. Open http://localhost:8000/info/
  5. Verify the equation rendering

Website

Expected behaviour

What should happen?

image

image

Actual behaviour

What happens instead?

image

image

@sonapraneeth-a sonapraneeth-a added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Dec 18, 2020
@wooorm
Copy link
Member

wooorm commented Dec 18, 2020

Probably this Gatsby issue: gatsbyjs/gatsby#28031

@wooorm wooorm closed this as completed Dec 18, 2020
@wooorm wooorm added 👀 no/external This makes more sense somewhere else and removed 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Dec 18, 2020
@sonapraneeth-a
Copy link
Author

It looks to be a different issue as even the simplest math formulas are not rendering as opposed to complex formulas in the attached issue.

@wooorm
Copy link
Member

wooorm commented Dec 18, 2020

Hmm, might be?
Regardless, gatsby-plugin-mdx and gatsby-remark-katex are gatsby projects, and to my knowledge often don’t work.
I see you’ve already asked there btw: gatsbyjs/gatsby#28546.

I would personally avoid gatsby-remark-* projects.
You can also use normal remark and rehype plugins: https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-mdx#remark-plugins.
remark-math and rehype-katex should do the trick

@nikoladev
Copy link

@sonapraneeth-a The solution of using regular remark and rehype plugins that @wooorm proposed should work. This is how I set it up to work.

@sonapraneeth-a
Copy link
Author

The workaround by @nikoladev works. Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else
Development

No branches or pull requests

3 participants