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 support #33

Closed
qazip opened this issue Jan 17, 2019 · 3 comments
Closed

Katex support #33

qazip opened this issue Jan 17, 2019 · 3 comments

Comments

@qazip
Copy link

qazip commented Jan 17, 2019

Hey there,

First of, let me congratulate you for this great theme. Thank you for open-sourcing it.

Would you be so kind as to give me a hand on how to support katex for blog posts that have math?

I tried doing what is in this comment and also what is in this blog post but neither work.

@Track3
Copy link
Owner

Track3 commented Jan 19, 2019

I don't know much about these, but according to KaTeX docs here, you can simply create a file layouts\partials\extra-head.html, inside that add these lines:

{{- if .Content }}
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.css" integrity="sha384-9eLZqc9ds8eNjO3TmqPeYcDj8n+Qfa4nuSiGYa6DjLNcv9BtN69ZIulL9+8CqC9Y" crossorigin="anonymous">
	<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.js" integrity="sha384-K3vbOmF2BtaVai+Qk37uypf7VrgBubhQreNQe9aGsz9lB63dIFiQVlJbr92dw2Lx" crossorigin="anonymous"></script>
	<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/contrib/auto-render.min.js" integrity="sha384-kmZOZB5ObwgQnS/DuDg6TScgOiWWBiVt0plIRkZCmE6rDZGrEOQeHM5PcHi+nyqe" crossorigin="anonymous"
		onload="renderMathInElement(document.body);"></script>
{{- end }}

This should work, it will add KaTeX rendering to every page that has markdown content.

@qazip
Copy link
Author

qazip commented Jan 21, 2019

Thank you, that worked perfectly!

@qazip qazip closed this as completed Jan 21, 2019
@NullSense
Copy link

Any updates on this? I could add this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants