Skip to content

Commit 3cc0800

Browse files
authored
enh(java) Add support for text block (#3322)
* enh(java) Add support for text block * Add markup test for Java Text Block.
1 parent 29afe48 commit 3cc0800

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ Grammars:
1414
- fix(cpp) fix `xor_eq` keyword highlighting. [Denis Kovalchuk][]
1515
- enh(c,cpp) highlight type modifiers as type (#3316) [Josh Goebel][]
1616
- enh(css/less/stylus/scss) add support for CSS Grid properties [monochromer][]
17+
- enh(java) add support for Java Text Block (#3322) [Teletha][]
1718
- enh(scala) add missing `do` and `then` keyword (#3323) [Nicolas Stucki][]
1819

1920
[Austin Schick]: https://github.com/austin-schick
2021
[Josh Goebel]: https://github.com/joshgoebel
2122
[Denis Kovalchuk]: https://github.com/deniskovalchuk
2223
[monochromer]: https://github.com/monochromer
24+
[Teletha]: https://github.com/teletha
2325
[Nicolas Stucki]: https://github.com/nicolasstucki
2426

2527

src/languages/java.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ export default function(hljs) {
160160
},
161161
hljs.C_LINE_COMMENT_MODE,
162162
hljs.C_BLOCK_COMMENT_MODE,
163+
{
164+
begin: /"""/,
165+
end: /"""/,
166+
className: "string",
167+
contains: [hljs.BACKSLASH_ESCAPE]
168+
},
163169
hljs.APOS_STRING_MODE,
164170
hljs.QUOTE_STRING_MODE,
165171
{

test/markup/java/textblock.expect.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<span class="hljs-type">String</span> <span class="hljs-variable">json</span> <span class="hljs-operator">=</span> <span class="hljs-string">&quot;&quot;&quot;
2+
{
3+
&quot;key&quot;: &quot;value&quot;
4+
}
5+
&quot;&quot;&quot;</span>;

test/markup/java/textblock.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
String json = """
2+
{
3+
"key": "value"
4+
}
5+
""";

0 commit comments

Comments
 (0)