Skip to content
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

Add syntax highlighting for TOML to rustdoc #43165

Open
IvanUkhov opened this issue Jul 11, 2017 · 9 comments
Open

Add syntax highlighting for TOML to rustdoc #43165

IvanUkhov opened this issue Jul 11, 2017 · 9 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@IvanUkhov
Copy link
Contributor

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.

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Jul 11, 2017

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.

@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. labels Jul 11, 2017
@steveklabnik
Copy link
Member

I use it in the book, so 👍 from me.

@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 28, 2017
@clux
Copy link

clux commented Nov 2, 2018

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: #40301

@JelteF
Copy link
Contributor

JelteF commented Nov 7, 2019

I would really like this too.

@GuillaumeGomez
Copy link
Member

@clux: you can add your own JS lib. A good example is this crate.

@camelid
Copy link
Member

camelid commented Sep 14, 2020

YAML support might also be nice, e.g. for clap.

@ehuss ehuss removed the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jan 18, 2022
@Kixunil
Copy link
Contributor

Kixunil commented Nov 20, 2022

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++")

@tyhdefu
Copy link

tyhdefu commented Feb 4, 2023

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

@syphar
Copy link
Member

syphar commented Aug 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests