Hey, is there a way to have
rustdoc highlight using a different language syntax while still considering it a doc test? That might seem odd, but the use case I have is that we want to show configuration examples which are also validated when running
See the following example, this will only show TOML in the generated documentation, but it will be highlighted as Rust code.
//! ```rust //! # let data = r#" //! key = "value" //! [dependencies.serde] //! optional = true //! # "; //! # toml::from_str::<Config>(data).unwrap(); //! ```
So, the basic answer is no. One thing which was suggested though was for the users to use a JS syntax highlighter on their own so they can modify the code blocks as they see fit.
Last updated: Oct 11 2021 at 22:34 UTC