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

Automatically include the katex style or document how to do it #4

Open
cirosantilli opened this issue Jun 14, 2019 · 3 comments
Open

Comments

@cirosantilli
Copy link

cirosantilli commented Jun 14, 2019

This is how it can be done automatically from the script: https://github.com/cirosantilli/cirosantilli.github.io/blob/28c4ae178359a0fc760fd8608499d321be705467/katex.rb#L88

Hi there,

a.adoc

= bla
:stem:

[latexmath]
++++
\sqrt{1+1} = 2
++++

then:

asciidoctor -r asciidoctor-katex bench.adoc

with asciidoctor-katex (0.3.0) generates the katex markup, but the formula does not show correctly because the stylesheet was not added.

If I manually add:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">

to the HTML then it works, but it would be better if that was done automatically by the plugin.

Or at least document how to include it in the README of the project.

@cirosantilli
Copy link
Author

cirosantilli commented Jun 14, 2019

OK, after 20 total minutes of manual grepping I found the docinfo mechanism:

docinfo.html

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">

and add to adoc document attributes:

:docinfo: shared

as in:

= bla
:stem:
:docinfo: shared

[latexmath]
++++
\sqrt{1+1} = 2
++++

@danyill
Copy link

danyill commented Jun 22, 2019

@cirosantilli I had a look at this. If I modify your example above to set stem to latexmath then the KaTeX stylesheet is correctly included

= bla
:stem: latexmath
:docinfo: shared

[latexmath]
++++
\sqrt{1+1} = 2
++++

The readme does indicate that AsciiMath is not supported only LaTeX style math.

@cirosantilli
Copy link
Author

This is how it can be done automatically from the script: https://github.com/cirosantilli/cirosantilli.github.io/blob/28c4ae178359a0fc760fd8608499d321be705467/katex.rb#L88

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

2 participants