marked 7.0.0 → 7.0.2
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/lib/marked.cjs +2541 -2180
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.d.ts +692 -591
- package/lib/marked.esm.js +2522 -2136
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +2566 -2179
- package/lib/marked.umd.js.map +1 -1
- package/marked.min.js +3 -3
- package/package.json +14 -13
- package/lib/marked.d.cts +0 -624
- package/src/Hooks.ts +0 -29
- package/src/Instance.ts +0 -381
- package/src/Lexer.ts +0 -517
- package/src/MarkedOptions.ts +0 -212
- package/src/Parser.ts +0 -291
- package/src/Renderer.ts +0 -167
- package/src/Slugger.ts +0 -51
- package/src/TextRenderer.ts +0 -42
- package/src/Tokenizer.ts +0 -810
- package/src/Tokens.ts +0 -199
- package/src/defaults.ts +0 -35
- package/src/helpers.ts +0 -264
- package/src/marked.ts +0 -144
- package/src/rules.ts +0 -380
package/src/Slugger.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { SluggerOptions } from './MarkedOptions.ts';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Slugger generates header id
|
|
5
|
-
*/
|
|
6
|
-
export class _Slugger {
|
|
7
|
-
seen: { [slugValue: string]: number };
|
|
8
|
-
|
|
9
|
-
constructor() {
|
|
10
|
-
this.seen = {};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
serialize(value: string) {
|
|
14
|
-
return value
|
|
15
|
-
.toLowerCase()
|
|
16
|
-
.trim()
|
|
17
|
-
// remove html tags
|
|
18
|
-
.replace(/<[!\/a-z].*?>/ig, '')
|
|
19
|
-
// remove unwanted chars
|
|
20
|
-
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
|
|
21
|
-
.replace(/\s/g, '-');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Finds the next safe (unique) slug to use
|
|
26
|
-
*/
|
|
27
|
-
getNextSafeSlug(originalSlug: string, isDryRun: boolean | undefined) {
|
|
28
|
-
let slug = originalSlug;
|
|
29
|
-
let occurenceAccumulator = 0;
|
|
30
|
-
if (this.seen.hasOwnProperty(slug)) {
|
|
31
|
-
occurenceAccumulator = this.seen[originalSlug];
|
|
32
|
-
do {
|
|
33
|
-
occurenceAccumulator++;
|
|
34
|
-
slug = originalSlug + '-' + occurenceAccumulator;
|
|
35
|
-
} while (this.seen.hasOwnProperty(slug));
|
|
36
|
-
}
|
|
37
|
-
if (!isDryRun) {
|
|
38
|
-
this.seen[originalSlug] = occurenceAccumulator;
|
|
39
|
-
this.seen[slug] = 0;
|
|
40
|
-
}
|
|
41
|
-
return slug;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Convert string to unique id
|
|
46
|
-
*/
|
|
47
|
-
slug(value: string, options: SluggerOptions = {}) {
|
|
48
|
-
const slug = this.serialize(value);
|
|
49
|
-
return this.getNextSafeSlug(slug, options.dryrun);
|
|
50
|
-
}
|
|
51
|
-
}
|
package/src/TextRenderer.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TextRenderer
|
|
3
|
-
* returns only the textual part of the token
|
|
4
|
-
*/
|
|
5
|
-
export class _TextRenderer {
|
|
6
|
-
// no need for block level renderers
|
|
7
|
-
strong(text: string) {
|
|
8
|
-
return text;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
em(text: string) {
|
|
12
|
-
return text;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
codespan(text: string) {
|
|
16
|
-
return text;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
del(text: string) {
|
|
20
|
-
return text;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
html(text: string) {
|
|
24
|
-
return text;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
text(text: string) {
|
|
28
|
-
return text;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
link(href: string, title: string | null | undefined, text: string) {
|
|
32
|
-
return '' + text;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
image(href: string, title: string | null, text: string) {
|
|
36
|
-
return '' + text;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
br() {
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
}
|