highmark-markdown 1.1.138 → 1.2.4
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/example.js +789 -671
- package/lib/markdown/bnf.js +2 -2
- package/lib/mixins/token.js +51 -0
- package/lib/node/html/heading/index.js +13 -2
- package/lib/node/html/image.js +8 -1
- package/lib/node/html/item/index.js +12 -1
- package/lib/node/html/line/block.js +2 -2
- package/lib/node/html/line.js +39 -33
- package/lib/node/html/link/email.js +9 -2
- package/lib/node/html/link/footnote.js +8 -15
- package/lib/node/html/link/hyper.js +9 -2
- package/lib/node/html/link/index.js +9 -2
- package/lib/node/html/listing/inline.js +8 -11
- package/lib/node/html/pageNumber.js +13 -2
- package/lib/node/html/text/comma.js +2 -2
- package/lib/node/html/text/emphasised.js +10 -2
- package/lib/node/html/text/index.js +2 -2
- package/lib/node/html/text/inline.js +1 -33
- package/lib/node/html/text/strong.js +10 -2
- package/lib/node/html/text/stronglyEmphasised.js +9 -2
- package/lib/node/html.js +7 -7
- package/lib/node/markdown/text.js +20 -5
- package/lib/node/markdown.js +3 -1
- package/lib/node/markdownStyle/content.js +2 -2
- package/lib/node/markdownStyle.js +3 -1
- package/lib/style/defaultMarkdown.js +2 -2
- package/lib/utilities/grammar.js +2 -2
- package/package.json +1 -1
- package/src/markdown/bnf.js +3 -3
- package/src/mixins/token.js +67 -0
- package/src/node/html/heading/index.js +17 -2
- package/src/node/html/image.js +6 -0
- package/src/node/html/item/index.js +16 -0
- package/src/node/html/line/block.js +1 -1
- package/src/node/html/line.js +38 -27
- package/src/node/html/link/email.js +7 -2
- package/src/node/html/link/footnote.js +6 -19
- package/src/node/html/link/hyper.js +7 -2
- package/src/node/html/link/index.js +7 -2
- package/src/node/html/listing/inline.js +6 -15
- package/src/node/html/pageNumber.js +17 -2
- package/src/node/html/text/comma.js +1 -1
- package/src/node/html/text/emphasised.js +6 -0
- package/src/node/html/text/index.js +1 -2
- package/src/node/html/text/inline.js +0 -11
- package/src/node/html/text/strong.js +6 -0
- package/src/node/html/text/stronglyEmphasised.js +7 -3
- package/src/node/html.js +11 -10
- package/src/node/markdown/text.js +32 -6
- package/src/node/markdown.js +2 -0
- package/src/node/markdownStyle/content.js +5 -6
- package/src/node/markdownStyle.js +3 -0
- package/src/style/defaultMarkdown.js +1 -0
- package/src/utilities/grammar.js +1 -3
package/src/node/html/line.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import HTMLNode from "../../node/html";
|
|
4
|
-
import PlainTextHTMLNode from "./text/plain";
|
|
5
4
|
|
|
6
5
|
import { remove, insertAfterwards } from "../../utilities/dom";
|
|
7
6
|
import { EMPTY_STRING, CARRIAGE_RETURN, DEFAULT_MAXIMUM_LINE_CHARACTERS } from "../../constants";
|
|
@@ -17,9 +16,25 @@ export default class LineHTMLNode extends HTMLNode {
|
|
|
17
16
|
return lines;
|
|
18
17
|
}
|
|
19
18
|
|
|
19
|
+
prepare(context) {
|
|
20
|
+
const markdownNode = this.getMarkdownNode(),
|
|
21
|
+
firstTokenIndex = markdownNode.getFirstTokenIndex(context),
|
|
22
|
+
tokenIndex = firstTokenIndex; ///
|
|
23
|
+
|
|
24
|
+
Object.assign(context, {
|
|
25
|
+
tokenIndex
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
dispose(context) {
|
|
30
|
+
delete context.tokenIndex;
|
|
31
|
+
}
|
|
32
|
+
|
|
20
33
|
mount(parentDOMElement, siblingDOMElement, context) {
|
|
21
34
|
let domElement;
|
|
22
35
|
|
|
36
|
+
this.prepare(context);
|
|
37
|
+
|
|
23
38
|
super.mount(parentDOMElement, siblingDOMElement, context);
|
|
24
39
|
|
|
25
40
|
domElement = this.getDOMElement();
|
|
@@ -27,7 +42,7 @@ export default class LineHTMLNode extends HTMLNode {
|
|
|
27
42
|
parentDOMElement = domElement; ///
|
|
28
43
|
|
|
29
44
|
const content = CARRIAGE_RETURN,
|
|
30
|
-
|
|
45
|
+
textNode = document.createTextNode(content);
|
|
31
46
|
|
|
32
47
|
domElement = textNode; ///
|
|
33
48
|
|
|
@@ -37,6 +52,8 @@ export default class LineHTMLNode extends HTMLNode {
|
|
|
37
52
|
|
|
38
53
|
siblingDOMElement = domElement; ///
|
|
39
54
|
|
|
55
|
+
this.dispose(context);
|
|
56
|
+
|
|
40
57
|
return siblingDOMElement;
|
|
41
58
|
}
|
|
42
59
|
|
|
@@ -57,46 +74,40 @@ export default class LineHTMLNode extends HTMLNode {
|
|
|
57
74
|
super.unmount(parentDOMElement);
|
|
58
75
|
}
|
|
59
76
|
|
|
60
|
-
|
|
61
|
-
let
|
|
77
|
+
asHTML(indent, context) {
|
|
78
|
+
let html;
|
|
62
79
|
|
|
63
|
-
|
|
80
|
+
this.prepare(context);
|
|
64
81
|
|
|
65
|
-
|
|
66
|
-
const previousChildNodePlainTextHTMLNode = (previousChildNode instanceof PlainTextHTMLNode);
|
|
82
|
+
indent = this.adjustIndent(indent);
|
|
67
83
|
|
|
68
|
-
|
|
69
|
-
const childNodePlainTextHTMLNode = (childNode instanceof PlainTextHTMLNode);
|
|
84
|
+
const childNodesHTML = this.childNodesAsHTML(indent, context);
|
|
70
85
|
|
|
71
|
-
|
|
72
|
-
|
|
86
|
+
const startingTag = this.startingTag(context),
|
|
87
|
+
closingTag = this.closingTag(context);
|
|
88
|
+
|
|
89
|
+
html = `${indent}${startingTag}${childNodesHTML}${closingTag}
|
|
73
90
|
`;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
91
|
|
|
77
|
-
|
|
92
|
+
this.dispose(context);
|
|
78
93
|
|
|
79
|
-
|
|
94
|
+
return html;
|
|
95
|
+
}
|
|
80
96
|
|
|
81
|
-
|
|
97
|
+
asPlainText(context) {
|
|
98
|
+
let plainText;
|
|
82
99
|
|
|
83
|
-
|
|
84
|
-
}, EMPTY_STRING);
|
|
100
|
+
this.prepare(context);
|
|
85
101
|
|
|
86
|
-
|
|
102
|
+
plainText = super.asPlainText(context);
|
|
87
103
|
|
|
88
|
-
|
|
89
|
-
childNodesHTML = `${childNodesHTML}
|
|
90
|
-
`;
|
|
91
|
-
}
|
|
104
|
+
this.dispose(context);
|
|
92
105
|
|
|
93
|
-
return
|
|
106
|
+
return plainText;
|
|
94
107
|
}
|
|
95
108
|
|
|
96
109
|
childNodesAsPlainText(context) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
childNodesPlainText = this.reduceChildNode((childNodesPlainText, childNode) => {
|
|
110
|
+
const childNodesPlainText = this.reduceChildNode((childNodesPlainText, childNode) => {
|
|
100
111
|
const childNodePlainText = childNode.asPlainText(context);
|
|
101
112
|
|
|
102
113
|
childNodesPlainText = `${childNodesPlainText}${childNodePlainText}`;
|
|
@@ -40,6 +40,12 @@ export default class EmailLinkHTMLNode extends HTMLNode {
|
|
|
40
40
|
return attributeValue;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
adjustIndent(indent) {
|
|
44
|
+
indent = null;
|
|
45
|
+
|
|
46
|
+
return indent;
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
mount(parentDOMElement, siblingDOMElement, context) {
|
|
44
50
|
let domElement;
|
|
45
51
|
|
|
@@ -126,8 +132,7 @@ export default class EmailLinkHTMLNode extends HTMLNode {
|
|
|
126
132
|
if (simple) {
|
|
127
133
|
const emailAddress = this.emailAddress(context);
|
|
128
134
|
|
|
129
|
-
childNodesHTML = `${emailAddress}
|
|
130
|
-
`;
|
|
135
|
+
childNodesHTML = `${emailAddress}`;
|
|
131
136
|
} else {
|
|
132
137
|
childNodesHTML = super.childNodesAsHTML(indent, context);
|
|
133
138
|
}
|
|
@@ -53,6 +53,12 @@ export default class FootnoteLinkHTMLNode extends HTMLNode {
|
|
|
53
53
|
return attributeValue;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
adjustIndent(indent) {
|
|
57
|
+
indent = null;
|
|
58
|
+
|
|
59
|
+
return indent;
|
|
60
|
+
}
|
|
61
|
+
|
|
56
62
|
mount(parentDOMElement, siblingDOMElement, context) {
|
|
57
63
|
const domElement = this.createDOMElement(context);
|
|
58
64
|
|
|
@@ -79,25 +85,6 @@ export default class FootnoteLinkHTMLNode extends HTMLNode {
|
|
|
79
85
|
this.resetDOMElement();
|
|
80
86
|
}
|
|
81
87
|
|
|
82
|
-
asHTML(indent, context) {
|
|
83
|
-
let html;
|
|
84
|
-
|
|
85
|
-
if (this.number === null) {
|
|
86
|
-
html = EMPTY_STRING;
|
|
87
|
-
} else {
|
|
88
|
-
indent = this.adjustIndent(indent);
|
|
89
|
-
|
|
90
|
-
const childNodesHTML = this.childNodesAsHTML(indent, context),
|
|
91
|
-
startingTag = this.startingTag(context),
|
|
92
|
-
closingTag = this.closingTag(context);
|
|
93
|
-
|
|
94
|
-
html = `${indent}${startingTag}${childNodesHTML}${closingTag}
|
|
95
|
-
`;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return html;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
88
|
asPlainText(context) {
|
|
102
89
|
const plainText = EMPTY_STRING;
|
|
103
90
|
|
|
@@ -40,6 +40,12 @@ export default class HyperlinkHTMLNode extends HTMLNode {
|
|
|
40
40
|
return attributeValue;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
adjustIndent(indent) {
|
|
44
|
+
indent = null;
|
|
45
|
+
|
|
46
|
+
return indent;
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
mount(parentDOMElement, siblingDOMElement, context) {
|
|
44
50
|
let domElement;
|
|
45
51
|
|
|
@@ -126,8 +132,7 @@ export default class HyperlinkHTMLNode extends HTMLNode {
|
|
|
126
132
|
if (simple) {
|
|
127
133
|
const url = this.url(context);
|
|
128
134
|
|
|
129
|
-
childNodesHTML = `${url}
|
|
130
|
-
`;
|
|
135
|
+
childNodesHTML = `${url}`;
|
|
131
136
|
} else {
|
|
132
137
|
childNodesHTML = super.childNodesAsHTML(indent, context);
|
|
133
138
|
}
|
|
@@ -78,6 +78,12 @@ export default class IndexLinkHTMLNode extends HTMLNode {
|
|
|
78
78
|
super.unmount(parentDOMElement);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
adjustIndent(indent) {
|
|
82
|
+
indent = null;
|
|
83
|
+
|
|
84
|
+
return indent;
|
|
85
|
+
}
|
|
86
|
+
|
|
81
87
|
asPlainText(context) {
|
|
82
88
|
const plainText = EMPTY_STRING;
|
|
83
89
|
|
|
@@ -85,8 +91,7 @@ export default class IndexLinkHTMLNode extends HTMLNode {
|
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
childNodesAsHTML(indent, context) {
|
|
88
|
-
const childNodesHTML =
|
|
89
|
-
`;
|
|
94
|
+
const childNodesHTML = this.pageNumber; ///
|
|
90
95
|
|
|
91
96
|
return childNodesHTML;
|
|
92
97
|
}
|
|
@@ -12,6 +12,12 @@ export default class InlineListingHTMLNode extends HTMLNode {
|
|
|
12
12
|
return content;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
adjustIndent(indent) {
|
|
16
|
+
indent = null;
|
|
17
|
+
|
|
18
|
+
return indent;
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
createDOMElement(context) {
|
|
16
22
|
let domElement;
|
|
17
23
|
|
|
@@ -31,21 +37,6 @@ export default class InlineListingHTMLNode extends HTMLNode {
|
|
|
31
37
|
return domElement;
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
asHTML(indent, context) {
|
|
35
|
-
let html;
|
|
36
|
-
|
|
37
|
-
indent = this.adjustIndent(indent);
|
|
38
|
-
|
|
39
|
-
const childNodesHTML = this.childNodesAsHTML(indent, context),
|
|
40
|
-
startingTag = this.startingTag(context),
|
|
41
|
-
closingTag = this.closingTag(context);
|
|
42
|
-
|
|
43
|
-
html = `${indent}${startingTag}${childNodesHTML}${closingTag}
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
return html;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
40
|
childNodesAsHTML(indent, context) {
|
|
50
41
|
const content = this.content(context),
|
|
51
42
|
childNodesHTML = content; ///
|
|
@@ -63,6 +63,22 @@ export default class PageNumberHTMLNode extends HTMLNode {
|
|
|
63
63
|
super.unmount(parentDOMElement);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
asHTML(indent, context) {
|
|
67
|
+
let html;
|
|
68
|
+
|
|
69
|
+
indent = this.adjustIndent(indent);
|
|
70
|
+
|
|
71
|
+
const childNodesHTML = this.childNodesAsHTML(indent, context);
|
|
72
|
+
|
|
73
|
+
const startingTag = this.startingTag(context),
|
|
74
|
+
closingTag = this.closingTag(context);
|
|
75
|
+
|
|
76
|
+
html = `${indent}${startingTag}${childNodesHTML}${closingTag}
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
return html;
|
|
80
|
+
}
|
|
81
|
+
|
|
66
82
|
asPlainText(context) {
|
|
67
83
|
const plainText = EMPTY_STRING;
|
|
68
84
|
|
|
@@ -70,8 +86,7 @@ export default class PageNumberHTMLNode extends HTMLNode {
|
|
|
70
86
|
}
|
|
71
87
|
|
|
72
88
|
childNodesAsHTML(indent, context) {
|
|
73
|
-
const childNodesHTML =
|
|
74
|
-
`;
|
|
89
|
+
const childNodesHTML = this.pageNumber; ///
|
|
75
90
|
|
|
76
91
|
return childNodesHTML;
|
|
77
92
|
}
|
|
@@ -26,17 +26,6 @@ export default class InlineTextHTMLNode extends HTMLNode {
|
|
|
26
26
|
return html;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
childNodesAsHTML(indent, context) {
|
|
30
|
-
let childNodesHTML;
|
|
31
|
-
|
|
32
|
-
childNodesHTML = super.childNodesAsHTML(indent, context);
|
|
33
|
-
|
|
34
|
-
childNodesHTML = `${childNodesHTML}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
return childNodesHTML;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
29
|
childNodesAsPlainText(context) {
|
|
41
30
|
const childNodesPlainText = this.reduceChildNode((childNodesPlainText, childNode) => {
|
|
42
31
|
const childNodePlainText = childNode.asPlainText(context);
|
|
@@ -29,6 +29,12 @@ export default class StronglyEmphasisedTextHTMLNode extends HTMLNode {
|
|
|
29
29
|
return domElement;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
adjustIndent(indent) {
|
|
33
|
+
indent = null;
|
|
34
|
+
|
|
35
|
+
return indent;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
mount(parentDOMElement, siblingDOMElement, context) {
|
|
33
39
|
let domElement;
|
|
34
40
|
|
|
@@ -85,9 +91,7 @@ export default class StronglyEmphasisedTextHTMLNode extends HTMLNode {
|
|
|
85
91
|
|
|
86
92
|
const startingTag = `<${strongTextTagName}>`,
|
|
87
93
|
closingTag = `</${strongTextTagName}>`,
|
|
88
|
-
html = `${
|
|
89
|
-
${childNodesHTML}${indent}${closingTag}
|
|
90
|
-
`;
|
|
94
|
+
html = `${startingTag}${childNodesHTML}${closingTag}`;
|
|
91
95
|
|
|
92
96
|
childNodesHTML = html; ///
|
|
93
97
|
|
package/src/node/html.js
CHANGED
|
@@ -152,9 +152,9 @@ class HTMLNode extends Node {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
adjustIndent(indent) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
if (indent !== null) {
|
|
156
|
+
indent = `${DOUBLE_SPACE}${indent}`;
|
|
157
|
+
}
|
|
158
158
|
|
|
159
159
|
return indent;
|
|
160
160
|
}
|
|
@@ -321,13 +321,17 @@ class HTMLNode extends Node {
|
|
|
321
321
|
const startingTag = this.startingTag(context),
|
|
322
322
|
closingTag = this.closingTag(context);
|
|
323
323
|
|
|
324
|
-
html =
|
|
324
|
+
html = (indent === null) ?
|
|
325
|
+
`${startingTag}${childNodesHTML}${closingTag}` :
|
|
326
|
+
`${indent}${startingTag}
|
|
325
327
|
${childNodesHTML}${indent}${closingTag}
|
|
326
328
|
`;
|
|
327
329
|
} else {
|
|
328
330
|
const selfClosingTag = this.selfClosingTag(context);
|
|
329
331
|
|
|
330
|
-
html =
|
|
332
|
+
html = (indent === null) ?
|
|
333
|
+
`${selfClosingTag}` :
|
|
334
|
+
`${indent}${selfClosingTag}
|
|
331
335
|
`;
|
|
332
336
|
}
|
|
333
337
|
|
|
@@ -335,11 +339,8 @@ ${childNodesHTML}${indent}${closingTag}
|
|
|
335
339
|
}
|
|
336
340
|
|
|
337
341
|
asPlainText(context) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
const childNodesPlainText = this.childNodesAsPlainText(context);
|
|
341
|
-
|
|
342
|
-
plainText = childNodesPlainText; ///
|
|
342
|
+
const childNodesPlainText = this.childNodesAsPlainText(context),
|
|
343
|
+
plainText = childNodesPlainText; ///
|
|
343
344
|
|
|
344
345
|
return plainText;
|
|
345
346
|
}
|
|
@@ -22,25 +22,51 @@ export default class TextMarkdownNode extends MarkdownNode {
|
|
|
22
22
|
text = text.substring(start);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
let { tokenIndex } = context;
|
|
26
|
+
|
|
25
27
|
const { tokens } = context,
|
|
28
|
+
tokensLength = tokens.length,
|
|
29
|
+
minimumTokenIndex = 0,
|
|
30
|
+
maximumTokenIndex = tokensLength - 1,
|
|
26
31
|
significantTokenIndex = tokens.indexOf(significantToken),
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
previousTokenIndex = significantTokenIndex - 1,
|
|
33
|
+
nextTokenIndex = significantTokenIndex + 1,
|
|
34
|
+
lastTokenIndex = tokenIndex; ///
|
|
35
|
+
|
|
36
|
+
for (tokenIndex = previousTokenIndex; tokenIndex >= minimumTokenIndex; tokenIndex--) {
|
|
37
|
+
if (tokenIndex === lastTokenIndex) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
29
40
|
|
|
30
|
-
|
|
31
|
-
const token = tokens[index],
|
|
41
|
+
const token = tokens[tokenIndex],
|
|
32
42
|
tokenWhitespaceToken = token.isWhitespaceToken();
|
|
33
43
|
|
|
34
44
|
if (!tokenWhitespaceToken) {
|
|
35
45
|
break;
|
|
36
46
|
}
|
|
37
47
|
|
|
38
|
-
const
|
|
39
|
-
whitespaceTokenContent = whitespaceToken.getContent();
|
|
48
|
+
const whitespaceTokenContent = token.getContent();
|
|
40
49
|
|
|
41
50
|
text = `${whitespaceTokenContent}${text}`;
|
|
42
51
|
}
|
|
43
52
|
|
|
53
|
+
for (tokenIndex = nextTokenIndex; tokenIndex <= maximumTokenIndex; tokenIndex++) {
|
|
54
|
+
const token = tokens[tokenIndex],
|
|
55
|
+
tokenWhitespaceToken = token.isWhitespaceToken();
|
|
56
|
+
|
|
57
|
+
if (!tokenWhitespaceToken) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const whitespaceTokenContent = token.getContent();
|
|
62
|
+
|
|
63
|
+
text = `${text}${whitespaceTokenContent}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Object.assign(context, {
|
|
67
|
+
tokenIndex
|
|
68
|
+
});
|
|
69
|
+
|
|
44
70
|
return text;
|
|
45
71
|
});
|
|
46
72
|
|
package/src/node/markdown.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { NonTerminalNode } from "occam-parsers";
|
|
4
4
|
|
|
5
5
|
import nodeMixins from "../mixins/node";
|
|
6
|
+
import tokenMixins from "../mixins/token";
|
|
6
7
|
|
|
7
8
|
class MarkdownNode extends NonTerminalNode {
|
|
8
9
|
getParentMarkdownNode() {
|
|
@@ -54,5 +55,6 @@ class MarkdownNode extends NonTerminalNode {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
Object.assign(MarkdownNode.prototype, nodeMixins);
|
|
58
|
+
Object.assign(MarkdownNode.prototype, tokenMixins);
|
|
57
59
|
|
|
58
60
|
export default MarkdownNode;
|
|
@@ -7,13 +7,12 @@ import { EMPTY_STRING, CARRIAGE_RETURN } from "../../constants";
|
|
|
7
7
|
|
|
8
8
|
export default class ContentMarkdownStyleNode extends MarkdownStyleNode {
|
|
9
9
|
content(context) {
|
|
10
|
-
|
|
10
|
+
const firstTokenIndex = this.getFirstTokenIndex(context),
|
|
11
|
+
lastTokenIndex = this.getLastTokenIndex(context),
|
|
12
|
+
start = firstTokenIndex, ///
|
|
13
|
+
end = lastTokenIndex + 1;
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
firstSignificantTokenIndex = nonTerminalNode.getFirstSignificantTokenIndex(tokens),
|
|
14
|
-
lastSignificantTokenIndex = nonTerminalNode.getLastSignificantTokenIndex(tokens),
|
|
15
|
-
start = firstSignificantTokenIndex,
|
|
16
|
-
end = lastSignificantTokenIndex + 1;
|
|
15
|
+
let { tokens } = context;
|
|
17
16
|
|
|
18
17
|
tokens = tokens.slice(start, end);
|
|
19
18
|
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
import { NonTerminalNode } from "occam-parsers";
|
|
4
4
|
|
|
5
5
|
import nodeMixins from "../mixins/node";
|
|
6
|
+
import tokenMixins from "../mixins/token";
|
|
6
7
|
|
|
7
8
|
class MarkdownStyleNode extends NonTerminalNode {
|
|
9
|
+
|
|
8
10
|
static fromRuleNameChildNodesOpacityAndPrecedence(Class, ruleName, childNodes, opacity, precedence, ...remainingArguments) {
|
|
9
11
|
if (precedence === undefined) {
|
|
10
12
|
precedence = opacity; ///
|
|
@@ -25,5 +27,6 @@ class MarkdownStyleNode extends NonTerminalNode {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
Object.assign(MarkdownStyleNode.prototype, nodeMixins);
|
|
30
|
+
Object.assign(MarkdownStyleNode.prototype, tokenMixins);
|
|
28
31
|
|
|
29
32
|
export default MarkdownStyleNode;
|
package/src/utilities/grammar.js
CHANGED
|
@@ -132,9 +132,7 @@ export function htmlFromMarkdownOptionsAndImporter(markdown, options, importer)
|
|
|
132
132
|
divisionHTMLNOdes.forEach((divisionHTMLNOde) => {
|
|
133
133
|
const divisionHTMLNOdeHTML = divisionHTMLNOde.asHTML(context);
|
|
134
134
|
|
|
135
|
-
html = `${html}
|
|
136
|
-
|
|
137
|
-
${divisionHTMLNOdeHTML}`;
|
|
135
|
+
html = `${html}${divisionHTMLNOdeHTML}`;
|
|
138
136
|
});
|
|
139
137
|
}
|
|
140
138
|
}
|