@podlite/editor-react 0.0.61 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.podlite +32 -0
- package/esm/Editor.css +22 -0
- package/esm/Editor.js +21 -6
- package/esm/Editor.js.map +1 -1
- package/esm/diagnostics.d.ts +18 -0
- package/esm/diagnostics.js +37 -0
- package/esm/diagnostics.js.map +1 -0
- package/esm/foldPodlite.js +11 -35
- package/esm/foldPodlite.js.map +1 -1
- package/esm/helpers.d.ts +3 -0
- package/esm/helpers.js +6 -12
- package/esm/helpers.js.map +1 -1
- package/esm/podliteDecorations.d.ts +5 -0
- package/esm/podliteDecorations.js +55 -0
- package/esm/podliteDecorations.js.map +1 -0
- package/esm/podliteMarkdown.d.ts +16 -0
- package/esm/podliteMarkdown.js +384 -0
- package/esm/podliteMarkdown.js.map +1 -0
- package/esm/theme.d.ts +101 -0
- package/esm/theme.js +61 -49
- package/esm/theme.js.map +1 -1
- package/lib/Editor.css +22 -0
- package/lib/Editor.js +21 -6
- package/lib/Editor.js.map +1 -1
- package/lib/diagnostics.d.ts +18 -0
- package/lib/diagnostics.js +43 -0
- package/lib/diagnostics.js.map +1 -0
- package/lib/foldPodlite.js +10 -34
- package/lib/foldPodlite.js.map +1 -1
- package/lib/helpers.d.ts +3 -0
- package/lib/helpers.js +7 -12
- package/lib/helpers.js.map +1 -1
- package/lib/podliteDecorations.d.ts +5 -0
- package/lib/podliteDecorations.js +59 -0
- package/lib/podliteDecorations.js.map +1 -0
- package/lib/podliteMarkdown.d.ts +16 -0
- package/lib/podliteMarkdown.js +391 -0
- package/lib/podliteMarkdown.js.map +1 -0
- package/lib/theme.d.ts +101 -0
- package/lib/theme.js +62 -50
- package/lib/theme.js.map +1 -1
- package/package.json +3 -2
- package/esm/podlite.d.ts +0 -3
- package/esm/podlite.js +0 -592
- package/esm/podlite.js.map +0 -1
- package/esm/simple-mode.d.ts +0 -19
- package/esm/simple-mode.js +0 -185
- package/esm/simple-mode.js.map +0 -1
- package/lib/podlite.d.ts +0 -3
- package/lib/podlite.js +0 -596
- package/lib/podlite.js.map +0 -1
- package/lib/simple-mode.d.ts +0 -19
- package/lib/simple-mode.js +0 -189
- package/lib/simple-mode.js.map +0 -1
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
|
|
2
|
+
import { ensureSyntaxTree, LanguageDescription, ParseContext, syntaxTree } from '@codemirror/language';
|
|
3
|
+
import { languages } from '@codemirror/language-data';
|
|
4
|
+
import { styleTags, tags as t } from '@lezer/highlight';
|
|
5
|
+
import { parseMixed } from '@lezer/common';
|
|
6
|
+
import { parser as mdParser } from '@lezer/markdown';
|
|
7
|
+
import { BLOCK_NAMES, isVerbatimBlock } from '@podlite/schema';
|
|
8
|
+
const directiveRe = /^=([A-Za-z][\w-]*)(.*)$/;
|
|
9
|
+
// a directive may go on over the next lines, each opened by a bare `=`
|
|
10
|
+
const continuationRe = /^=(\s.*)$/;
|
|
11
|
+
const nameRe = /^(\s+)([A-Za-z][\w-]*)/;
|
|
12
|
+
// `=Markdown` with a capital letter is the old spelling, still met in documents
|
|
13
|
+
const isMarkdownName = (name) => /^markdown$/i.test(name);
|
|
14
|
+
const DIRECTIVE_WORDS = ['begin', 'end', 'for', 'config', 'alias'];
|
|
15
|
+
const TAKES_A_NAME = new Set(['begin', 'end', 'for', 'config']);
|
|
16
|
+
// the directives whose marker line carries settings; on every other one what
|
|
17
|
+
// follows the keyword is content, and `C<…>` there is a markup code, not a value
|
|
18
|
+
const TAKES_SETTINGS = new Set(['begin', 'for', 'config', 'alias', 'set', 'boundary']);
|
|
19
|
+
const standard = (name) => DIRECTIVE_WORDS.includes(name) || BLOCK_NAMES.includes(name) || /^(head|item)\d*$/.test(name);
|
|
20
|
+
// SYNOPSIS and SEE-ALSO name a section of the document; Image and Diagram name
|
|
21
|
+
// a block the author brought in; the rest is a name nothing here knows
|
|
22
|
+
const nodeForName = (name) => {
|
|
23
|
+
if (standard(name))
|
|
24
|
+
return 'PodBlockName';
|
|
25
|
+
if (/^[A-Z][A-Z][A-Z0-9_-]*$/.test(name))
|
|
26
|
+
return 'PodSemanticBlock';
|
|
27
|
+
if (/^[A-Z][a-z][a-zA-Z0-9_-]*$/.test(name))
|
|
28
|
+
return 'PodCustomBlock';
|
|
29
|
+
return 'PodUnknownBlock';
|
|
30
|
+
};
|
|
31
|
+
// a value keeps its own delimiters; the norm has no square brackets since 2026-08
|
|
32
|
+
const attrRe = /:!?[\w-]+|<[^>]*>|\([^)]*\)|\{[^}]*\}|'[^']*'|"[^"]*"|「[^」]*」/g;
|
|
33
|
+
// every markup code the grammar accepts, coloured by what it turns into when
|
|
34
|
+
// the document is rendered: K and T are typed text like C, R names a stand-in
|
|
35
|
+
// value, H and J stand above and below the line, N and X leave a mark for the
|
|
36
|
+
// reader rather than text
|
|
37
|
+
const CODE_TAGS = {
|
|
38
|
+
A: t.variableName,
|
|
39
|
+
B: t.strong,
|
|
40
|
+
C: t.monospace,
|
|
41
|
+
D: t.definition(t.variableName),
|
|
42
|
+
E: t.escape,
|
|
43
|
+
F: t.literal,
|
|
44
|
+
G: t.comment,
|
|
45
|
+
H: t.annotation,
|
|
46
|
+
I: t.emphasis,
|
|
47
|
+
J: t.annotation,
|
|
48
|
+
K: t.monospace,
|
|
49
|
+
L: t.link,
|
|
50
|
+
N: t.meta,
|
|
51
|
+
O: t.strikethrough,
|
|
52
|
+
R: t.variableName,
|
|
53
|
+
S: t.content,
|
|
54
|
+
T: t.monospace,
|
|
55
|
+
U: t.labelName,
|
|
56
|
+
V: t.content,
|
|
57
|
+
W: t.link,
|
|
58
|
+
X: t.meta,
|
|
59
|
+
Z: t.comment,
|
|
60
|
+
};
|
|
61
|
+
const CODE_LETTERS = Object.keys(CODE_TAGS);
|
|
62
|
+
const codeNodeNames = CODE_LETTERS.map(c => `PodCode${c}`);
|
|
63
|
+
const closingFor = (open) => (open === '«' ? '»' : '>'.repeat(open.length));
|
|
64
|
+
const openerAt = (src, at) => {
|
|
65
|
+
if (!CODE_TAGS[src[at]])
|
|
66
|
+
return null;
|
|
67
|
+
if (src[at + 1] === '«')
|
|
68
|
+
return '«';
|
|
69
|
+
let open = '';
|
|
70
|
+
let i = at + 1;
|
|
71
|
+
while (src[i] === '<') {
|
|
72
|
+
open += '<';
|
|
73
|
+
i++;
|
|
74
|
+
}
|
|
75
|
+
return open || null;
|
|
76
|
+
};
|
|
77
|
+
// a code ends at its matching bracket, so nested codes of the same width count
|
|
78
|
+
const matchingEnd = (src, bodyFrom, open) => {
|
|
79
|
+
const close = closingFor(open);
|
|
80
|
+
let depth = 1;
|
|
81
|
+
let i = bodyFrom;
|
|
82
|
+
while (i < src.length) {
|
|
83
|
+
const nested = openerAt(src, i);
|
|
84
|
+
if (nested === open) {
|
|
85
|
+
depth++;
|
|
86
|
+
i += 1 + open.length;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (src.startsWith(close, i)) {
|
|
90
|
+
depth--;
|
|
91
|
+
if (!depth)
|
|
92
|
+
return i;
|
|
93
|
+
i += close.length;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
i++;
|
|
97
|
+
}
|
|
98
|
+
return -1;
|
|
99
|
+
};
|
|
100
|
+
// L and W carry two parts: what the reader sees and where it points
|
|
101
|
+
const SPLIT_CODES = new Set(['L', 'W']);
|
|
102
|
+
// reads the codes standing between two places in the text
|
|
103
|
+
const readCodesIn = (cx, src, from, to, offset) => {
|
|
104
|
+
const found = [];
|
|
105
|
+
for (let i = from; i < to;) {
|
|
106
|
+
const inner = readCode(cx, src, i, offset);
|
|
107
|
+
if (inner) {
|
|
108
|
+
found.push(inner);
|
|
109
|
+
i = inner.to - offset;
|
|
110
|
+
}
|
|
111
|
+
else
|
|
112
|
+
i++;
|
|
113
|
+
}
|
|
114
|
+
return found;
|
|
115
|
+
};
|
|
116
|
+
// reads one code at `at`; the body is scanned again so nested codes become children
|
|
117
|
+
const readCode = (cx, src, at, offset) => {
|
|
118
|
+
const open = openerAt(src, at);
|
|
119
|
+
if (!open)
|
|
120
|
+
return null;
|
|
121
|
+
const letter = src[at];
|
|
122
|
+
const bodyFrom = at + 1 + open.length;
|
|
123
|
+
const end = matchingEnd(src, bodyFrom, open);
|
|
124
|
+
if (end === -1)
|
|
125
|
+
return null;
|
|
126
|
+
const children = [cx.elt('PodCodeMark', offset + at, offset + bodyFrom)];
|
|
127
|
+
const bar = SPLIT_CODES.has(letter) ? topLevelBar(src, bodyFrom, end, open) : -1;
|
|
128
|
+
if (bar === -1) {
|
|
129
|
+
children.push(...readCodesIn(cx, src, bodyFrom, end, offset));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
children.push(...readCodesIn(cx, src, bodyFrom, bar, offset));
|
|
133
|
+
children.push(cx.elt('PodCodeMark', offset + bar, offset + bar + 1));
|
|
134
|
+
children.push(cx.elt('PodCodeTarget', offset + bar + 1, offset + end, readCodesIn(cx, src, bar + 1, end, offset)));
|
|
135
|
+
}
|
|
136
|
+
children.push(cx.elt('PodCodeMark', offset + end, offset + end + closingFor(open).length));
|
|
137
|
+
return cx.elt(`PodCode${letter}`, offset + at, offset + end + closingFor(open).length, children);
|
|
138
|
+
};
|
|
139
|
+
// the bar that splits the body, the one outside any code nested in it
|
|
140
|
+
const topLevelBar = (src, from, to, open) => {
|
|
141
|
+
for (let i = from; i < to;) {
|
|
142
|
+
const nested = openerAt(src, i);
|
|
143
|
+
if (nested) {
|
|
144
|
+
const end = matchingEnd(src, i + 1 + nested.length, nested);
|
|
145
|
+
if (end !== -1) {
|
|
146
|
+
i = end + closingFor(nested).length;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (src[i] === '|')
|
|
151
|
+
return i;
|
|
152
|
+
i++;
|
|
153
|
+
}
|
|
154
|
+
return -1;
|
|
155
|
+
};
|
|
156
|
+
// the tag each kind of name is coloured by; a check compares the colours these
|
|
157
|
+
// reach, because two of them once reached the same one
|
|
158
|
+
export const ROLE_TAGS = {
|
|
159
|
+
keyword: t.keyword,
|
|
160
|
+
blockName: t.operator,
|
|
161
|
+
semanticBlock: t.macroName,
|
|
162
|
+
customBlock: t.tagName,
|
|
163
|
+
unknownBlock: t.variableName,
|
|
164
|
+
attrName: t.attributeName,
|
|
165
|
+
attrValue: t.string,
|
|
166
|
+
};
|
|
167
|
+
export const podliteMarkdownExtension = {
|
|
168
|
+
defineNodes: [
|
|
169
|
+
{ name: 'PodDirective', block: true },
|
|
170
|
+
{
|
|
171
|
+
name: 'PodMarkdownBody',
|
|
172
|
+
block: true,
|
|
173
|
+
// 1 — the body of a delimited block, it runs up to its closing marker;
|
|
174
|
+
// 0 — the body of an abbreviated one, it runs to a blank line or the next directive
|
|
175
|
+
composite: (_cx, line, value) => value ? !/^\s*=end\s+markdown\b/i.test(line.text) : !!line.text.trim() && !/^\s*=/.test(line.text),
|
|
176
|
+
},
|
|
177
|
+
{ name: 'PodKeyword' },
|
|
178
|
+
{ name: 'PodBlockName' },
|
|
179
|
+
{ name: 'PodSemanticBlock' },
|
|
180
|
+
{ name: 'PodCustomBlock' },
|
|
181
|
+
{ name: 'PodUnknownBlock' },
|
|
182
|
+
{ name: 'PodAttrName' },
|
|
183
|
+
{ name: 'PodAttrValue' },
|
|
184
|
+
{ name: 'PodVerbatim' },
|
|
185
|
+
{ name: 'PodCodeBody' },
|
|
186
|
+
{ name: 'PodCodeMark' },
|
|
187
|
+
{ name: 'PodCodeTarget' },
|
|
188
|
+
...codeNodeNames.map(name => ({ name })),
|
|
189
|
+
],
|
|
190
|
+
props: [
|
|
191
|
+
styleTags({
|
|
192
|
+
// the same tags the stream highlighter gave these, so colours stay put
|
|
193
|
+
PodKeyword: t.keyword,
|
|
194
|
+
PodBlockName: t.operator,
|
|
195
|
+
PodSemanticBlock: t.macroName,
|
|
196
|
+
PodCustomBlock: t.tagName,
|
|
197
|
+
PodUnknownBlock: t.variableName,
|
|
198
|
+
PodAttrName: t.attributeName,
|
|
199
|
+
PodAttrValue: t.string,
|
|
200
|
+
PodVerbatim: t.content,
|
|
201
|
+
PodCodeBody: t.content,
|
|
202
|
+
PodCodeMark: t.processingInstruction,
|
|
203
|
+
PodCodeTarget: t.url,
|
|
204
|
+
...Object.fromEntries(CODE_LETTERS.map(c => [`PodCode${c}`, CODE_TAGS[c]])),
|
|
205
|
+
}),
|
|
206
|
+
],
|
|
207
|
+
parseInline: [
|
|
208
|
+
{
|
|
209
|
+
name: 'PodFormattingCode',
|
|
210
|
+
before: 'Emphasis',
|
|
211
|
+
parse(cx, next, pos) {
|
|
212
|
+
const el = readCode(cx, cx.text, pos - cx.offset, cx.offset);
|
|
213
|
+
return el ? cx.addElement(el) : -1;
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
parseBlock: [
|
|
218
|
+
{
|
|
219
|
+
name: 'PodDirective',
|
|
220
|
+
before: 'ATXHeading',
|
|
221
|
+
// a directive right under a line of text starts a block of its own,
|
|
222
|
+
// it does not go on the paragraph above
|
|
223
|
+
endLeaf(_cx, line) {
|
|
224
|
+
return directiveRe.test(line.text) || continuationRe.test(line.text);
|
|
225
|
+
},
|
|
226
|
+
parse(cx, line) {
|
|
227
|
+
const text = line.text.slice(line.pos);
|
|
228
|
+
const m = directiveRe.exec(text);
|
|
229
|
+
const cont = m ? null : continuationRe.exec(text);
|
|
230
|
+
if (!m && !cont)
|
|
231
|
+
return false;
|
|
232
|
+
const start = cx.lineStart + line.pos;
|
|
233
|
+
const markerEnd = cx.lineStart + line.text.length;
|
|
234
|
+
const children = [];
|
|
235
|
+
let at = start;
|
|
236
|
+
let word = '';
|
|
237
|
+
let blockName = '';
|
|
238
|
+
let rest = '';
|
|
239
|
+
if (cont) {
|
|
240
|
+
children.push(cx.elt('PodKeyword', at, at + 1));
|
|
241
|
+
at += 1;
|
|
242
|
+
rest = cont[1];
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
word = m[1];
|
|
246
|
+
rest = m[2];
|
|
247
|
+
// `=begin`, `=head1` and the like read as one word; a name of its own
|
|
248
|
+
// keeps the `=` a keyword and takes its colour from what the name is
|
|
249
|
+
if (standard(word)) {
|
|
250
|
+
children.push(cx.elt('PodKeyword', at, at + 1 + word.length));
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
children.push(cx.elt('PodKeyword', at, at + 1));
|
|
254
|
+
children.push(cx.elt(nodeForName(word), at + 1, at + 1 + word.length));
|
|
255
|
+
}
|
|
256
|
+
at += 1 + word.length;
|
|
257
|
+
const n = TAKES_A_NAME.has(word) ? nameRe.exec(rest) : null;
|
|
258
|
+
if (n) {
|
|
259
|
+
blockName = n[2];
|
|
260
|
+
children.push(cx.elt(nodeForName(blockName), at + n[1].length, at + n[0].length));
|
|
261
|
+
at += n[0].length;
|
|
262
|
+
rest = rest.slice(n[0].length);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (cont || TAKES_SETTINGS.has(word)) {
|
|
266
|
+
for (const a of rest.matchAll(attrRe)) {
|
|
267
|
+
const from = at + a.index;
|
|
268
|
+
children.push(cx.elt(a[0][0] === ':' ? 'PodAttrName' : 'PodAttrValue', from, from + a[0].length));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
else if (rest) {
|
|
272
|
+
// an abbreviated block carries its content on the marker line
|
|
273
|
+
children.push(...cx.parser.parseInline(rest, at));
|
|
274
|
+
}
|
|
275
|
+
// a block that keeps its content as written: markdown must not read it.
|
|
276
|
+
// `=begin markdown` is the exception — its content is markdown by definition
|
|
277
|
+
if (word === 'begin' && blockName && !isMarkdownName(blockName) && isVerbatimBlock(blockName)) {
|
|
278
|
+
const endRe = new RegExp(`^\\s*=end\\s+${blockName}\\b`);
|
|
279
|
+
cx.nextLine();
|
|
280
|
+
let closed = false;
|
|
281
|
+
while (cx.line) {
|
|
282
|
+
if (endRe.test(cx.line.text)) {
|
|
283
|
+
closed = true;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
if (!cx.nextLine())
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
// the closing marker is left to be read as a directive of its own,
|
|
290
|
+
// so its keyword and block name get their colours
|
|
291
|
+
const to = closed ? cx.lineStart - 1 : cx.line ? cx.lineStart + cx.line.text.length : markerEnd;
|
|
292
|
+
// the body sits in a node of its own inside the verbatim one: a
|
|
293
|
+
// language mounted on it replaces that child, and `PodVerbatim`
|
|
294
|
+
// stays where folding and the rest of the editor look for it
|
|
295
|
+
if (to > markerEnd)
|
|
296
|
+
children.push(cx.elt('PodVerbatim', markerEnd, to, [cx.elt('PodCodeBody', markerEnd, to)]));
|
|
297
|
+
cx.addElement(cx.elt('PodDirective', start, Math.max(to, markerEnd), children));
|
|
298
|
+
if (!closed)
|
|
299
|
+
cx.nextLine();
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
cx.addElement(cx.elt('PodDirective', start, markerEnd, children));
|
|
303
|
+
cx.nextLine();
|
|
304
|
+
// the body of a markdown block is markdown; it gets a node of its own so
|
|
305
|
+
// the editor can tell from the tree that the caret stands inside one
|
|
306
|
+
const opensBody = (word === 'begin' && isMarkdownName(blockName)) || (!cont && !TAKES_A_NAME.has(word) && isMarkdownName(word));
|
|
307
|
+
if (opensBody && cx.line) {
|
|
308
|
+
cx.startComposite('PodMarkdownBody', cx.line.pos, word === 'begin' ? 1 : 0);
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
return true;
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
};
|
|
316
|
+
// the tree already knows where the caret stands, so nothing is parsed a second time
|
|
317
|
+
export const suggestionContextAt = (state, pos) => {
|
|
318
|
+
// the tree may not have reached the caret yet; give the parse a moment to get there
|
|
319
|
+
const tree = ensureSyntaxTree(state, pos, 100) || syntaxTree(state);
|
|
320
|
+
// both sides, so a caret at the very start or the very end of the body counts as inside
|
|
321
|
+
for (const side of [-1, 1])
|
|
322
|
+
for (let node = tree.resolveInner(pos, side); node; node = node.parent)
|
|
323
|
+
if (node.name === 'PodMarkdownBody')
|
|
324
|
+
return 'md';
|
|
325
|
+
return 'pod6';
|
|
326
|
+
};
|
|
327
|
+
// the same question answered on a piece of text, for callers that hold no editor state
|
|
328
|
+
export const suggestionContextForLine = (text, line) => {
|
|
329
|
+
const tree = mdParser.configure(podliteMarkdownExtension).parse(text);
|
|
330
|
+
const from = lineStartOf(text, line);
|
|
331
|
+
const nl = text.indexOf('\n', from);
|
|
332
|
+
const to = nl === -1 ? text.length : nl;
|
|
333
|
+
let found = 'pod6';
|
|
334
|
+
// the body starts past the indent, so the line is measured by overlap
|
|
335
|
+
tree.iterate({
|
|
336
|
+
enter: n => {
|
|
337
|
+
if (n.name === 'PodMarkdownBody' && n.from <= to && from < n.to)
|
|
338
|
+
found = 'md';
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
return found;
|
|
342
|
+
};
|
|
343
|
+
const lineStartOf = (text, line) => {
|
|
344
|
+
let at = 0;
|
|
345
|
+
for (let n = 1; n < line; n++) {
|
|
346
|
+
const next = text.indexOf('\n', at);
|
|
347
|
+
if (next === -1)
|
|
348
|
+
return at;
|
|
349
|
+
at = next + 1;
|
|
350
|
+
}
|
|
351
|
+
return at;
|
|
352
|
+
};
|
|
353
|
+
// the body of `=begin code :lang<js>` is read by that language, the same way a
|
|
354
|
+
// markdown fence is read by the language named after its backticks
|
|
355
|
+
export const podliteCodeLanguage = (codeLanguages) => ({
|
|
356
|
+
wrap: parseMixed((node, input) => {
|
|
357
|
+
if (node.name !== 'PodCodeBody' || !codeLanguages)
|
|
358
|
+
return null;
|
|
359
|
+
const block = node.node.parent?.parent;
|
|
360
|
+
const marker = input.read(block ? block.from : node.from, node.from);
|
|
361
|
+
const named = /:lang\s*(?:<([^>]*)>|\(\s*'([^']*)'\s*\)|"([^"]*)"|「([^」]*)」)/.exec(marker);
|
|
362
|
+
const name = ((named && (named[1] || named[2] || named[3] || named[4])) || '').trim();
|
|
363
|
+
if (!name)
|
|
364
|
+
return null;
|
|
365
|
+
const found = typeof codeLanguages === 'function'
|
|
366
|
+
? codeLanguages(name)
|
|
367
|
+
: LanguageDescription.matchLanguageName(codeLanguages, name, true);
|
|
368
|
+
if (!found)
|
|
369
|
+
return null;
|
|
370
|
+
if (found instanceof LanguageDescription)
|
|
371
|
+
// a language that has not been loaded yet parses as nothing until it is
|
|
372
|
+
return { parser: found.support ? found.support.language.parser : ParseContext.getSkippingParser(found.load()) };
|
|
373
|
+
return { parser: found.parser };
|
|
374
|
+
}),
|
|
375
|
+
});
|
|
376
|
+
// Podlite read on top of the markdown parser: the content of a markdown block
|
|
377
|
+
// and the code inside a fence get their own highlighting for free
|
|
378
|
+
// `codeLanguages` is a parameter so a test can hand in a list it loads itself
|
|
379
|
+
export const podliteTreeLang = (codeLanguages = languages) => markdown({
|
|
380
|
+
base: markdownLanguage,
|
|
381
|
+
codeLanguages,
|
|
382
|
+
extensions: [podliteMarkdownExtension, podliteCodeLanguage(codeLanguages)],
|
|
383
|
+
});
|
|
384
|
+
//# sourceMappingURL=podliteMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"podliteMarkdown.js","sourceRoot":"","sources":["../src/podliteMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACpD,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B,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QACtE,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QACvB,IAAI,KAAK,YAAY,mBAAmB;YACtC,wEAAwE;YACxE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,CAAA;QACjH,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAA;IACjC,CAAC,CAAC;CACH,CAAC,CAAA;AAEF,8EAA8E;AAC9E,kEAAkE;AAClE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,gBAAqB,SAAS,EAAa,EAAE,CAC3E,QAAQ,CAAC;IACP,IAAI,EAAE,gBAAgB;IACtB,aAAa;IACb,UAAU,EAAE,CAAC,wBAA+B,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;CAClF,CAAC,CAAA"}
|
package/esm/theme.d.ts
CHANGED
|
@@ -1 +1,102 @@
|
|
|
1
|
+
export declare const syntaxStyles: ({
|
|
2
|
+
tag: import("@lezer/highlight").Tag;
|
|
3
|
+
color: string;
|
|
4
|
+
fontWeight?: undefined;
|
|
5
|
+
fontSize?: undefined;
|
|
6
|
+
textDecoration?: undefined;
|
|
7
|
+
fontStyle?: undefined;
|
|
8
|
+
fontFamily?: undefined;
|
|
9
|
+
backgroundColor?: undefined;
|
|
10
|
+
borderRadius?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
tag: import("@lezer/highlight").Tag[];
|
|
13
|
+
color: string;
|
|
14
|
+
fontWeight?: undefined;
|
|
15
|
+
fontSize?: undefined;
|
|
16
|
+
textDecoration?: undefined;
|
|
17
|
+
fontStyle?: undefined;
|
|
18
|
+
fontFamily?: undefined;
|
|
19
|
+
backgroundColor?: undefined;
|
|
20
|
+
borderRadius?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
tag: import("@lezer/highlight").Tag;
|
|
23
|
+
color: string;
|
|
24
|
+
fontWeight: string;
|
|
25
|
+
fontSize?: undefined;
|
|
26
|
+
textDecoration?: undefined;
|
|
27
|
+
fontStyle?: undefined;
|
|
28
|
+
fontFamily?: undefined;
|
|
29
|
+
backgroundColor?: undefined;
|
|
30
|
+
borderRadius?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
tag: import("@lezer/highlight").Tag;
|
|
33
|
+
color: string;
|
|
34
|
+
fontSize: string;
|
|
35
|
+
fontWeight: string;
|
|
36
|
+
textDecoration?: undefined;
|
|
37
|
+
fontStyle?: undefined;
|
|
38
|
+
fontFamily?: undefined;
|
|
39
|
+
backgroundColor?: undefined;
|
|
40
|
+
borderRadius?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
tag: import("@lezer/highlight").Tag;
|
|
43
|
+
fontSize: string;
|
|
44
|
+
color?: undefined;
|
|
45
|
+
fontWeight?: undefined;
|
|
46
|
+
textDecoration?: undefined;
|
|
47
|
+
fontStyle?: undefined;
|
|
48
|
+
fontFamily?: undefined;
|
|
49
|
+
backgroundColor?: undefined;
|
|
50
|
+
borderRadius?: undefined;
|
|
51
|
+
} | {
|
|
52
|
+
tag: import("@lezer/highlight").Tag;
|
|
53
|
+
color: string;
|
|
54
|
+
textDecoration: string;
|
|
55
|
+
fontWeight?: undefined;
|
|
56
|
+
fontSize?: undefined;
|
|
57
|
+
fontStyle?: undefined;
|
|
58
|
+
fontFamily?: undefined;
|
|
59
|
+
backgroundColor?: undefined;
|
|
60
|
+
borderRadius?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
tag: import("@lezer/highlight").Tag;
|
|
63
|
+
fontWeight: string;
|
|
64
|
+
color?: undefined;
|
|
65
|
+
fontSize?: undefined;
|
|
66
|
+
textDecoration?: undefined;
|
|
67
|
+
fontStyle?: undefined;
|
|
68
|
+
fontFamily?: undefined;
|
|
69
|
+
backgroundColor?: undefined;
|
|
70
|
+
borderRadius?: undefined;
|
|
71
|
+
} | {
|
|
72
|
+
tag: import("@lezer/highlight").Tag;
|
|
73
|
+
fontStyle: string;
|
|
74
|
+
color?: undefined;
|
|
75
|
+
fontWeight?: undefined;
|
|
76
|
+
fontSize?: undefined;
|
|
77
|
+
textDecoration?: undefined;
|
|
78
|
+
fontFamily?: undefined;
|
|
79
|
+
backgroundColor?: undefined;
|
|
80
|
+
borderRadius?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
tag: import("@lezer/highlight").Tag;
|
|
83
|
+
fontFamily: string;
|
|
84
|
+
color: string;
|
|
85
|
+
backgroundColor: string;
|
|
86
|
+
borderRadius: string;
|
|
87
|
+
fontWeight?: undefined;
|
|
88
|
+
fontSize?: undefined;
|
|
89
|
+
textDecoration?: undefined;
|
|
90
|
+
fontStyle?: undefined;
|
|
91
|
+
} | {
|
|
92
|
+
tag: import("@lezer/highlight").Tag;
|
|
93
|
+
textDecoration: string;
|
|
94
|
+
color?: undefined;
|
|
95
|
+
fontWeight?: undefined;
|
|
96
|
+
fontSize?: undefined;
|
|
97
|
+
fontStyle?: undefined;
|
|
98
|
+
fontFamily?: undefined;
|
|
99
|
+
backgroundColor?: undefined;
|
|
100
|
+
borderRadius?: undefined;
|
|
101
|
+
})[];
|
|
1
102
|
export declare const defaultTheme: import("@codemirror/state").Extension;
|
package/esm/theme.js
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
import { createTheme } from '@uiw/codemirror-themes';
|
|
2
2
|
import { tags as t } from '@lezer/highlight';
|
|
3
|
+
// exported so a check can compare the colour of one role against another:
|
|
4
|
+
// two roles reached the same colour by different tags and nobody noticed
|
|
5
|
+
export const syntaxStyles = [
|
|
6
|
+
{ tag: t.comment, color: 'var(--color-prettylights-syntax-comment)' },
|
|
7
|
+
{ tag: t.variableName, color: 'var(--color-prettylights-syntax-variable)' },
|
|
8
|
+
{ tag: t.special(t.brace), color: 'var(--color-prettylights-syntax-entity)' },
|
|
9
|
+
{ tag: t.number, color: 'var(--color-prettylights-syntax-variable)' },
|
|
10
|
+
{ tag: [t.bool, t.null], color: 'var(--color-prettylights-syntax-entity)' },
|
|
11
|
+
{ tag: t.keyword, color: 'var(--color-prettylights-syntax-keyword)', fontWeight: 'bold' },
|
|
12
|
+
{ tag: t.string, color: 'var(--color-prettylights-syntax-string)' },
|
|
13
|
+
{ tag: t.operator, color: 'var(--color-accent-emphasis)' },
|
|
14
|
+
{ tag: t.deleted, color: 'var(--color-prettylights-syntax-markup-deleted-bg)' },
|
|
15
|
+
{ tag: t.deleted, color: 'red' },
|
|
16
|
+
{ tag: t.className, color: 'var(--color-prettylights-syntax-variable)' },
|
|
17
|
+
{ tag: t.definition(t.typeName), color: 'var(--color-prettylights-syntax-entity)' },
|
|
18
|
+
{ tag: t.typeName, color: 'var(--color-prettylights-syntax-entity)' },
|
|
19
|
+
{ tag: t.list, color: 'var(--color-prettylights-syntax-markup-list)' },
|
|
20
|
+
{ tag: t.heading, color: 'var(--color-prettylights-syntax-markup-heading)', fontSize: '105%', fontWeight: 'bold' },
|
|
21
|
+
{
|
|
22
|
+
tag: t.heading1,
|
|
23
|
+
fontSize: '150%',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
tag: t.heading2,
|
|
27
|
+
fontSize: '130%',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
tag: t.heading3,
|
|
31
|
+
fontSize: '110%',
|
|
32
|
+
},
|
|
33
|
+
{ tag: t.regexp, color: 'var(--color-prettylights-syntax-string-regexp)' },
|
|
34
|
+
{ tag: t.literal, color: 'var(--color-prettylights-syntax-markup-italic)' },
|
|
35
|
+
{
|
|
36
|
+
tag: t.link,
|
|
37
|
+
color: 'var(--color-prettylights-syntax-constant-other-reference-link)',
|
|
38
|
+
textDecoration: 'underline',
|
|
39
|
+
},
|
|
40
|
+
{ tag: t.angleBracket, color: 'var(--color-fg-default)' },
|
|
41
|
+
{ tag: t.tagName, color: 'var(--color-prettylights-syntax-entity-tag)' },
|
|
42
|
+
{ tag: t.macroName, color: 'var(--color-prettylights-syntax-entity)' },
|
|
43
|
+
{ tag: t.attributeName, color: 'var(--color-prettylights-syntax-constant)' },
|
|
44
|
+
{ tag: t.strong, fontWeight: 'bold' },
|
|
45
|
+
{ tag: t.emphasis, fontStyle: 'italic' },
|
|
46
|
+
{
|
|
47
|
+
tag: t.monospace,
|
|
48
|
+
fontFamily: 'monospace',
|
|
49
|
+
color: 'var(--color-prettylights-syntax-string)',
|
|
50
|
+
backgroundColor: 'var(--color-canvas-subtle)',
|
|
51
|
+
borderRadius: '3px',
|
|
52
|
+
},
|
|
53
|
+
{ tag: t.strikethrough, textDecoration: 'line-through' },
|
|
54
|
+
{ tag: t.constant(t.variableName), color: 'var(--color-prettylights-syntax-constant)' },
|
|
55
|
+
// the brackets of a markup code stand back from what they hold
|
|
56
|
+
{ tag: t.processingInstruction, color: 'var(--color-fg-muted)' },
|
|
57
|
+
{ tag: t.labelName, textDecoration: 'underline' },
|
|
58
|
+
{ tag: t.escape, color: 'var(--color-prettylights-syntax-constant)' },
|
|
59
|
+
// a mark left for the reader — a note, an index entry, a place above or below the line
|
|
60
|
+
{ tag: [t.meta, t.annotation], color: 'var(--color-fg-muted)' },
|
|
61
|
+
{ tag: t.url, color: 'var(--color-prettylights-syntax-string)' },
|
|
62
|
+
];
|
|
3
63
|
export const defaultTheme = createTheme({
|
|
4
64
|
theme: 'light',
|
|
5
65
|
settings: {
|
|
@@ -14,54 +74,6 @@ export const defaultTheme = createTheme({
|
|
|
14
74
|
gutterBorder: 'var(--color-border-muted)',
|
|
15
75
|
fontFamily: 'Menlo,Monaco,Consolas,Courier New,monospace',
|
|
16
76
|
},
|
|
17
|
-
styles:
|
|
18
|
-
{ tag: t.comment, color: 'var(--color-prettylights-syntax-comment)' },
|
|
19
|
-
{ tag: t.variableName, color: 'var(--color-prettylights-syntax-variable)' },
|
|
20
|
-
{ tag: [t.string, t.special(t.brace)], color: 'var(--color-prettylights-syntax-entity)' },
|
|
21
|
-
{ tag: t.number, color: 'var(--color-prettylights-syntax-variable)' },
|
|
22
|
-
{ tag: [t.bool, t.null], color: 'var(--color-prettylights-syntax-entity)' },
|
|
23
|
-
{ tag: t.keyword, color: 'var(--color-prettylights-syntax-keyword)', fontWeight: 'bold' },
|
|
24
|
-
{ tag: t.string, color: 'var(--color-prettylights-syntax-string)' },
|
|
25
|
-
{ tag: t.operator, color: 'var(--color-accent-emphasis)' },
|
|
26
|
-
{ tag: t.deleted, color: 'var(--color-prettylights-syntax-markup-deleted-bg)' },
|
|
27
|
-
{ tag: t.deleted, color: 'red' },
|
|
28
|
-
{ tag: t.className, color: 'var(--color-prettylights-syntax-variable)' },
|
|
29
|
-
{ tag: t.definition(t.typeName), color: 'var(--color-prettylights-syntax-entity)' },
|
|
30
|
-
{ tag: t.typeName, color: 'var(--color-prettylights-syntax-entity)' },
|
|
31
|
-
{ tag: t.list, color: 'var(--color-prettylights-syntax-markup-list)' },
|
|
32
|
-
{ tag: t.heading, color: 'var(--color-prettylights-syntax-markup-heading)', fontSize: '105%', fontWeight: 'bold' },
|
|
33
|
-
{
|
|
34
|
-
tag: t.heading1,
|
|
35
|
-
fontSize: '150%',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
tag: t.heading2,
|
|
39
|
-
fontSize: '130%',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
tag: t.heading3,
|
|
43
|
-
fontSize: '110%',
|
|
44
|
-
},
|
|
45
|
-
{ tag: t.regexp, color: 'var(--color-prettylights-syntax-string-regexp)' },
|
|
46
|
-
{ tag: t.literal, color: 'var(--color-prettylights-syntax-markup-italic)' },
|
|
47
|
-
{
|
|
48
|
-
tag: t.link,
|
|
49
|
-
color: 'var(--color-prettylights-syntax-constant-other-reference-link)',
|
|
50
|
-
textDecoration: 'underline',
|
|
51
|
-
},
|
|
52
|
-
{ tag: t.angleBracket, color: 'var(--color-fg-default)' },
|
|
53
|
-
{ tag: t.tagName, color: 'var(--color-prettylights-syntax-entity-tag)' },
|
|
54
|
-
{ tag: t.attributeName, color: 'var(--color-prettylights-syntax-constant)' },
|
|
55
|
-
{ tag: t.strong, fontWeight: 'bold' },
|
|
56
|
-
{ tag: t.emphasis, fontStyle: 'italic' },
|
|
57
|
-
{
|
|
58
|
-
tag: t.monospace,
|
|
59
|
-
fontFamily: 'monospace',
|
|
60
|
-
color: 'var(--color-prettylights-syntax-string)',
|
|
61
|
-
backgroundColor: 'var(--color-canvas-subtle)',
|
|
62
|
-
borderRadius: '3px',
|
|
63
|
-
},
|
|
64
|
-
{ tag: t.strikethrough, textDecoration: 'line-through' },
|
|
65
|
-
],
|
|
77
|
+
styles: syntaxStyles,
|
|
66
78
|
});
|
|
67
79
|
//# sourceMappingURL=theme.js.map
|
package/esm/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,kBAAkB,CAAA;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,kBAAkB,CAAA;AAE5C,0EAA0E;AAC1E,yEAAyE;AACzE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,0CAA0C,EAAE;IACrE,EAAE,GAAG,EAAE,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,2CAA2C,EAAE;IAC3E,EAAE,GAAG,EAAE,CAAC,CAAC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