graemephi / goldmark-qjs-katex Goto Github PK
View Code? Open in Web Editor NEWGoldmark + KaTeX
License: MIT License
Goldmark + KaTeX
License: MIT License
Using go get
in CentOS 7
what should i do?
# github.com/graemephi/goldmark-qjs-katex/katex
katex.c:25:1: error: unknown type name ‘_Thread_local’
_Thread_local State *tls_state = 0;
^
katex.c:25:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_Thread_local State *tls_state = 0;
^
katex.c: In function ‘init_qjs’:
katex.c:29:9: error: ‘tls_state’ undeclared (first use in this function)
if (tls_state) {
^
katex.c:29:9: note: each undeclared identifier is reported only once for each function it appears in
[root@VM_118_213_centos blotter]# go get ./...
# github.com/graemephi/goldmark-qjs-katex/katex
katex.c:25:1: error: unknown type name ‘_Thread_local’
_Thread_local State *tls_state = 0;
^
katex.c:25:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_Thread_local State *tls_state = 0;
^
katex.c: In function ‘init_qjs’:
katex.c:29:9: error: ‘tls_state’ undeclared (first use in this function)
if (tls_state) {
^
katex.c:29:9: note: each undeclared identifier is reported only once for each function it appears in
First off, loving the library. It's really nice not to have a dependency on Node.
When I run goldmark, I eventually compile the HTML into a go template. I'd like to avoid adding Katex CSS if no katex nodes exist in the document. What do you think about a public method that reports the number of KaTeX nodes?
func reportKatexNodes(pc parser.Context) int {}
Alternatively:
reportKatexNodex
to return a list of all katex nodes instead.node
struct and kind public so clients can traverse and find katex nodes themselves.The gohugio project has a requirement that it does not depend on cgo
so therefore this can't be used by them.
Perhaps use godzilla or otto? It seems otto supports
js
sans CGO. And I think godzilla does as well.
#2 (comment)
I also might be confused because the pandoc element might be the cause of the use of cgo, isn't it.
I tried out kahugo, precisely what I was looking for!
However, I can't get \begin ... \end to work.
$$
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
$$
renders
$$
\begin{pmatrix}
a & b \<br>
c & d
\end{pmatrix}
$$
whereas
$x$
and
$$x-y$$
render as expected respectively
<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>x</mi></mrow><annotation encoding="application/x-tex">x</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">x</span></span></span></span>
and
<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>x</mi><mo>−</mo><mi>y</mi></mrow><annotation encoding="application/x-tex">x-y</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.66666em;vertical-align:-0.08333em;"></span><span class="mord mathdefault">x</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.19444em;"></span><span class="mord mathdefault" style="margin-right:0.03588em;">y</span></span></span></span></span>
Am I missing something ?
Hello again, would it be better to move the raw quickjs and katex files into separate repositories, referring to them through git submodules?
The QuickJS code used in this repo is already outdated (quickjs-2020-01-19.tar.xz).
Having these separated would make updating external dependencies simpler and keep this repository more modular.
Aside, I am very grateful for your work in implementing this feature. Using it locally right now with no issues.
I submitted a PR incorporating your extension in hugo. Admittedly, I am not very familiar with golang or C so if there are additional concerns, I am eager to listen.
gohugoio/hugo#6544
gohugoio/hugo#6842
Hello, very interested in getting server side math rendered through Goldmark.
I'm getting the following output after running go build
:
# github.com/graemephi/goldmark-qjs-katex/katex
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_fcvt1':
katex/quickjs/quickjs.c:10562: undefined reference to `fesetround'
/usr/bin/ld: katex/quickjs/quickjs.c:10565: undefined reference to `fesetround'
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_ecvt1':
katex/quickjs/quickjs.c:10478: undefined reference to `fesetround'
/usr/bin/ld: katex/quickjs/quickjs.c:10481: undefined reference to `fesetround'
/usr/bin/ld: $WORK/b002/_x004.o: in function `JS_ComputeMemoryUsage':
katex/quickjs/quickjs.c:5755: undefined reference to `round'
/usr/bin/ld: katex/quickjs/quickjs.c:5756: undefined reference to `round'
/usr/bin/ld: katex/quickjs/quickjs.c:5758: undefined reference to `round'
/usr/bin/ld: katex/quickjs/quickjs.c:5762: undefined reference to `round'
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_atod':
katex/quickjs/quickjs.c:9556: undefined reference to `pow'
/usr/bin/ld: $WORK/b002/_x004.o: in function `JS_ToUint8ClampFree':
katex/quickjs/quickjs.c:10209: undefined reference to `lrint'
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_pow':
katex/quickjs/quickjs.c:11134: undefined reference to `pow'
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_binary_arith_slow':
katex/quickjs/quickjs.c:12960: undefined reference to `fmod'
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_math_hypot':
katex/quickjs/quickjs.c:39700: undefined reference to `hypot'
/usr/bin/ld: katex/quickjs/quickjs.c:39708: undefined reference to `sqrt'
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_fmax':
katex/quickjs/quickjs.c:39246: undefined reference to `fmax'
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_fmin':
katex/quickjs/quickjs.c:39232: undefined reference to `fmin'
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_module_loader_so':
katex/quickjs/quickjs-libc.c:405: undefined reference to `dlopen'
/usr/bin/ld: katex/quickjs/quickjs-libc.c:414: undefined reference to `dlsym'
/usr/bin/ld: katex/quickjs/quickjs-libc.c:405: undefined reference to `dlopen'
/usr/bin/ld: katex/quickjs/quickjs-libc.c:427: undefined reference to `dlclose'
/usr/bin/ld: $WORK/b002/_x004.o: in function `time_clip':
katex/quickjs/quickjs.c:45865: undefined reference to `trunc'
/usr/bin/ld: $WORK/b002/_x004.o: in function `js_pow':
katex/quickjs/quickjs.c:11134: undefined reference to `pow'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x58): undefined reference to `fabs'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x78): undefined reference to `floor'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x98): undefined reference to `ceil'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0xd8): undefined reference to `sqrt'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0xf8): undefined reference to `acos'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x118): undefined reference to `asin'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x138): undefined reference to `atan'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x158): undefined reference to `atan2'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x178): undefined reference to `cos'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x198): undefined reference to `exp'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x1b8): undefined reference to `log'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x1f8): undefined reference to `sin'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x218): undefined reference to `tan'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x238): undefined reference to `trunc'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x278): undefined reference to `cosh'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x298): undefined reference to `sinh'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x2b8): undefined reference to `tanh'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x2d8): undefined reference to `acosh'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x2f8): undefined reference to `asinh'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x318): undefined reference to `atanh'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x338): undefined reference to `expm1'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x358): undefined reference to `log1p'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x378): undefined reference to `log2'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x398): undefined reference to `log10'
/usr/bin/ld: $WORK/b002/_x004.o:(.data.rel.ro+0x3b8): undefined reference to `cbrt'
collect2: error: ld returned 1 exit status
Here are my dependencies:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-6)
$ ld -v
GNU ld (GNU Binutils for Debian) 2.31.1
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.