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