uetchy / math-api

Put LaTeX Math equation on everywhere as <img> tag.

Home Page:https://math.vercel.app

Repository from Github https://github.comuetchy/math-apiRepository from Github https://github.comuetchy/math-api

Does not follow Github theme

kozross opened this issue · comments

If I have an inclusion like below in a Github wiki page:

![Equation](https://math.vercel.app?from=%5Cleft%28%5Cbegin%7Barray%7D%7Bccccc%7D%0A1%20%26%202%20%26%203%20%26%204%20%26%205%20%5C%5C%0A2%20%26%205%20%26%204%20%26%203%20%26%201%0A%5Cend%7Barray%7D%5Cright%29.svg)

I get this on a Github light theme:

Screenshot from 2022-04-07 08-48-11

But it works fine on a dark one:

Screenshot from 2022-04-07 08-49-07

I can forcibly set the text colour, but this feels like a bug, plus there isn't really a good choice of colour that would work on both light and dark themes.

Is your system theme in dark mode?

@uetchy Yes, but this happens even if I set Github to ignore it.

Hmm what should we do? Basically two options

  1. Ditch automatic color switching & add background
  2. Grey color as a default

Being able to force a background colour would fix this issue for me.

Just found this option in GitHub docs. Maybe we can also offer more fine-grained Markdown tags for GitHub users in the online editor.
https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#specifying-the-theme-an-image-is-shown-to

![Dark](https://math.vercel.app?from=\LaTeX&color=white#gh-dark-mode-only)
![Light](https://math.vercel.app?from=\LaTeX&color=black#gh-light-mode-only)

DarkLight

^Maybe this only works in actual Markdown files?


Turned out this trick doesn't play nice with .svg 🤷‍♂️
https://github.community/t/support-theme-context-for-images-in-light-vs-dark-mode/147981/96

This also doesn't work on Github wiki pages.

Screen Shot 2022-04-12 at 16 54 05

Screen Shot 2022-04-12 at 16 54 25

Released