-
Notifications
You must be signed in to change notification settings - Fork 198
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
Feature request: inject syntax highlighting for TOML into crate docs #2577
Comments
btw, thanks for your library, I'm currently in the process of migrating docs.rs to it :)
We have some pages where we actually do highlighting, there are:
in both cases we have the actual source and render a highlighted HTML version using comrak. Now back to your topic. Docs.rs just runs a (relatively) normal So while we actually could rewrite HTML (we are already rewriting small parts, for example to add the top / bottom bar), the actual correct place would be rustdoc, since then users using docs.rs would see the same docs as users running the doc build locally. Also I believe a well readable doc page without broken styling, across all nightly rustdoc versions would be really hard. |
of course we could also use frontend techniques to do something similar, but with similar issues keeping it stable across versions |
I think we should just add highlightjs at this point and run it by default on all pages. |
you mean that rustdoc should do this ? or docs.rs? I don't have much experience with highlight.js, I only know that for the pages we render ourselves (like our source) it was replaced by server side highlighting. Wouldn't this conflict with the cases where rustdoc is already highlighting, like its own source pages? |
I meant docs.rs. And I can write the JS so highlightjs only takes a look at not highlighted code examples. |
I just ran into this while working on launchbadge/sqlx#3383
It'd be really nice to have syntax highlighting for TOML in crate docs, because I'm including a lot of it.
I found #1047 which was closed already and the upstream issue rust-lang/rust#43165, but the general disposition for the latter seems to be summed up by this comment: rust-lang/rust#43165 (comment)
It doesn't seem likely that
rustdoc
itself will gain support for this anytime soon.The reason I'm opening this issue is because this comment points out that TOML syntax highlighting is already available on the details pages for crates. It doesn't seem like it would take much to inject it into the HTML for the docs themselves.
The text was updated successfully, but these errors were encountered: