Closed mmicu closed 2 months ago
Unfortunately, I cannot reproduce this. Could you
[output.html]
entry from your book.toml
and try again?cargo install mdbook-katex
.[preprocessor.graphviz]
entry it is working.Any suggestions to make them work together?
I have solved it by using the following configuration. It is the same that I wrote above, but I have changed the after
parameter for preprocessor.katex
:
[output.html]
additional-css = ["src/css/cookieconsent.css"]
mathjax-support = true
[preprocessor.katex]
after = ["preprocessor.graphviz"]
throw-on-error = true
[preprocessor.graphviz]
command = "mdbook-graphviz"
output-to-file = false
after = ["links"]
[output.html.code.hidelines]
python = "~"
Ah, I see what is going on. Code intended for mdbook-graphviz
got picked up by mdBook-KaTeX (probably it contains $
?). This workaround is quite clever.
I am curious what your full input looks like.
I have tried with an empty book and with the configuration I have posted in the first message. Also with this minimal input, I am getting the wrong rendering (that disappears after applying the fix I suggested).
For example, with a SUMMARY.md
like:
# Summary
[Introduction](./introduction.md)
And an introduction.md
like:
$$ a = 1 $$
$$ a < 1 $$
I get the same problem I posted.
After running the book through mdbook-graphviz
with [output.markdown]
, it gives:
# Chapter 1
$$ a = 1 $$
$$ a \< 1 $$
This backslash somehow choked mdBook-KaTeX. This is a bug.
The reason why there is a backslash, though, is that mdbook-graphviz
uses pulldown-cmark-to-cmark
to convert parsed Markdown back to text.
What happened above was KaTeX catching the invalid \<
and throwing an exception. When the exception is returned to Rust, mdBook-KaTeX simply ignored it and sticked in the content within the delimiters. This confused me.
I have changed the implementation to log a warning of the exception when this happens, and put the delimiters back for sanity.
A nicer option when editing, though, is to set throw-on-error
to false
, which results in red error messages baked into the rendering output. @mmicu, maybe you could consider that.
The
<
symbol is not rendered correctly. This is an example:That's what I am using:
With the following
TOML
configuration: