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

Fix highlighting for rust raw byte string literals #3173

Merged
merged 5 commits into from
May 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Grammars:
- enh(haskell) add support for NumericUnderscores (#3150) [Martijn Bastiaan][]
- enh(haskell) add support for HexFloatLiterals (#3150) [Martijn Bastiaan][]
- fix(c,cpp) allow declaring multiple functions and (for C++) parenthetical initializers (#3155) [Erik Demaine][]
- enh(rust) highlight raw byte string literals correctly (#3173) [Nico Abram][]

New Languages:

Expand Down Expand Up @@ -120,6 +121,7 @@ Dev Improvements:
[Jared Luboff]: https://github.com/jaredlll08
[NullVoxPopuli]: https://github.com/NullVoxPopuli
[Mike Watling]: https://github.com/Pickysaurus
[Nico Abram]:https://github.com/nico-abram


## Version 10.7.1
Expand Down
2 changes: 1 addition & 1 deletion src/languages/rust.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default function(hljs) {
className: 'string',
variants: [
{
begin: /r(#*)"(.|\n)*?"\1(?!#)/
begin: /b?r(#*)"(.|\n)*?"\1(?!#)/
},
{
begin: /b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/
Expand Down
4 changes: 4 additions & 0 deletions test/markup/rust/strings.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@
<span class="hljs-string">r###&quot;world&quot;###</span>;
<span class="hljs-string">r##&quot; &quot;###
&quot;# &quot;##</span>;

<span class="hljs-string">br&quot; &quot;</span>;
<span class="hljs-string">br#&quot;hello&quot;#</span>;
<span class="hljs-string">br##&quot;foo&quot;##</span>;
4 changes: 4 additions & 0 deletions test/markup/rust/strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ r"hello";
r###"world"###;
r##" "###
"# "##;

br" ";
br#"hello"#;
br##"foo"##;