Closed alphaville closed 4 years ago
Yes; the metadata table is only for controlling the rustdoc arguments on the docs-rs build.
Unfortunately, I don't know any way to automatically include the rustdoc arguments for a unadorned cargo doc
. However, you should be able to use an alias iff there's a way to pass rustdocflags directly to cargo-doc
. (I think doc --no-deps -- --html-in-header katex-header.html
might work? Can't check at the moment.)
@CAD97 Thank you for your prompt reply.
Passing html-in-header
as you suggested doesn't work. Pre-pending RUSTDOCFLAGS="--html-in-header katex-header.html"
works fine, but I'm mainly concerned about how I can make a release on crates.io that will render equations properly on docs.rs as in your documentation.
Does it suffice to publish my create with
[package.metadata.docs.rs]
rustdoc-args = [
"--html-in-header",
".cargo/registry/src/github.com-1ecc6299db9ec823/katex-doc-0.1.0/katex.html",
]
I created a "task" in Makefile.toml
as follows
[tasks.doc-katex]
env = { "RUSTDOCFLAGS" = "--html-in-header katex-header.html" }
command = "cargo"
args = ["doc", "--no-deps"]
[tasks.all]
dependencies = [
"docs",
"doc-katex",
]
and I'm now able to compile the docs with cargo make doc-katex
.
It also works fine on docs.rs.
Maybe this is not entirely related to this project, but you might be aware of the following issue. When I run
cargo doc
the following way:the specified header file is included and all equations render properly. However, if I include the following lines in my
Cargo.toml
and run
cargo doc
, cargo seems to ignorehtml-in-header
.The file
katex-header.html
is in the root path of my project. I tried with the full path, but it wasn't successful either.