Skip to content

Commit af1b721

Browse files
committed
Move base URI examples to appendix
1 parent 4225262 commit af1b721

File tree

2 files changed

+226
-149
lines changed

2 files changed

+226
-149
lines changed

scripts/md2html/md2html.js

+82-5
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,99 @@ hljs.registerLanguage('uri', function() {
4848
],
4949
}
5050
});
51-
hljs.registerLanguage('eventstream', function() {
51+
hljs.registerLanguage('multipart', function() {
5252
return {
53+
// This is a very limited approach that only
54+
// detects boundaries and headers that start
55+
// with "Content-"
5356
contains: [
5457
{
55-
scope: "attr",
56-
begin: /^/,
57-
end: ":",
58+
scope: "meta",
59+
match: /^--.*$/,
5860
},
5961
{
6062
scope: "literal",
61-
begin: /: */,
63+
begin: /^Content-/,
64+
end: /$/,
65+
contains: [
66+
{
67+
scope: "attr",
68+
begin: " ",
69+
end: /$/,
70+
},
71+
]
72+
},
73+
],
74+
}
75+
});
76+
hljs.registerLanguage('eventstream', function() {
77+
return {
78+
contains: [
79+
{
80+
scope: "comment",
81+
begin: /^:/,
6282
end: /$/,
6383
},
84+
{
85+
scope: "attr",
86+
match: /^[^:]+/
87+
},
6488
],
6589
}
6690
});
91+
hljs.registerLanguage('jsonseq', function() {
92+
return {
93+
keywords: ["true", "false", "null"],
94+
contains: [
95+
{
96+
scope: "meta",
97+
match: /0[xX]1[eE]/,
98+
},
99+
{
100+
scope: "attr",
101+
begin: /"(\\.|[^\\"\r\n])*"(?=\s*:)/,
102+
relevance: 1.01
103+
},
104+
{
105+
scope: "punctuation",
106+
match: /[{}[\],:]/,
107+
relevance: 0
108+
},
109+
{
110+
scope: "literals",
111+
beginKeywords: ["true", "false" , "null"].join(" "),
112+
},
113+
hljs.QUOTE_STRING_MODE,
114+
hljs.C_NUMBER_MODE
115+
]
116+
}
117+
});
118+
hljs.registerLanguage('jsonl', function() {
119+
return {
120+
aliases: ["ndjson"],
121+
keywords: ["true", "false", "null"],
122+
contains: [
123+
{
124+
scope: 'attr',
125+
begin: /"(\\.|[^\\"\r\n])*"(?=\s*:)/,
126+
relevance: 1.01
127+
},
128+
{
129+
scope: "punctuation",
130+
match: /[{}[\],:]/,
131+
relevance: 0
132+
},
133+
{
134+
scope: "literals",
135+
beginKeywords: ["true", "false" , "null"].join(" "),
136+
},
137+
hljs.QUOTE_STRING_MODE,
138+
hljs.C_NUMBER_MODE
139+
]
140+
}
141+
});
142+
143+
67144
const cheerio = require('cheerio');
68145

69146
let argv = require('yargs')

0 commit comments

Comments
 (0)