svelte-streamdown 2.4.2 → 2.4.3
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/dist/marked/index.js +2 -2
- package/dist/marked/marked-dl.d.ts +0 -1
- package/dist/marked/marked-dl.js +29 -30
- package/package.json +1 -1
package/dist/marked/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { markedList } from './marked-list.js';
|
|
|
7
7
|
import { markedBr } from './marked-br.js';
|
|
8
8
|
import { markedHr } from './marked-hr.js';
|
|
9
9
|
import { markedTable } from './marked-table.js';
|
|
10
|
-
import { markedDl
|
|
10
|
+
import { markedDl } from './marked-dl.js';
|
|
11
11
|
const parseExtensions = (...extensions) => {
|
|
12
12
|
const options = {
|
|
13
13
|
gfm: true,
|
|
@@ -41,7 +41,7 @@ const parseExtensions = (...extensions) => {
|
|
|
41
41
|
return options;
|
|
42
42
|
};
|
|
43
43
|
export const lex = (markdown, extensions = []) => {
|
|
44
|
-
return new Lexer(parseExtensions(markedHr, markedTable, ...markedFootnote(), markedAlert, ...markedMath, markedSub, markedSup, markedList, markedBr, markedDl,
|
|
44
|
+
return new Lexer(parseExtensions(markedHr, markedTable, ...markedFootnote(), markedAlert, ...markedMath, markedSub, markedSup, markedList, markedBr, markedDl, ...extensions))
|
|
45
45
|
.lex(markdown)
|
|
46
46
|
.filter((token) => token.type !== 'space' && token.type !== 'footnote');
|
|
47
47
|
};
|
package/dist/marked/marked-dl.js
CHANGED
|
@@ -5,41 +5,40 @@ export const markedDl = {
|
|
|
5
5
|
const rule = /^(?:[ \t]*:[^:\n]+:[ \t]?[^\n]*(?:\n|$))+/;
|
|
6
6
|
const match = rule.exec(src);
|
|
7
7
|
if (match) {
|
|
8
|
+
const text = match[0].trim();
|
|
9
|
+
const tokens = [];
|
|
10
|
+
// Parse each line as a description
|
|
11
|
+
const lines = text.split('\n');
|
|
12
|
+
for (const line of lines) {
|
|
13
|
+
const lineMatch = /^\s*:([^:\n]+):([^:\n]*)(?:\n|$)/.exec(line);
|
|
14
|
+
if (lineMatch) {
|
|
15
|
+
const term = lineMatch[1].trim();
|
|
16
|
+
const detail = lineMatch[2].trim();
|
|
17
|
+
tokens.push({
|
|
18
|
+
type: 'description',
|
|
19
|
+
raw: lineMatch[0],
|
|
20
|
+
tokens: [
|
|
21
|
+
{
|
|
22
|
+
type: 'descriptionTerm',
|
|
23
|
+
raw: term,
|
|
24
|
+
tokens: this.lexer.inlineTokens(term)
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'descriptionDetail',
|
|
28
|
+
raw: detail,
|
|
29
|
+
tokens: this.lexer.inlineTokens(detail)
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
8
35
|
const token = {
|
|
9
36
|
type: 'descriptionList',
|
|
10
37
|
raw: match[0],
|
|
11
|
-
text:
|
|
12
|
-
tokens:
|
|
38
|
+
text: text,
|
|
39
|
+
tokens: tokens
|
|
13
40
|
};
|
|
14
41
|
return token;
|
|
15
42
|
}
|
|
16
43
|
}
|
|
17
44
|
};
|
|
18
|
-
export const markedDt = {
|
|
19
|
-
name: 'description',
|
|
20
|
-
level: 'inline',
|
|
21
|
-
tokenizer(src) {
|
|
22
|
-
const rule = /^\s*:([^:\n]+):([^:\n]*)(?:\n|$)/;
|
|
23
|
-
const match = rule.exec(src);
|
|
24
|
-
if (match) {
|
|
25
|
-
const term = match[1].trim();
|
|
26
|
-
const detail = match[2].trim();
|
|
27
|
-
return {
|
|
28
|
-
type: 'description',
|
|
29
|
-
raw: match[0],
|
|
30
|
-
tokens: [
|
|
31
|
-
{
|
|
32
|
-
type: 'descriptionTerm',
|
|
33
|
-
raw: term,
|
|
34
|
-
tokens: this.lexer.inlineTokens(term)
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
type: 'descriptionDetail',
|
|
38
|
-
raw: detail,
|
|
39
|
-
tokens: this.lexer.inlineTokens(detail)
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|