Sorry, we don't support your browser.  Install a modern browser
This post is closed.

LaTeX rendering#1

Option to write content in LaTeX

a year ago
3
?

I thought it was in “planned” status some time ago, is it the same priority now?

a year ago
B

It would be great to be able to write LaTeX equations in the Markdown editor, and have them rendered server-side using KaTeX. This prevents users from needing to run KaTeX’s JavaScript on every page.

10 months ago
R

A suggestion for math rendering: Let Bear blog Markdown recognize math between $…$ delimiters and convert it to MathML.

MathML is now supported by all three of the major browser engines. You can use a system font for math; that will minimize the page size. A LaTeX-to-MathML conversion library (like my Temml) enables you to do a server-side conversion and avoid JavaScript in the browser. Temml’s CSS can be minified to about 4kb.

MathML renders in high quality in Firefox. Chromium is about 95% reliable. Webkit, not so much. Which means that neither Chromium nor Webkit are currently up to Bear-blog quality standards, so you may want to monitor the situation for a year or so before acting. But I believe that MathML will be the long-term minimalist solution.

10 months ago
1

MathML looks like a good option. Will look into it

10 months ago

It looks like there is good support for MathML. Thanks for the suggestion. I have it converting all content between $$ from Latex to MathML. I’ve updated the docs about it as well: https://docs.bearblog.dev/mathematical-notation/

Please log any bugs as GitHub issues or email me

10 months ago
Changed the status to
Completed
10 months ago
1
R

Support for math! Congratulations!

Small point regarding math delimiters: There is no general consensus, but GitHub, StackOverflow, and Pandoc all use $…$ for inline math. Following their example would align you with the web’s biggest consumers of math notation.

Pandoc adds a condition that the opening $ must have a non-space character immediately to its right, while the closing $ must have a non-space character immediately to its left and must not be followed immediately by a digit. Thus, $20,000 and $30,000 won’t parse as math.

The choice of delimiters is a small matter. The big news is that you now support math. If you choose to stick with $$…$$, that is a perfectly valid choice.

10 months ago

I was following the style UpMath uses with sticking with $$ universally, but used linebreaks to represent blocks vs inlines. I think I’m going to stick with this format since it reduces the chance of me missing a corner case and someone writing about money casually creating a math block. Eg:

I made $20 last week. I really like making $ because it's neat.

10 months ago
1