rust-lang / docs.rs

crates.io documentation generator
https://docs.rs
MIT License
975 stars 194 forks source link

Enable footnotes for README.md files #1743

Open jyn514 opened 2 years ago

jyn514 commented 2 years ago

There's an actual missing feature still, looking at this diff — footnotes. Do you know if these are actually used in Markdown files parsed by docs.rs? They're not supported by GitHub's own README.md renderer, for what it's worth.

Footnotes are now a part of github-favored markdown^1, is it now possible to add this feature to the docs?

This mostly involves enabling in Comrak, where they're already supported.

Originally posted by @zStruCat in https://github.com/rust-lang/docs.rs/issues/117#issuecomment-1147559768

BGR360 commented 1 year ago

I'm confused. I've used footnotes in my rustdocs before and they're rendered on docs.rs: https://docs.rs/minecraft-assets/latest/minecraft_assets/versions/index.html#fn1.

What's the issue? Is it when you do #[doc = include_str!("README.md")]?

jyn514 commented 1 year ago

@BGR360 this is specifically for the README, which docs.rs renders even for crates which don't get documented by rustdoc (e.g. binaries): https://docs.rs/crate/bat/latest

jyn514 commented 1 year ago

This looks like the right part of the code: https://github.com/rust-lang/docs.rs/blob/a43b0fb8a9fecb68f92c8e348874e989e8e02687/src/web/markdown.rs#L51-L70

BGR360 commented 1 year ago

Ah, I see. Thanks.

@rustbot claim

EDIT: aw, no rustbot ;_;

BGR360 commented 1 year ago

I think the docs.rs build environment is busted on M1 macs. It's trying to run x86 docker containers.

running `Command { std: "docker" "create" "-v" "/Users/ben/Documents/Rust/rust-lang/docs.rs/.workspace/builds/essential-files-20221130-1.67.0-nightly-c97b539e4/target:/opt/rustwide/target:rw,Z" "-v" "/Users/ben/Documents/Rust/rust-lang/docs.rs/.workspace/builds/essential-files-20221130-1.67.0-nightly-c97b539e4/source:/opt/rustwide/workdir:ro,Z" "-v" "/Users/ben/Documents/Rust/rust-lang/docs.rs/.workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/Users/ben/Documents/Rust/rust-lang/docs.rs/.workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "DOCS_RS=1" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "3221225472" "--user" "501:20" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux-micro" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "rustdoc" "--lib" "-Zrustdoc-map" "-Z" "unstable-options" "--config" "build.rustdocflags=[\"-Z\", \"unstable-options\", \"--emit=unversioned-shared-resources,toolchain-shared-resources\", \"--resource-suffix\", \"-20221130-1.67.0-nightly-c97b539e4\", \"--static-root-path\", \"/-/rustdoc.static/\", \"--cap-lints\", \"warn\", \"--disable-per-crate-search\", \"--extern-html-root-takes-precedence\"]" "--offline" "-Zunstable-options" "--config=doc.extern-map.registries.crates-io=\"https://docs.rs/{pkg_name}/{version}/aarch64-apple-darwin\"" "--target" "aarch64-apple-darwin", kill_on_drop: false }` log.target="rustwide::cmd" log.module_path="rustwide::cmd" log.file="/Users/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.15.2/src/cmd/mod.rs" log.line=479
2022-12-01T05:36:52.536450Z  INFO log: [stderr] WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested log.target="rustwide::cmd" log.module_path="rustwide::cmd" log.file="/Users/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.15.2/src/cmd/mod.rs" log.line=621
2022-12-01T05:36:52.536514Z  INFO log: [stdout] 06e3ad4d5d4c6c5807228ae22b3e4b4ec36a48b33376da0338c7fa25be7ddd53 log.target="rustwide::cmd" log.module_path="rustwide::cmd" log.file="/Users/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.15.2/src/cmd/mod.rs" log.line=621
2022-12-01T05:36:52.550261Z  INFO log: running `Command { std: "docker" "start" "-a" "06e3ad4d5d4c6c5807228ae22b3e4b4ec36a48b33376da0338c7fa25be7ddd53", kill_on_drop: false }` log.target="rustwide::cmd" log.module_path="rustwide::cmd" log.file="/Users/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.15.2/src/cmd/mod.rs" log.line=479
2022-12-01T05:36:52.851696Z  INFO log: [stderr] standard_init_linux.go:228: exec user process caused: exec format error log.target="rustwide::cmd" log.module_path="rustwide::cmd" log.file="/Users/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.15.2/src/cmd/mod.rs" log.line=621
syphar commented 1 year ago

I think the docs.rs build environment is busted on M1 macs. It's trying to run x86 docker containers.

yep, it definitely is. On intel macs you needed to run the build inside the web container, which worked, but not any more on M1.

BGR360 commented 1 year ago

Can you please call this out more clearly in the README? To save future folks the time wasted trying.

syphar commented 1 year ago

sorry about that.

Btw, if it's only about this issue, the readme is stored in the database (releases.readme), so you might be able to just put in a record into releases and crates, and test the Markdown rendering accordingly.