riggraz / no-style-please

A (nearly) no-CSS, fast, minimalist Jekyll theme.
https://riggraz.dev/no-style-please/
MIT License
1.1k stars 542 forks source link

KaTeX Support #62

Open serhatbe opened 1 year ago

serhatbe commented 1 year ago

Great theme, many thanks to riggraz. Can anyone help with adding formulas to posts or pages, something like this:

$$f(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi$$

$$f(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi$$

Within github, formula is displayed fine but the rendered webpage does not show formula properly, just as a code.

Thanks in advance.

kekavigi commented 1 year ago

I think there are several ways to display KaTeX on the webpage. The easiest way is to add the 'starter template' in the KaTeX documentation to _includes/head.html.

If there are only a few pages that will use KaTeX, another better way is to add custom YAML like use_math: true to the front-matter of the page you want to render. For this to work, you also need to add the following line to _includes/head.html.

{% if page.use_math %}
 <!-- insert KaTeX starter template here -->
{% endif %}

yet another way to render formulas, is to use a Jekyll plugin such as Jektex.

yagarea commented 7 months ago

If you want to I can make pull request adding jektex. Jektex is very lighweigth and does not bloat the rendered site itself.

serhatbe commented 7 months ago

Yes, I’d like to see how it works, thanks.

yagarea commented 7 months ago

I have made pull request #73 adding this feature.

serhatbe commented 7 months ago

What are the next steps? Thanks.

yagarea commented 7 months ago

What are the next steps? Thanks.

I have made pull request to this repository. If @riggraz decides to accept this PR then you will just have to update no-style-please gem in your repo.

serhatbe commented 7 months ago

Great, thanks very much.

yagarea commented 6 months ago

If @riggraz does not merge this PR soon feel free to contact me and I can make PR for you personally.