Fix rust doctest non-hidden macro highlight

This commit is contained in:
Ivan Tham 2020-06-02 22:03:37 +08:00
parent e14cc26f1b
commit eac5986323
2 changed files with 17 additions and 2 deletions

View File

@ -39,10 +39,9 @@ add-highlighter shared/rust/line_doctest region ^\h*//[!/]\h*```($|should_panic|
add-highlighter shared/rust/line_doctest/marker region ```.* $ group
add-highlighter shared/rust/line_doctest/marker/fence regex ``` 0:meta
add-highlighter shared/rust/line_doctest/marker/keywords regex [\d\w] 0:meta # already matched above, just ignore comma
add-highlighter shared/rust/line_doctest/inner region '^\h*//[!/]\h+#' ' ' group
add-highlighter shared/rust/line_doctest/inner region '^\h*//[!/]( #(?= )|)' ' ' group
add-highlighter shared/rust/line_doctest/inner/comment regex //[!/] 0:documentation
add-highlighter shared/rust/line_doctest/inner/hidden regex '#' 0:meta
add-highlighter shared/rust/line_doctest/comment region ^\h*//[!/] ' ' fill documentation
add-highlighter shared/rust/line_doctest/code default-region ref rust
add-highlighter shared/rust/line_code_rest region ^\h*//[!/]\h*``` ^\h*//[!/]\h*```$ fill documentation # reset invalid doctest
add-highlighter shared/rust/line_comment2 region //[!/]{2} $ fill comment

View File

@ -86,3 +86,19 @@ fn bar(s: &str) {
* ```
*/
//! ```
//! // not hidden #
//! #![feature(x)]
//! # // hidden #
//! # #![feature(x)]
//! ```
/**
* ```
* // not hidden #
* #![feature(x)]
* # // hidden #
* # #![feature(x)]
* ```
*/