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

Opsjon: støtte inline-matematikk med Pandoc og Katex. #52

Open
teodorlu opened this issue Dec 6, 2023 · 0 comments
Open

Opsjon: støtte inline-matematikk med Pandoc og Katex. #52

teodorlu opened this issue Dec 6, 2023 · 0 comments
Labels
opsjon Something we can choose to do

Comments

@teodorlu
Copy link
Collaborator

teodorlu commented Dec 6, 2023

Brukerbehov

Eksempel fra https://mikrobloggeriet.no/luke/luke-3/ av @finninde:

image

Han skriver matte -- men får dessverre ikke formater matematikken pent.

Kontekst: matematikk med Pandoc og KaTeX

Pandoc har allerede støtte for rendering av matematikk i HTML: https://pandoc.org/chunkedhtml-demo/3.6-math-rendering-in-html.html

Men det funker ikke ut av boksen. Vi bruker ikke Pandoc til å lage fulle HTML-sider, vi skriver blant annet vår egen header.

Jeg tror likevel vi kan bruke pandoc med --katex, og manuelt lage en HTML-header med det vi trenger av javascript og css for å få KaTeX til å funke: https://katex.org/docs/browser

Løsningsforslag

Start med det som funker rett i Pandoc:

$ cat doc.md                                    
# Finn

$$
R_m = 2 \cdot 10^{-4}
$$
$ pandoc doc.md -o doc.html --standalone --katex
[WARNING] This document format requires a nonempty <title> element.
  Defaulting to 'doc' as the title.
  To specify a title, use 'title' in metadata or --metadata title="...".

som lager dette dokumentet:

image

så:

  1. Se akkurat hva slags HTML som lages, både i <body> og i <head>
  2. Jobbe steg-for-steg mot å lage samme HTML fra mikrobloggeriet
@teodorlu teodorlu added the opsjon Something we can choose to do label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
opsjon Something we can choose to do
Projects
None yet
Development

No branches or pull requests

1 participant