highmark-markdown 0.0.72 → 0.0.73
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 +691 -411
- package/lib/example/constants.js +5 -1
- package/lib/example/view/div/preview.js +225 -0
- package/lib/example/view/div/sizeable/right.js +2 -2
- package/lib/example/view.js +11 -6
- package/lib/node/markdown/anchor.js +2 -2
- package/lib/node/markdown/footnoteItem.js +2 -2
- package/lib/node/markdown/footnotesList.js +10 -7
- package/lib/node/markdown/line.js +6 -8
- package/lib/node/markdown/link.js +22 -6
- package/lib/node/markdown/markedText.js +21 -2
- package/lib/node/markdown/stronglyEmphasisedText.js +2 -3
- package/lib/node/markdown/tableCell.js +6 -7
- package/lib/node/markdown.js +26 -26
- package/package.json +1 -1
- package/src/example/constants.js +2 -0
- package/src/example/view/div/preview.js +49 -0
- package/src/example/view/div/sizeable/right.js +1 -1
- package/src/example/view.js +19 -8
- package/src/node/markdown/anchor.js +1 -1
- package/src/node/markdown/footnoteItem.js +1 -1
- package/src/node/markdown/footnotesList.js +11 -7
- package/src/node/markdown/line.js +11 -7
- package/src/node/markdown/link.js +30 -5
- package/src/node/markdown/markedText.js +22 -0
- package/src/node/markdown/stronglyEmphasisedText.js +1 -3
- package/src/node/markdown/tableCell.js +11 -10
- package/src/node/markdown.js +42 -41
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
3
5
|
import MarkdownNode from "../../node/markdown";
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
const { first } = arrayUtilities;
|
|
6
8
|
|
|
7
9
|
export default class TableCellMarkdownNode extends MarkdownNode {
|
|
8
10
|
childNodesAsHTML(indent, context) {
|
|
9
11
|
const childNodes = this.getChildNodes(),
|
|
10
|
-
|
|
12
|
+
firstChildNode = first(childNodes),
|
|
13
|
+
markedTextChildNode = firstChildNode, ///
|
|
14
|
+
markedTextChildNodeChildNodesHTML = markedTextChildNode.childNodesAsHTML(indent, context),
|
|
15
|
+
childNodesHTML = markedTextChildNodeChildNodesHTML; ///
|
|
11
16
|
|
|
12
17
|
return childNodesHTML;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
createChildNodeDOMElements(domElement, context) {
|
|
16
21
|
const childNodes = this.getChildNodes(),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
childNodeDOMElements.forEach((childNodeDOMElement) => {
|
|
23
|
-
parentDOMElement.insertBefore(childNodeDOMElement, siblingDOMElement);
|
|
24
|
-
});
|
|
22
|
+
firstChildNode = first(childNodes),
|
|
23
|
+
markedTextChildNode = firstChildNode;
|
|
24
|
+
|
|
25
|
+
markedTextChildNode.createChildNodeDOMElements(domElement, context);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return MarkdownNode.fromRuleNameChildNodesAndOpacity(TableCellMarkdownNode, ruleName, childNodes, opacity); }
|
package/src/node/markdown.js
CHANGED
|
@@ -36,45 +36,6 @@ class MarkdownNode extends NonTerminalNode {
|
|
|
36
36
|
return className;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
asHTML(indent, context) {
|
|
40
|
-
if (context === undefined) {
|
|
41
|
-
context = indent; ///
|
|
42
|
-
|
|
43
|
-
indent = EMPTY_STRING;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const tagName = this.tagName(context);
|
|
47
|
-
|
|
48
|
-
let html = null;
|
|
49
|
-
|
|
50
|
-
if (tagName !== null) {
|
|
51
|
-
indent = this.adjustIndent(indent);
|
|
52
|
-
|
|
53
|
-
const childNodesHTML = this.childNodesAsHTML(indent, context);
|
|
54
|
-
|
|
55
|
-
if (childNodesHTML !== null) {
|
|
56
|
-
const startingTag = this.startingTag(context),
|
|
57
|
-
closingTag = this.closingTag(context);
|
|
58
|
-
|
|
59
|
-
html = (indent === null) ?
|
|
60
|
-
`${startingTag}${trim(childNodesHTML)}${closingTag}` :
|
|
61
|
-
`${indent}${startingTag}
|
|
62
|
-
${trim(childNodesHTML)}
|
|
63
|
-
${indent}${closingTag}
|
|
64
|
-
`;
|
|
65
|
-
} else {
|
|
66
|
-
const selfClosingTag = this.selfClosingTag(context);
|
|
67
|
-
|
|
68
|
-
html = (indent === null) ?
|
|
69
|
-
selfClosingTag : ///
|
|
70
|
-
`${indent}${selfClosingTag}
|
|
71
|
-
`;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return html;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
39
|
closingTag(context) {
|
|
79
40
|
const tagName = this.tagName(context),
|
|
80
41
|
closingTag = `<\\${tagName}>`;
|
|
@@ -169,6 +130,45 @@ ${indent}${closingTag}
|
|
|
169
130
|
return childNodesHTML;
|
|
170
131
|
}
|
|
171
132
|
|
|
133
|
+
asHTML(indent, context) {
|
|
134
|
+
if (context === undefined) {
|
|
135
|
+
context = indent; ///
|
|
136
|
+
|
|
137
|
+
indent = EMPTY_STRING;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const tagName = this.tagName(context);
|
|
141
|
+
|
|
142
|
+
let html = null;
|
|
143
|
+
|
|
144
|
+
if (tagName !== null) {
|
|
145
|
+
indent = this.adjustIndent(indent);
|
|
146
|
+
|
|
147
|
+
const childNodesHTML = this.childNodesAsHTML(indent, context);
|
|
148
|
+
|
|
149
|
+
if (childNodesHTML !== null) {
|
|
150
|
+
const startingTag = this.startingTag(context),
|
|
151
|
+
closingTag = this.closingTag(context);
|
|
152
|
+
|
|
153
|
+
html = (indent === null) ?
|
|
154
|
+
`${startingTag}${trim(childNodesHTML)}${closingTag}` :
|
|
155
|
+
`${indent}${startingTag}
|
|
156
|
+
${trim(childNodesHTML)}
|
|
157
|
+
${indent}${closingTag}
|
|
158
|
+
`;
|
|
159
|
+
} else {
|
|
160
|
+
const selfClosingTag = this.selfClosingTag(context);
|
|
161
|
+
|
|
162
|
+
html = (indent === null) ?
|
|
163
|
+
selfClosingTag : ///
|
|
164
|
+
`${indent}${selfClosingTag}
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return html;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
172
|
createDOMElement(context) {
|
|
173
173
|
let domElement = null;
|
|
174
174
|
|
|
@@ -218,9 +218,10 @@ ${indent}${closingTag}
|
|
|
218
218
|
|
|
219
219
|
insertDOMElement(domElement) {
|
|
220
220
|
const parentDOMElement = this.domElement, ///
|
|
221
|
-
siblingDOMElement = null
|
|
221
|
+
siblingDOMElement = null,
|
|
222
|
+
childNodeDOMElement = domElement; ///
|
|
222
223
|
|
|
223
|
-
parentDOMElement.insertBefore(
|
|
224
|
+
parentDOMElement.insertBefore(childNodeDOMElement, siblingDOMElement);
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
static fromRuleNameChildNodesAndOpacity(Class, ruleName, childNodes, opacity, ...remainingArguments) {
|