Code Monkey home page Code Monkey logo

mdbook-katex's People

Contributors

jontze avatar justletmecreatetheaccount avatar kknives avatar lovesegfault avatar luni-4 avatar lzanini avatar matthewacon avatar mschoenebeck avatar rogeryoungh avatar sichanghe avatar srevinsaju avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mdbook-katex's Issues

`mdbook-katex` being a renderer causes it to run twice

mdbook-katex plays a role of a renderer since this.

The obvious downside is that the preprocessing task is run twice, first when mdbook invoke mdbook-katex as a preprocessor, second when mdbook invoke mdbook-katex as a renderer, so the time mdbook-katex runs doubles.
On a numerical note, it used to take 3 seconds for me to build my notes, and it decreased to about 1.3 seconds after I made the performance improvement earlier today. As a comparison, removing mdbook-katex related processing from book.toml and building it yields 350ms. So, mdbook-katex is slow in this regard.

The real question is why @Matthewacon added the Renderer impl. I believe it must be of some deeper reason.

`mdbook build` hangs forever if \$ is in a formula

Reproduce:

We randomly assign: $r \xleftarrow{\$} G $.
We randomly assign: $r \xleftarrow{\\$} G $.

Expected:
We randomly assign: $r \xleftarrow{\$} G $

Actual:
Neither expression works. The \\$ produces a new line followed by ending the expression. The \$ causes the preprocessor to hang forever.

I believe the issue stems from https://github.com/lzanini/mdbook-katex/blob/master/src/lib.rs#L456 :

self.index += self.string[self.index..].find(&delim.right).ok_or(())?;

I'll try to fix...

Error: The "katex" preprocessor exited unsuccessfully with signal: 6 (SIGABRT) (core dumped) status

mdbook failing to build, or serve

$ mdbook build
2023-05-30 09:54:44 [INFO] (mdbook::book): Book building has started

thread '<unknown>' has overflowed its stack
fatal runtime error: stack overflow
2023-05-30 09:54:44 [ERROR] (mdbook::utils): Error: The "katex" preprocessor exited unsuccessfully with signal: 6 (SIGABRT) (core dumped) status

versions:

mdbook v0.4.30
katex = "0.4.6"

my book.toml:

[book]
authors = ["Catsper"]
language = "en"
multilingual = false
src = "src"
title = "Notes"

[output.html]

[output.katex]

[preprocessor.katex]

Path to katex.min.css should stay relative

In commit 647f20c , the path to katex.min.css was made absolute, so it is now /katex/katex.min.css always.

But that seems wrong for at least two reasons :

  1. The path is incorrect in practice. In my builds, the root /katex folder is empty, with resources actually being saved to /html/katex/ . This also begs the question : do you still need the /html root folder to begin with, or could you perhaps go back to the standard mdbook hierarchy, with "katex" becoming a subdirectory of the book ?
  2. The generated book may be a subpage of a larger website, and in that situation relative links work better. So if you can afford for links to stay relative, it's probably best to do so.

square brackets cause problems

I don't know why but when I write normal square brackets it does not render the entire math inline section:

In the last case, if $\texttt{x}[a]=\texttt{y}[b]$,
In the last case, if $\texttt{x}(a)=\texttt{y}(b)$,

The result is:
image

Recommendation: Do not handle the content of the "alt" attribute of the "<img>" element.

嗨,你好。

我想提出一个建议,就是不处理图片元素的 alt 属性的内容,因为目前情况下,如果在 alt 属性中存在 KaTeX 表达式,那么在最终生成的 HTML 文档里的 <img> 标签里的 alt 属性里会产生大量内容。

eg:

input:

![$x^2$]()

output:

<img src="" alt="<span class=&quot;katex&quot;><span class=&quot;katex-mathml&quot;><math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><semantics><mrow><msup><mi>x</mi><mn>2</mn></msup></mrow><annotation encoding=&quot;application/x-tex&quot;>x^2</annotation></semantics></math></span><span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;><span class=&quot;base&quot;><span class=&quot;strut&quot; style=&quot;height:0.8141em;&quot;></span><span class=&quot;mord&quot;><span class=&quot;mord mathnormal&quot;>x</span><span class=&quot;msupsub&quot;><span class=&quot;vlist-t&quot;><span class=&quot;vlist-r&quot;><span class=&quot;vlist&quot; style=&quot;height:0.8141em;&quot;><span style=&quot;top:-3.063em;margin-right:0.05em;&quot;><span class=&quot;pstrut&quot; style=&quot;height:2.7em;&quot;></span><span class=&quot;sizing reset-size6 size3 mtight&quot;><span class=&quot;mord mtight&quot;>2</span></span></span></span></span></span></span></span></span></span></span>">

当然这只是个建议,我希望它变得更好。

谢谢!

Core dump on ARMv7 when run by mdbook

I'm trying to serve an mdbook from a Raspberry Pi 4 (B) with Arch Linux ARM installed and the process exits because it can't run mdbook-katex:

$ mdbook serve [...]
2021-07-13 10:24:45 [INFO] (mdbook::book): Book building has started
2021-07-13 10:24:45 [ERROR] (mdbook::utils): Error: The "katex" preprocessor exited unsuccessfully with signal: 11 (core dumped) status

Running mdbook-katex --version is fine, however. I don't have any other information about what could be going on. It's worth noting that this doesn't happen with other preprocessors I'm using, e.g. mdbook-toc.

Steps to reproduce:

  • Install mdbook
  • Install mdbook-katex either using cargo or cross-compiling for target armv7-unknown-linux-gnueabihf
  • Run mdbook

Deprecate `static-css` in favor of `no-css` & Deprecate renderer

Deprecate static-css in favor of no-css

These options are provided so that users can opt out from using the CDN and self-host the CSS and fonts.

  • static-css: mdbook-katex downloads the CSS and fonts using reqwest every time mdBook builds, and have to download again because mdBook wipes all the files in book/.
  • no-css: mdbook-katex does not inject CDN link any more. The user needs to add the CSS and fonts to their mdBook project themselves.

An example of using no-css is provided in mdbook-katex Static CSS Example using Python3.
(I also intend to move the code we currently have that is used to download the CSS and fonts into another repository to provide a Rust binary).

User impact deprecating static-css

Users using static-css = true will not have static CSS, rather, mdbook-katex will inject CDN header.

TODOs

  • Provide a Rust binary that downloads CSS and fonts for the no-css option.
  • Update README for the instructions to use no-css.
  • Give a warning about deprecating static-css in v0.3.12.
  • Remove option static-css in v0.4.0.

Deprecate mdbook-katex renderer

We have been asking users to add [output.katex] to their book.toml despite mdbook-katex is not a renderer.

(We only provide a fake renderer to force mdBook to output the artifact at book/html/ instead of book/. This is done so that we know where to inject the static CSS (always at book/html/) without having to worry about whether the user have other renderers.)

This is unnecessary and brought us many issues (#33, #48). Most users don't need static-css anyway and are instead confused why their artifacts are in book/html/.

User impact deprecating the renderer

Users will see an error complaining that katex does not support renderer when their book builds if they set [output.katex].

They will need to remove [output.katex] in their book.toml so it look like the book.toml in the README. Then, their artifact will be output at book/ instead of book/html/ if they don't have other renderer plugins.

TODOs

  • Give a warning about deprecating [output.katex] in v0.3.12.
  • Remove the fake renderer in v0.5.0.

Original issue opened on Feb 9

Currently, the renderer downloads the CSS files and fonts into the build target directory (book) if static-css option is turned on. There are two major drawbacks:

  • mdBook wipes book before each build, so everything needs to be downloaded again.
  • To ensure that we know where the output HTMLs are located, we created a dummy renderer.

What we should have done instead, is to download the CSS in the theme folder and the fonts in the theme/fonts folder and ask the users to add something like this to their book.toml:

[output.html]
additional-css = ["theme/katex.min.css"]

Process chapter names as well

Chapter names are used for rendering the sidebar table of contents. When it contains latex markup, then it's rendered correctly in the chapter contents, but the sidebar has the unrendered latex source code.

The processing is a matter of adding chapter.name to the rendering queue in preprocess::KatexProcessor::run and then popping it back. Preferable it would also pass a flag to get_render_tasks so that every ToC entry doesn't have its own reference to the stylesheet header.

This issue is blocked on rust-lang/mdBook#2179, because otherwise the result is even worse than having raw latex in the sidebar.

`vmatrix` rendered incorrectly

Math expressions that contains matrices are no longer rendered correctly.
For example,

\begin{vmatrix}a&b\\c&d\end{vmatrix}

is not parsed.

I have done some debugging and found out that the error comes from katex:

thread 'tests::test_katex_rendering_vmatrix' panicked at 'called `Result::unwrap()` on an `Err` value: JsExecError("undefined not callable (property 'fill' of [object Array]): JavaScript runtime error (TypeError)")', src/tests.rs:184:63

Changing katex back to use quick-js fixes this problem, so this regression is brought by duktype.

Possibility of serverside TikZJax rendering?

Just as mdbook-katex leverages existing KaTeX javascript, the same structuring could apply to the existing obsidian-tikzjax javascript implementation which is run clientside to generate html outputs, all we would need to do is to feed it the markdown input during the preparse time and it becomes serverside rendering.

If the use of ```tikz blocks is a potential issue, a custom tag could always be used instead as the default i.e. <tikz></tikz>, though I guess since mdbook-mermaid is a thing this wouldn't be a problem.

$\vec{a}$ inside a table cell breaks in a verbose and amusing way

Using $\vec{a}$ in regular text works as expected: an arrow is rendered above the a. Inspecting the page source, it appears this is implemented as an SVG path. However, if $\vec{a}$ is placed inside a table cell, the SVG path is rendered as half a dozen extra cells containing the path coordinates.

Move version number of uploaded binaries into a directory within the archive

The following link format always points to the latest release tag:

https://github.com/{user}/{repo}/releases/latest/download/{file.ext}

If {file.ext} is a consistent name across versions, then this allows the link to always be a reliable download reference without needing to manually update CI every time the version number changes.

My suggestion, if a version number needs to be distributed with the file, would be to put the binary inside a folder with the version name, instead of in the archive name itself.

For example, current structure:

mdbook-katex-v0.3.14-x86_64-pc-windows-gnu.zip 
|- mdbook.exe

Proposed structure (option 1):

mdbook-katex-x86_64-pc-windows-gnu.zip 
|- mdbook-katex-v0.3.14-x86_64-pc-windows-gnu
   |- mdbook.exe

Or alternatively (option 2):

mdbook-katex-x86_64-pc-windows-gnu.zip 
|- v0.3.14
   |- mdbook.exe

Then CIs' can just do something like this:

KTX_LNK = https://github.com/lzanini/mdbook-katex/releases/latest/download/mdbook-katex-x86_64-pc-windows-gnu.zip
curl -o mdbook-katex.zip $KTX_LNK -J -L
tar -xf mdbook-katex.zip --strip-components=1

[Bug] building with `static-css = true` results in downloading fonts twice

I just noticed that building with

[preprocessor.katex]
static-css = true

is extremely slow ( > 3min).

I watched the build process, it looks like this:

  1. The fonts pop up one by one in book/html/katex/fonts after this message shows up:
[INFO] (mdbook::book): Book building has started
  1. After all the fonts are downloaded, they get deleted when this message shows up:
[INFO] (mdbook::book): Running the html backend
  1. The fonts get downloaded again
  2. For completeness's sake:
[INFO] (mdbook::book): Running the katex backend
[INFO] (mdbook::renderer): Invoking the "katex" renderer

I suspect that the html backend clears up what it think it does not need.

Comply with CommonMark when dealing with code blocks

Comply with CommonMark when dealing with code blocks

Objective

mdbook-katex preprocesses the math expressions into HTML before they are fed to mdbook, but math expressions in code blocks should not be escaped.

Background

In the past, mdbook-latex did not deal with code blocks at all.
In #9, the ability to escape code blocks was requested to be added.
In SichangHe/mdbook-katex2@1745bea, the ability to escape ``` was added.
In 5efa386, ` is also escaped.

Problem

The way I implemented the code escape was by splitting the content by the delimiters, then, there are some immediate problems.

  1. Whether to Escaping \ inside the code block.
  2. Handling an arbitrary repetition of ` as specified in the CommonMark specification.
  3. Indented code blocks are not escaped.

I choose true for 1., but I was wrong and the CommonMark spec says otherwise.
A new parser is needed to comply with the CommonMark spec.

Resources

CommonMark specification about code spans.
https://github.com/anoma/specs/issues/91.
Current implementation to escape code blocks
Current implementation to escape inline code

math in title cause unexpected <p>

For example:

### angle between $\vec a,\vec b$, $\theta$

produces

<h3 id="angle-between-apath-dm377-20c0-5333-1833-10-55-14s391-0-397-0c4667-0-8667-1667-12-5"><a class="header" href="#angle-between-apath-dm377-20c0-5333-1833-10-55-14s391-0-397-0c4667-0-8667-1667-12-5" style="outline-width: 0px !important; -webkit-user-select: text !important;">angle between <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.1719em;vertical-align:-0.1944em;"></span><span class="mord accent"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.714em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">a</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.2355em;"><span class="overlay" style="height:0.714em;width:0.471em;"><svg xmlns="http://www.w3.org/2000/svg" width="0.471em" height="0.714em" style="width:0.471em" viewBox="0 0 471 714" preserveAspectRatio="xMinYMin">&lt;path d='M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5</svg></span></span></span></span></span></span></span></span></span></span></a></h3>
<p>3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z'/&gt;<span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord accent"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.9774em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">b</span></span><span style="top:-3.2634em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.2355em;"><span class="overlay" style="height:0.714em;width:0.471em;"><svg xmlns="http://www.w3.org/2000/svg" width="0.471em" height="0.714em" style="width:0.471em" viewBox="0 0 471 714" preserveAspectRatio="xMinYMin"><path d="M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z"></path></svg></span></span></span></span></span></span></span>, <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span></p>

see this for the whole code environment

Unable to parse the input

Hey there thank you for creating this preprocessor,
I am not able to get mdbook-katex working on NixOS

This is the output I am getting.

2022-09-04 15:50:04 [INFO] (mdbook::book): Book building has started
2022-09-04 15:50:04 [INFO] (mdbook::book): Running the katex backend
2022-09-04 15:50:04 [INFO] (mdbook::renderer): Invoking the "katex" renderer
Unable to parse the input
2022-09-04 15:50:04 [INFO] (mdbook::cmd::serve): Serving on: http://localhost:3000
2022-09-04 15:50:04 [INFO] (mdbook::cmd::watch): Listening for changes...
2022-09-04 15:50:04 [INFO] (warp::server): Server::run; addr=[::1]:3000
2022-09-04 15:50:04 [INFO] (warp::server): listening on http://[::1]:3000 

This does even happen on very simple input like $ 2 + 3 $

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/lib.rs:106

Build failed. I have no hint for why this is happening.

$ mdbook serve (or mdbook build)
2022-02-21 16:21:52 [INFO] (mdbook::book): Book building has started
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/lib.rs:106:83
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022-02-21 16:21:53 [ERROR] (mdbook::utils): Error: The "katex" preprocessor exited unsuccessfully with exit status: 101 status

I tried building locally on latest macOS with mdbook-katex.

Offscreen Tex content

Hi! I noticed the inconvenience of a large line of Tex content continuing after the mdbook page width ends.

Here is a image showing it:
offscreen1

With the laptop's touchpad I can scroll right to se the remaining content, such as in the following image:
offscreen2
On this second image one can notice the entire content is moved to the left. There is no of that margin defined by mdbook...

I am not sure if it is a mdbook-katex thing. Is there some hidden margin configuration I am not aware?
Here is the feedback, Just in case.

`include-src` breaks if latex source is double-spaced

To reproduce, enable include-src and add an equation with extra linebreaks within the $$ block.

It seems that html quotations doesn't close properly when there are extra linebreaks.

Suggestion: minify the included source by removing the linebreaks.

# Chapter 1

$$
\begin{aligned}

f(t) = \int_{-\infty}^{\infty} F(\omega) e^{2\pi i\omega t} d\omega \\

F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-2\pi i\omega t} dt 

\end{aligned}
$$

image

`\mathrm` after rendering generate unwanted '>' char

exmaple 1

\mathrm{n_{max} = \frac{m^h-1}{m-1}}
  • correct rendering:

    image
  • unintended behavior:

    image

example 2

\mathrm{\because n_{max} = \frac{m^h-1}{m-1}}\\
\mathrm{\therefore h_{min} = \log_m(n\times (m-1) + 1)}
  • correct rendering:

    image
  • unintended behavior:

    image

Macros can't be located when running mdbook with a path

Setup

  • mdbook config is at ./book/book.toml
  • Book source is at ./book/src
  • Macros file is at ./book/macros.txt

Config sets paths relative to ./book:

[book]
src = "src"

[preprocessor.katex]
macros = "macros.txt"

What did I do

$ mdbook build book/
$ cd book/
$ mdbook build ./

Expected result

Both builds succeed.

Actual result

The first build fails with:

$ mdbook build book/
2021-05-27 19:01:18 [INFO] (mdbook::book): Book building has started
thread 'main' panicked at 'couldn't open macros.txt: No such file or directory (os error 2)', /home/str4d/.cargo/registry/src/github.com-1ecc6299db9ec823/mdbook-katex-0.2.8/src/lib.rs:151:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2021-05-27 19:01:18 [ERROR] (mdbook::utils): Error: The preprocessor exited unsuccessfully

The second build succeeds.

Offline KaTeX

The current plugin is only able to use a CDN-sourced KaTeX implementation.

Please consider the ability to host an offline version of KaTeX. I'd like to be able to use mdbook in an offline context while still having the mathematical features.

Thanks!

katex don't work with mdbook fram crates.io

Error: Katex preprocessor/renderer using different mdbook version, 0.4.13,than it was built against, 0.4.12
i tryed with cargo install mdbook and cargo install mdbook --vers 0.4.12 with neither works

`mdbook serve` doesn't work

After I run the command cargo install mdbook-katex and modify the .toml file. The command mdbook serve doesn't work.

The info was

2022-12-09 10:26:56 [INFO] (mdbook::book): Book building has started
Error: The katex preprocessor/renderer did not understand what you wantedto do
2022-12-09 10:26:56 [ERROR] (mdbook::utils): Error: The "katex" preprocessor exited unsuccessfully with exit code: 1 status

All the above work was done on a Mac environment.

P.S. An extra question, is that ok for me just leave the options be emty and just put the following lines in the .toml file? It not, what should write under them? I can't find some documents to discuss this problem in detail.

[output.katex]

[preprocessor.katex]

Test the cross-compiled Windows GNU build

I wish someone on Windows can test the GNU build to see if it works correctly. The build is available starting from Release v0.3.7.

In #66, #65, #64, I added CD to cross compile x86_64-pc-windows-gnu, aarch64-apple-darwin and x86_64-unknown-linux-musl. I am confident that the macOS and the MUSL build would work, as I have corresponding CIs for them. The Windows GNU build, however, could not simply be tested using cargo due to crossing from Linux to Windows.

The Windows GNU build is also special for windows users because it is currently the only Windows build that uses quick-js for katex instead of duktape and does not have the issue mentioned in #39. Making this GNU build locally on a Windows machine is not easy, so this build in the release would likely be the best choice for Windows users if it works.

Help: matrix not display correctly

platform: Windows 10

mdbook & mdbook-katex version:

> mdbook -V
mdbook v0.4.34
> mdbook-katex -V
mdbook-katex 0.5.7

when I wrote a matrix, it didn't display correctly, is there any suggest?
image
image

Unable to render matrix

image
I used the above LaTeX statement to describe a matrix, but after compilation, I found that it was unable to render successfully while normal formulas can be rendered normally:
image

Request for new release.

This works great. Thanks a lot! I wanted to request a new release with the latest. Would make CI deployment easier with the latest features.

Is this maintained?

This is the best mdbook math typeset solution I have found so far.
But, this project has not received update during most of this year despite having new issues and pull requests coming up.

Is this maintained? Does @lzanini feels like to have some help with that?

cargo install fails because of libquickjs-sys patch

Running cargo install mdbook-katex using cargo 1.53.0 on Windows 10 seems to work until eventually the build fails with this error:

error: failed to run custom build command for `libquickjs-sys v0.9.0`

Caused by:
  process didn't exit successfully: `C:\Users\(user)\AppData\Local\Temp\cargo-installwvCHAe\release\build\libquickjs-sys-f1a22357f8cab028\build-script-build` (exit code: 101)
  --- stdout
  patching file libbf.c

  --- stderr
  Applying patches...
  Applying "js-tobigint64-overflow.patch"...
  Assertation failed!

  Program: C:\Strawberry\c\bin\patch.exe
  File: .\src\patch\2.5.9\patch-2.5.9-src\patch.c, Line 354

  Expression: hunk
  thread 'main' panicked at 'Patch command returned non-zero exit code', C:\Users\(user)\.cargo\registry\src\github.com-1ecc6299db9ec823\libquickjs-sys-0.9.0\build.rs:136:9

Even though it seems to be an issue with libquickjs-sys v0.9.0 I wonder if there's a workaround to still get mdbook-katex installed. (I'm new to the rust/cargo ecosystem.)

hot reload does not work

After starting to use mdbook-katex, the browser does not refresh when changes are applied to source file.

environment

mdbook v0.4.18
Darwin local 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101 arm64

mdbook-katex installed with cargo and built against the latest mdbook

Gitlab style syntax support

Would it be possible to support Gitlab style syntax? I have some documentation that is hosted using mdBook and on a gitlab repo. I would like to be able to have them render similarly together.

for example the inline math in gitlab is

$`\frac{x}{y}`$

and for blocks

```math
\frac{x}{y}
```

mdbook-katex crashes when `SUMMARY.md` includes empty chapters

While writing a book the mdbook tutorial shows the option to have chapters appear in the summary while no files for them beeing created yet by using - [chapter]() but mdbook-katex expects every chapter to have a file.

A simple solution could be to simply don't do anything if a chapter doesn't have a path.

backtrace
2022-03-10 16:15:48 [INFO] (mdbook::book): Book building has started
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/lib.rs:106:83
stack backtrace:
   0: rust_begin_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
   2: core::panicking::panic
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:48:5
   3: mdbook::book::book::for_each_mut
   4: <mdbook_katex::KatexProcessor as mdbook::preprocess::Preprocessor>::run
   5: mdbook_katex::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
2022-03-10 16:15:48 [ERROR] (mdbook::utils): Error: The "katex" preprocessor exited unsuccessfully with exit status: 101 status

Add a license file

Add a license file. So that your program can be packaged in the termux repository.

error when trying to perform "mdbook build"

I have just tried to install and build from the latest version but encounted an error, any idea? thanks in advance

$ mdbook build
2022-05-27 00:52:15 [INFO] (mdbook::book): Book building has started
^[[Athread 'main' panicked at 'called Option::unwrap() on a None value', src/lib.rs:106:83
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
2022-05-27 00:52:16 [ERROR] (mdbook::utils): Error: The "katex" preprocessor exited unsuccessfully with exit status: 101 status

`\backslash` is rendered as `<span>`

For example, $\mathbb{V}\backslash T(\mathbb{V})$ is rendered as:

<span class="katex-html" aria-hidden="true">
  <span class="base">
    <span class="strut" style="height:1em;vertical-align:-0.25em;"></span>
    <span class="mord mathbb">V</span>
    <span class="mord">&lt;/span&gt;
    <span class="mord mathnormal" style="margin-right:0.13889em;">T</span>
    <span class="mopen">(</span>
    <span class="mord mathbb">V</span>
    <span class="mclose">)</span>
  </span>
</span>
</span>

equation in {{#include}} not rendered

Steps to reproduce:

src.md

## My equation
$$
E=mc^2
$$

ch1.md

# Chapter 1
{{#include src.md}}

SUMMARY.md

[original](./src.md)
[included](./ch1.md)

[stack-overflow-signed.patch] NotFound for libquickjs-sys v0.9.0

i can not build mdbook from source, i'm new with rust, i do not know to to update correctly from v0.9.0 to last version v0.10.0.

cargo install --git "https://github.com/lzanini/mdbook-katex"
error: failed to run custom build command for `libquickjs-sys v0.9.0`

Caused by:
  process didn't exit successfully: `/data/projects/rust/mdbook-katex/target/debug/build/libquickjs-sys-82026ba1eb3da8ec/build-script-build` (exit status: 101)
  --- stderr
  Applying patches...
  Applying "stack-overflow-signed.patch"...
  thread 'main' panicked at 'Could not apply patches: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /home/mhamdi/.cargo/registry/src/github.com-1ecc6299db9ec823/libquickjs-sys-0.9.0/build.rs:133:14
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Copy/save button near the equations

Is it possible to create a buttons near the equation (just like in code listings) that would copy equation code, save the equation image and whatever one would imagine to do with the equation?

To clarify this is what I mean (ofcourse the icons are just copy paste from rust listings and does not correspond to the idea):
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.