flinker-markdown 1.1.7 → 1.1.9
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/README.md +8 -0
- package/dist/esm/md.js +6 -10
- package/dist/types/md.d.ts +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,14 @@ __FlinkerMD__ (MD) is a TypeScript library for parsing markdown text into html.
|
|
|
7
7
|
npm i flinker-markdown
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
+
## Demo
|
|
11
|
+
```cli
|
|
12
|
+
git clone https://github.com/Dittner/FlinkerMD
|
|
13
|
+
cd FlinkerMD/MarkdownDemo
|
|
14
|
+
npm install
|
|
15
|
+
npm run dev
|
|
16
|
+
```
|
|
17
|
+
|
|
10
18
|
## Example 1
|
|
11
19
|
```ts
|
|
12
20
|
import { md, MDGrammar, MDParser } from "flinker-markdown"
|
package/dist/esm/md.js
CHANGED
|
@@ -55,7 +55,7 @@ export class MDGrammar {
|
|
|
55
55
|
this.italic.matcher = [/_([^_]+)_/g, '<i>$1</i>'];
|
|
56
56
|
this.em = new MDInlineGrammarRule();
|
|
57
57
|
this.em.matcher = [/`([^`]+)`/g, '<em>$1</em>'];
|
|
58
|
-
this.em.childrenInlineRules = [this.strong, this.bold, this.italic];
|
|
58
|
+
this.em.childrenInlineRules = [this.strong, this.boldItalic, this.bold, this.italic];
|
|
59
59
|
this.code = new MDInlineGrammarRule();
|
|
60
60
|
this.code.matcher = [/``([^`]+)``/g, '<code>$1</code>'];
|
|
61
61
|
this.figure = new MDInlineGrammarRule();
|
|
@@ -82,13 +82,9 @@ export class MDGrammar {
|
|
|
82
82
|
this.quote.childrenInlineRules = this.globalRule.childrenInlineRules;
|
|
83
83
|
this.quote.preProccessing = defLinePreproccessing;
|
|
84
84
|
this.tilde = new MDLineGrammarRule();
|
|
85
|
-
this.tilde.matcher = [/^~ (.*)$/, '<p
|
|
85
|
+
this.tilde.matcher = [/^~ (.*)$/, '<p><strong>$1</strong></p>'];
|
|
86
86
|
this.tilde.childrenInlineRules = this.globalRule.childrenInlineRules;
|
|
87
87
|
this.tilde.preProccessing = defLinePreproccessing;
|
|
88
|
-
this.warn = new MDLineGrammarRule();
|
|
89
|
-
this.warn.matcher = [/^! (.*)$/, '<p class="md-warn">$1</p>'];
|
|
90
|
-
this.warn.childrenInlineRules = this.globalRule.childrenInlineRules;
|
|
91
|
-
this.warn.preProccessing = defLinePreproccessing;
|
|
92
88
|
this.alignRight = new MDLineGrammarRule();
|
|
93
89
|
this.alignRight.matcher = [/^==> (.*)$/, '<p class="md-right">$1</p>'];
|
|
94
90
|
this.alignRight.childrenInlineRules = this.globalRule.childrenInlineRules;
|
|
@@ -117,7 +113,7 @@ export class MDGrammar {
|
|
|
117
113
|
this.p.matcher = [/^(.*)$/, '<p>$1</p>'];
|
|
118
114
|
this.p.childrenInlineRules = this.globalRule.childrenInlineRules;
|
|
119
115
|
this.p.preProccessing = defLinePreproccessing;
|
|
120
|
-
this.globalRule.childrenLineRules = [this.header, this.quote, this.alignCenter, this.alignRight, this.tilde, this.
|
|
116
|
+
this.globalRule.childrenLineRules = [this.header, this.quote, this.alignCenter, this.alignRight, this.tilde, this.audio, this.video, this.stars, this.br, this.p];
|
|
121
117
|
//
|
|
122
118
|
// MULTILINE GRAMMAR RULES
|
|
123
119
|
//
|
|
@@ -125,12 +121,12 @@ export class MDGrammar {
|
|
|
125
121
|
this.ul = new MDMultilineGrammarRule();
|
|
126
122
|
this.ol.startMatcher = [/^```ol *$/, '<ol>'];
|
|
127
123
|
this.ol.endMatcher = [/^``` *$/, '</ol>'];
|
|
128
|
-
this.ol.childrenLineRules = [this.oli, this.br, this.p];
|
|
124
|
+
this.ol.childrenLineRules = [this.oli, this.tilde, this.br, this.p];
|
|
129
125
|
this.ol.childrenInlineRules = this.globalRule.childrenInlineRules;
|
|
130
126
|
this.ol.childrenMultilineRules = [this.ol, this.ul];
|
|
131
127
|
this.ul.startMatcher = [/^```ul *$/, '<ul>'];
|
|
132
128
|
this.ul.endMatcher = [/^``` *$/, '</ul>'];
|
|
133
|
-
this.ul.childrenLineRules = [this.uli, this.br, this.p];
|
|
129
|
+
this.ul.childrenLineRules = [this.uli, this.tilde, this.br, this.p];
|
|
134
130
|
this.ul.childrenInlineRules = this.globalRule.childrenInlineRules;
|
|
135
131
|
this.ul.childrenMultilineRules = [this.ol, this.ul];
|
|
136
132
|
this.table = new MDMultilineGrammarRule();
|
|
@@ -147,7 +143,7 @@ export class MDGrammar {
|
|
|
147
143
|
this.div.startMatcher = [/^```([a-zA-Z]+) */, '<div class="$1"><div>'];
|
|
148
144
|
this.div.endMatcher = [/^``` *$/, '</div></div>'];
|
|
149
145
|
this.div.childrenInlineRules = this.globalRule.childrenInlineRules;
|
|
150
|
-
this.div.childrenLineRules = [this.quote, this.alignCenter, this.alignRight, this.br, this.p];
|
|
146
|
+
this.div.childrenLineRules = [this.quote, this.alignCenter, this.alignRight, this.tilde, this.br, this.p];
|
|
151
147
|
this.div.childrenMultilineRules = [this.div];
|
|
152
148
|
this.globalRule.childrenMultilineRules = [this.ol, this.ul, this.table, this.div];
|
|
153
149
|
}
|
package/dist/types/md.d.ts
CHANGED
|
@@ -39,7 +39,6 @@ export declare class MDGrammar {
|
|
|
39
39
|
readonly quote: MDLineGrammarRule;
|
|
40
40
|
readonly alignRight: MDLineGrammarRule;
|
|
41
41
|
readonly tilde: MDLineGrammarRule;
|
|
42
|
-
readonly warn: MDLineGrammarRule;
|
|
43
42
|
readonly alignCenter: MDLineGrammarRule;
|
|
44
43
|
readonly stars: MDLineGrammarRule;
|
|
45
44
|
readonly p: MDLineGrammarRule;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flinker-markdown",
|
|
3
3
|
"description": "Free TypeScript library for parsing markdown text (customisable, not standardized).",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.9",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/Dittner/FlinkerMD.git"
|