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

writerHTMLMathMethod not getting applied whatsoever #1006

Closed
mactonya opened this issue Sep 28, 2023 · 3 comments
Closed

writerHTMLMathMethod not getting applied whatsoever #1006

mactonya opened this issue Sep 28, 2023 · 3 comments
Labels

Comments

@mactonya
Copy link

Trying to use hakyll to do math blog, but for whatever reason when I am trying to convert the maths, the config { writerHTMLMathMethod = KaTeX "" } just refuses to work, so it turns something simple like a^2+b^2=c^2 to <em>a</em><sup>2</sup> + <em>b</em><sup>2</sup> = <em>c</em><sup>2</sup></span>

    match "posts/*" $ do
        let writerOptions = defaultHakyllWriterOptions
                            { writerHTMLMathMethod = KaTeX "" }
        route $ setExtension "html"
        compile $ pandocCompilerWith defaultHakyllReaderOptions writerOptions
            >>= loadAndApplyTemplate "templates/post.html"    postCtx
            >>= loadAndApplyTemplate "templates/default.html" postCtx
            >>= relativizeUrls

local pandoc can apply the flags normally; any possible idea on why this could happen?

@chungyc
Copy link
Contributor

chungyc commented Sep 28, 2023

It didn't work for me either. With some random fiddling, though, I managed to use KaTeX by using the MathJax as the writerHTMLMathMethod and including the necessary Javascript.

For an example with my own Hakyll site:

@mactonya
Copy link
Author

Seems like MathJax is the way to go.

@Minoru
Copy link
Collaborator

Minoru commented Oct 22, 2023

I didn't test this, but I think one needs to pass a URL for KaTeX, or use a default one from Text.Pandoc.Options:

defaultHakyllWriterOptions { writerHTMLMathMethod = KaTeX defaultKaTeXURL }

Apparently that's what pandoc --katex does, too:

       --katex[=URL]
              Use KaTeX to display embedded TeX math in HTML output.  The URL is the base URL for the KaTeX library.  That directory should contain a katex.min.js and a katex.min.css file.  If a URL  is  not provided, a link to the KaTeX CDN will be inserted.

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

No branches or pull requests

3 participants