Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 9, 2020 11:43 pm GMT

Wouldn't it be cool if DEV could render LaTeX?

Oh neat, you can.

c=a2+b2c = \pm\sqrt{a^2 + b^2}c=a2+b2

Here's the code to produce that snippet:

{% katex %}c = \pm\sqrt{a^2 + b^2}{% endkatex %}

It's new and there will be kinks that need to be worked out.

Kudos to @maestromac for a really fabulous implementation.

GitHub logo Implement KatexTag #6237

What type of PR is this? (check all applicable)

  • [x] Feature

Description

Used katex-ruby gem to make a Katex Liquid Tag.

  • In order to make this work, I had to turn off Redcarpet's superscripts feature. I was more comfortable with this change when I learn that Github and Gitlab shared similar settings.
  • I found it impossible to pass our storybook prebuild because it can't resolve @import _katex as that is a geminifed CSS. I've decided to copy provided CSS into our own app. I'd imagine this would help with serving up CSS for stack bit apps. If this is a bad idea please let me know.

Misc resources:

Related Tickets & Documents

Resolves https://github.com/thepracticaldev/dev.to/issues/182Resolves https://github.com/thepracticaldev/dev.to/issues/97

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Kapture 2020-02-21 at 16 07 15image

Added tests?

  • [x] yes

Added to documentation?

  • [x] yes, need to add in the editor guide

[optional] Are there any post-deployment tasks we need to perform?

n/a

Happy coding!


Original Link: https://dev.to/devteam/wouldn-t-it-be-cool-if-dev-could-render-latex-l45

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To