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

enh(java) Add support for text block #3322

Merged
merged 6 commits into from
Sep 4, 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 @@ -14,12 +14,14 @@ Grammars:
- fix(cpp) fix `xor_eq` keyword highlighting. [Denis Kovalchuk][]
- enh(c,cpp) highlight type modifiers as type (#3316) [Josh Goebel][]
- enh(css/less/stylus/scss) add support for CSS Grid properties [monochromer][]
- enh(java) add support for Java Text Block (#3322) [Teletha][]
- enh(scala) add missing `do` and `then` keyword (#3323) [Nicolas Stucki][]

[Austin Schick]: https://github.com/austin-schick
[Josh Goebel]: https://github.com/joshgoebel
[Denis Kovalchuk]: https://github.com/deniskovalchuk
[monochromer]: https://github.com/monochromer
[Teletha]: https://github.com/teletha
[Nicolas Stucki]: https://github.com/nicolasstucki


Expand Down
6 changes: 6 additions & 0 deletions src/languages/java.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ export default function(hljs) {
},
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
begin: /"""/,
end: /"""/,
className: "string",
contains: [hljs.BACKSLASH_ESCAPE]
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{
Expand Down
5 changes: 5 additions & 0 deletions test/markup/java/textblock.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<span class="hljs-type">String</span> <span class="hljs-variable">json</span> <span class="hljs-operator">=</span> <span class="hljs-string">&quot;&quot;&quot;
{
&quot;key&quot;: &quot;value&quot;
}
&quot;&quot;&quot;</span>;
5 changes: 5 additions & 0 deletions test/markup/java/textblock.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
String json = """
{
"key": "value"
}
""";