Add syntax highlighting for TOML to rustdoc
Since TOML is such an essential part of the Rust ecosystem, it’s probably worth adding syntax highlighting for this file format. Here is an example of a code block that is currently ignored, syntax-highlighting-wise, when generating the documentation.
I'm shared on this. I agree on the fact that's nice to have and all, but that's not really useful in itself... Let's say I'm slightly against it but not much.
Guillaume Gomez at 2017-07-11 20:21:34
I use it in the book, so 👍 from me.
Steve Klabnik at 2017-07-12 01:11:23
Maybe there's an easy way to optionally include a standard syntax highlighting js library for non-rust languages?
Highlighting other languages in rustdoc has been reasonably requested before: https://github.com/rust-lang/rust/issues/40301
Eirik A at 2018-11-02 11:50:11
I would really like this too.
Jelte Fennema-Nio at 2019-11-07 08:42:45
@clux: you can add your own JS lib. A good example is this crate.
Guillaume Gomez at 2019-11-07 15:56:13
YAML support might also be nice, e.g. for
clap.Noah Lev at 2020-09-14 21:19:16
I'd definitely like supporting other languages. Rust doesn't exist in a vacuum and there are plenty of reasons to write code in other langs, such as:
- bindings to other languages
- examples how to run a Rust application from a shell script
- references to foreign code ("this is equivalent to ... in C++")
Martin Habovštiak at 2022-11-20 22:52:35
Interestingly enough, docs.rs does support highliting toml, if you navigate to crate (and the toml is there) https://docs.rs/crate/rnotify/0.1.3
tyhdefu at 2023-02-04 15:27:46
Interestingly enough, docs.rs does support highliting toml, if you navigate to crate (and the toml is there) https://docs.rs/crate/rnotify/0.1.3
Small correction here: this issue here is talking about code blocks inside the documentation, the example from the docs.rs crate pages is just the place where we take the readme markdown file from the crate and pass it through comrak. We also render source files by passing them through comrak.
But this issue is talking about code blocks inside the HTML doc pages.
Denis Cornehl at 2024-08-07 06:09:46