This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -625,3 +625,32 @@ and check the values of `feature`: `foo` and `bar`.
625
625
626
626
This flag enables the generation of links in the source code pages which allow the reader
627
627
to jump to a type definition.
628
+
629
+ ### Custom CSS classes for code blocks
630
+
631
+ ``` rust
632
+ #![feature(custom_code_classes_in_docs)]
633
+
634
+ /// ```{class=language-c}
635
+ /// int main(void) { return 0; }
636
+ /// ```
637
+ pub struct Bar ;
638
+ ```
639
+
640
+ The text ` int main(void) { return 0; } ` is rendered without highlighting in a code block
641
+ with the class ` language-c ` . This can be used to highlight other languages through JavaScript
642
+ libraries for example.
643
+
644
+ To be noted that you can replace ` class= ` with ` . ` to achieve the same result:
645
+
646
+ ``` rust
647
+ #![feature(custom_code_classes_in_docs)]
648
+
649
+ /// ```{.language-c}
650
+ /// int main(void) { return 0; }
651
+ /// ```
652
+ pub struct Bar ;
653
+ ```
654
+
655
+ To be noted, ` rust ` and ` .rust ` /` class=rust ` have different effects: ` rust ` indicates that this is
656
+ a Rust code block whereas the two others add a "rust" CSS class on the code block.
You can’t perform that action at this time.
0 commit comments