Skip to content

Accept additional user-defined syntax classes in fenced code blocks #110800

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

Merged
merged 13 commits into from
Sep 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update documentation for custom_code_classes_in_docs feature
  • Loading branch information
GuillaumeGomez committed Sep 15, 2023
commit 7c72edf19fa72a1c9596a79ee9221342a27289ad
8 changes: 6 additions & 2 deletions src/doc/rustdoc/src/unstable-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ to jump to a type definition.
```rust
#![feature(custom_code_classes_in_docs)]

/// ```{class=language-c}
/// ```custom,{class=language-c}
/// int main(void) { return 0; }
/// ```
pub struct Bar;
Expand All @@ -641,12 +641,16 @@ The text `int main(void) { return 0; }` is rendered without highlighting in a co
with the class `language-c`. This can be used to highlight other languages through JavaScript
libraries for example.

Without the `custom` attribute, it would be generated as a Rust code example with an additional
`language-C` CSS class. Therefore, if you specifically don't want it to be a Rust code example,
don't forget to add the `custom` attribute.

To be noted that you can replace `class=` with `.` to achieve the same result:

```rust
#![feature(custom_code_classes_in_docs)]

/// ```{.language-c}
/// ```custom,{.language-c}
/// int main(void) { return 0; }
/// ```
pub struct Bar;
Expand Down