File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,41 @@ const path = require('path');
13
13
const url = require ( 'url' ) ;
14
14
15
15
const hljs = require ( 'highlight.js' ) ;
16
+ hljs . registerLanguage ( 'uritemplate' , function ( ) {
17
+ return {
18
+ case_insensitive : true ,
19
+ contains : [
20
+ {
21
+ scope : "attr" ,
22
+ match : / (?< = [ { , ] ) [ ^ , } \n \r ] + / ,
23
+ }
24
+ ] ,
25
+ }
26
+ } ) ;
27
+ hljs . registerLanguage ( 'uri' , function ( ) {
28
+ return {
29
+ case_insensitive : true ,
30
+ classNameAliases : {
31
+ pathsegment : "attr" ,
32
+ option : "attr" ,
33
+ value : "literal"
34
+ } ,
35
+ contains : [
36
+ {
37
+ scope : "pathsegment" ,
38
+ match : / (?< = [ / ] ) [ ^ / ? # \n \r ] + / ,
39
+ } ,
40
+ {
41
+ scope : "option" ,
42
+ match : / (?< = [ ? & # ] ) [ ^ = ? & # \n \r ] + / ,
43
+ } ,
44
+ {
45
+ scope : "value" ,
46
+ match : / (?< = \= ) [ ^ ? & # \n \r ] + / ,
47
+ }
48
+ ] ,
49
+ }
50
+ } ) ;
16
51
const cheerio = require ( 'cheerio' ) ;
17
52
18
53
let argv = require ( 'yargs' )
Original file line number Diff line number Diff line change 28
28
</ code > </ pre >
29
29
< pre class ="nohighlight " tabindex ="0 "> < code > unknown language
30
30
</ code > </ pre >
31
+ < pre class ="nohighlight " tabindex ="0 "> < code > https://< span class ="hljs-attr "> foo.com</ span > /< span class ="hljs-attr "> bar</ span > ?< span class ="hljs-attr "> baz</ span > =< span class ="hljs-literal "> qux</ span > &< span class ="hljs-attr "> fred</ span > =< span class ="hljs-literal "> waldo</ span > #< span class ="hljs-attr "> fragment</ span >
32
+ </ code > </ pre >
33
+ < pre class ="nohighlight " tabindex ="0 "> < code > https://foo.com/bar{< span class ="hljs-attr "> ?baz*</ span > ,< span class ="hljs-attr "> qux</ span > }
34
+ </ code > </ pre >
31
35
</ section > </ section > < section class ="appendix "> < h1 > Appendix A: Revision History</ h1 >
32
36
< table >
33
37
< thead >
Original file line number Diff line number Diff line change @@ -54,6 +54,14 @@ no language
54
54
unknown language
55
55
```
56
56
57
+ ``` uri
58
+ https://foo.com/bar?baz=qux&fred=waldo#fragment
59
+ ```
60
+
61
+ ``` uritemplate
62
+ https://foo.com/bar{?baz*,qux}
63
+ ```
64
+
57
65
## Appendix A: Revision History
58
66
59
67
Version | Date
You can’t perform that action at this time.
0 commit comments