-
Notifications
You must be signed in to change notification settings - Fork 268
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
Add katex support in documentation. #427
Conversation
Great, right now doctests ( We have two options:
The latter is what's being used in |
@mmaker would using the solution in this issue work? rust-lang/cargo#9427 We would have to switch to running doctests on nightly only, but that's fine IMO |
After some investigation:
clearly does not work because it's not a rustdoc option. After some hacking around, the following option is what we want:
Now
Note the |
This commit adds latex support within rustdoc for arkworks algebra. In order to add latex code in textmode, use delimiters `$` and `$`. In order to add latex code in displaymode, use delimiters `$$` and `$$`. To compile the documentation, use `make doc`. Building documentation with support for latex requires an additional option --html-in-header to be set via RUSTDOCFLAGS or build.rustdocflags in .cargo/config.toml. Unfortunately, putting a relative path there causes `cargo test` and `cargo doc` to fail. See rust-lang issue #8097. Working around this bug with the option `-Zdoctest-in-workspace` requires enabling rust toolchain nightly. Unfortunately, there is no such option as `target.'cfg(nightly)'.rustdocflags` to work with. Work around all these issues with a single makefile.
b3182e7
to
1287dd5
Compare
Force-pushing this pull request with a makefile-based workaround, similarly to what's done in |
* Remove doctype declaration in doc/katex-header.html. The linter is wrong. See discussion on PR #427. https://github.com/arkworks-rs/algebra/pull/427/files/1287dd53fd7b7336243328e6e4958a952e13eb5e..d1f04a4b14944e64bd183e13cbf01f0441c38dea#diff-78d92189991d70924782a646de98d0a4c39c3290ec65d47d27c1d5b165e47a85. * Disable doctype lint warning.
This commit adds latex support within rustdoc for arkworks algebra.
In order to add latex code in textmode, use delimiters
$
and$
.In order to add latex code in displaymode, use delimiters
$$
and$$
.To compile the documentation, use
cargo rustdoc
.This is achieved via the option
--html-in-header
set viaRUSTDOCFLAGS
, orbuild.rustdocflags
of.cargo/config.toml
I opted for the latter making it a default compilation flag to use with
rustdoc.
IMPORTANT: for some reason (independent from us)
cargo rustdoc
failson rust nightly and this is due to a failure concerning
cfg-if
andrand-chacha
. I did not investigate the reason why this happened.