xu-cheng / pandoc-katex Goto Github PK
View Code? Open in Web Editor NEWPandoc filter to render math equations using KaTeX
License: Apache License 2.0
Pandoc filter to render math equations using KaTeX
License: Apache License 2.0
Trying to render a matrix via
$$ \begin{pmatrix}
a & b \\
c & d
\end{pmatrix} $$ {#eq:linearModel2}
in a markdown document. Causes
Error: failed to execute js (detail: undefined not callable (property 'fill' of [object Array]): JavaScript runtime error (TypeError))
Error running filter pandoc-katex:
Filter returned error status 1
Same for bmatrix or matrix. \begin{equation} works.
Any workarounds? :)
Thanks a ton!
Is there a way to specify a KaTeX macros file? Either JSON (to share with VSCode markdown plugins) or just plain TeX to include?
By default, pandoc markdown has raw_tex activated. It allows to do things like:
Some test with inline math: $f(x)=x^2$. And now some raw tex:
\begin{align}
x &= 2 \\
f(x) &= 4
\end{align}
The align environment in the above document is currently dropped when using pandoc-katex (but not when using eg mathjax). I think this is because in the pandoc AST it has type RawInline rather than Math. Hence pandoc-katex passes it along, and it gets dropped by pandoc during output (doc says Inline LaTeX is ignored in output formats other than Markdown, LaTeX, Emacs Org mode, and ConTeXt.)
I think transforming the RawInline/tex nodes into RawInline/html as is currently done for Math nodes would work. What do you think?
Note, to be complete there is RawBlock/tex as well, eg with (given in the doc):
\begin{tabular}{|l|l|}\hline
Age & Frequency \\ \hline
18--25 & 15 \\
26--35 & 33 \\
36--45 & 22 \\ \hline
\end{tabular}
Hi, would it be possible to update the underlying katex to something above 0.15.1
? That would allow to put multiple \tag
elements (one per line) withing AMS environments KaTeX/KaTeX#2379 (comment)
That is extremely useful and common in .tex files.
Thanks in advance!
Hello, following KaTeX/KaTeX#2003 (comment) would it be possible to somehow set the trust
setting such that htmlId
tag would be operational?
That could lead usage of macros that enable equation labels and references.
trying to use rust I get this
>cargo install pandoc-katex
Updating crates.io index
Downloaded pandoc-katex v0.1.9
Downloaded 1 crate (14.0 KB) in 1.15s
Installing pandoc-katex v0.1.9
Downloaded anyhow v1.0.58
Downloaded atty v0.2.14
Downloaded bitflags v1.3.2
Downloaded cfg-if v1.0.0
Downloaded derive_builder v0.11.2
Downloaded either v1.6.1
Downloaded fnv v1.0.7
Downloaded once_cell v1.12.0
Downloaded proc-macro2 v1.0.40
Downloaded strsim v0.8.0
Downloaded textwrap v0.11.0
Downloaded unicode-segmentation v1.9.0
Downloaded winapi v0.2.8
Downloaded darling_macro v0.14.1
Downloaded cesu8 v1.1.0
Downloaded ducc v0.1.5
Downloaded quick-js v0.4.1
Downloaded ducc-sys v0.1.2
Downloaded structopt-derive v0.4.18
Downloaded serde v1.0.137
Downloaded vec_map v0.8.2
Downloaded darling_core v0.14.1
Downloaded kernel32-sys v0.2.2
Downloaded winapi-x86_64-pc-windows-gnu v0.4.0
Downloaded serde_derive v1.0.137
Downloaded serde_json v1.0.81
Downloaded unicode-ident v1.0.1
Downloaded toml v0.5.9
Downloaded itertools v0.10.3
Downloaded proc-macro-error v1.0.4
Downloaded derive_builder_macro v0.11.2
Downloaded structopt v0.3.26
Downloaded syn v1.0.98
Downloaded clap v2.34.0
Downloaded heck v0.3.3
Downloaded katex v0.4.4
Downloaded thiserror v1.0.31
Downloaded lazy_static v1.4.0
Downloaded itoa v1.0.2
Downloaded libquickjs-sys v0.9.0
Downloaded darling v0.14.1
Downloaded thiserror-impl v1.0.31
Downloaded proc-macro-error-attr v1.0.4
Downloaded walkdir v0.1.8
Downloaded unicode-width v0.1.9
Downloaded derive_builder_core v0.11.2
Downloaded winapi v0.3.9
Downloaded cc v1.0.73
Downloaded copy_dir v0.1.2
Downloaded ident_case v1.0.1
Downloaded ryu v1.0.10
Downloaded quote v1.0.20
Downloaded version_check v0.9.4
Downloaded strsim v0.10.0
Downloaded winapi-build v0.1.1
Downloaded 55 crates (8.0 MB) in 7.88s (largest was `winapi-x86_64-pc-windows-gnu` at 2.9 MB)
Compiling proc-macro2 v1.0.40
Compiling unicode-ident v1.0.1
Compiling quote v1.0.20
Compiling syn v1.0.98
Compiling winapi-build v0.1.1
Compiling winapi v0.2.8
Compiling version_check v0.9.4
Compiling strsim v0.10.0
Compiling fnv v1.0.7
Compiling ident_case v1.0.1
Compiling winapi-x86_64-pc-windows-gnu v0.4.0
Compiling serde_derive v1.0.137
Compiling winapi v0.3.9
Compiling cc v1.0.73
Compiling serde v1.0.137
Compiling unicode-width v0.1.9
Compiling unicode-segmentation v1.9.0
Compiling strsim v0.8.0
Compiling once_cell v1.12.0
Compiling katex v0.4.4
Compiling vec_map v0.8.2
Compiling serde_json v1.0.81
Compiling bitflags v1.3.2
Compiling either v1.6.1
Compiling anyhow v1.0.58
Compiling ryu v1.0.10
Compiling itoa v1.0.2
Compiling lazy_static v1.4.0
Compiling cfg-if v1.0.0
Compiling kernel32-sys v0.2.2
Compiling proc-macro-error-attr v1.0.4
Compiling proc-macro-error v1.0.4
Compiling textwrap v0.11.0
Compiling heck v0.3.3
Compiling itertools v0.10.3
Compiling atty v0.2.14
Compiling clap v2.34.0
Compiling darling_core v0.14.1
Compiling thiserror-impl v1.0.31
Compiling structopt-derive v0.4.18
Compiling darling_macro v0.14.1
Compiling darling v0.14.1
Compiling derive_builder_core v0.11.2
Compiling structopt v0.3.26
Compiling thiserror v1.0.31
Compiling derive_builder_macro v0.11.2
Compiling walkdir v0.1.8
Compiling copy_dir v0.1.2
Compiling derive_builder v0.11.2
Compiling libquickjs-sys v0.9.0
error: failed to run custom build command for `libquickjs-sys v0.9.0`
Caused by:
process didn't exit successfully: `C:\Users\kreij\AppData\Local\Temp\cargo-installlTv7bX\release\build\libquickjs-sys-5f3b398ffe6ff8d2\build-script-build` (exit code: 101)
--- stderr
Applying patches...
Applying "js-tobigint64-overflow.patch"...
thread 'main' panicked at 'Could not apply patches: Error { kind: NotFound, message: "program not found" }', C:\Users\kreij\.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...
error: failed to compile `pandoc-katex v0.1.9`, intermediate artifacts can be found at `C:\Users\kreij\AppData\Local\Temp\cargo-installlTv7bX
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.