highmark-markdown 0.0.2 → 0.0.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 +752 -618
- package/lib/example/view/textarea/bnf.js +3 -10
- package/lib/example/view/textarea/lexicalEntries.js +3 -16
- package/lib/example/view/textarea/parseTree.js +3 -3
- package/lib/example/view/{div/previewPane.js → xmp.js} +13 -65
- package/lib/example/view.js +11 -19
- package/lib/mixins/content.js +5 -5
- package/lib/node/markdown/anchor.js +12 -29
- package/lib/node/markdown/blockListing.js +32 -5
- package/lib/node/markdown/blockText.js +9 -2
- package/lib/node/markdown/document.js +26 -5
- package/lib/node/markdown/endOfLine.js +11 -4
- package/lib/node/markdown/error.js +9 -34
- package/lib/node/markdown/footnote.js +4 -4
- package/lib/node/markdown/footnoteItem.js +3 -3
- package/lib/node/markdown/footnotesList.js +10 -10
- package/lib/node/markdown/hyperlink.js +20 -38
- package/lib/node/markdown/image.js +27 -38
- package/lib/node/markdown/inlineListing.js +2 -12
- package/lib/node/markdown/inlineText.js +9 -2
- package/lib/node/markdown/line.js +11 -4
- package/lib/node/markdown/link.js +24 -48
- package/lib/node/markdown/orderedList.js +9 -33
- package/lib/node/markdown/orderedListItem.js +3 -3
- package/lib/node/markdown/reference.js +4 -4
- package/lib/node/markdown/stronglyEmphasisedText.js +12 -3
- package/lib/node/markdown/tableBodyCell.js +8 -1
- package/lib/node/markdown/tableCell.js +31 -8
- package/lib/node/markdown/tableHeadCell.js +8 -1
- package/lib/node/markdown/text.js +3 -3
- package/lib/node/markdown/verticalSpace.js +9 -5
- package/lib/node/markdown.js +109 -14
- package/lib/ruleNameToHTMLMap.js +2 -2
- package/lib/utilities/childNodes.js +53 -4
- package/lib/utilities/link.js +32 -6
- package/lib/utilities/string.js +52 -0
- package/package.json +1 -1
- package/src/example/view/textarea/bnf.js +2 -10
- package/src/example/view/textarea/lexicalEntries.js +2 -18
- package/src/example/view/textarea/parseTree.js +2 -2
- package/src/example/view/xmp.js +28 -0
- package/src/example/view.js +26 -35
- package/src/mixins/content.js +2 -2
- package/src/node/markdown/anchor.js +8 -6
- package/src/node/markdown/blockListing.js +9 -3
- package/src/node/markdown/blockText.js +8 -1
- package/src/node/markdown/document.js +30 -5
- package/src/node/markdown/endOfLine.js +9 -2
- package/src/node/markdown/error.js +12 -11
- package/src/node/markdown/footnote.js +2 -2
- package/src/node/markdown/footnoteItem.js +1 -1
- package/src/node/markdown/footnotesList.js +11 -9
- package/src/node/markdown/hyperlink.js +21 -20
- package/src/node/markdown/image.js +25 -17
- package/src/node/markdown/inlineListing.js +0 -13
- package/src/node/markdown/inlineText.js +8 -1
- package/src/node/markdown/line.js +14 -6
- package/src/node/markdown/link.js +24 -25
- package/src/node/markdown/orderedList.js +7 -11
- package/src/node/markdown/orderedListItem.js +1 -1
- package/src/node/markdown/reference.js +4 -4
- package/src/node/markdown/stronglyEmphasisedText.js +14 -4
- package/src/node/markdown/tableBodyCell.js +9 -0
- package/src/node/markdown/tableCell.js +36 -7
- package/src/node/markdown/tableHeadCell.js +9 -0
- package/src/node/markdown/text.js +1 -1
- package/src/node/markdown/verticalSpace.js +7 -8
- package/src/node/markdown.js +148 -11
- package/src/ruleNameToHTMLMap.js +1 -1
- package/src/utilities/childNodes.js +62 -0
- package/src/utilities/link.js +48 -5
- package/src/utilities/string.js +55 -0
- package/src/example/view/div/previewPane.js +0 -82
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { stringUtilities } from "necessary";
|
|
4
|
+
|
|
5
|
+
import { EMPTY_STRING } from "../constants";
|
|
6
|
+
|
|
7
|
+
const { substring } = stringUtilities;
|
|
8
|
+
|
|
9
|
+
export function trim(string) {
|
|
10
|
+
const trimmedString = string.replace(/[\n\r]$/g, EMPTY_STRING);
|
|
11
|
+
|
|
12
|
+
return trimmedString;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function chop(string, start, deleteCount) {
|
|
16
|
+
let begin,
|
|
17
|
+
end;
|
|
18
|
+
|
|
19
|
+
begin = -0;
|
|
20
|
+
|
|
21
|
+
end = start; ///
|
|
22
|
+
|
|
23
|
+
const leftString = substring(string, begin, end);
|
|
24
|
+
|
|
25
|
+
begin = start + deleteCount;
|
|
26
|
+
|
|
27
|
+
end = Infinity; ///
|
|
28
|
+
|
|
29
|
+
const rightString = substring(string, begin, end);
|
|
30
|
+
|
|
31
|
+
string = leftString + rightString; ///
|
|
32
|
+
|
|
33
|
+
return string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function splice(string, start, deleteCount, middleString) {
|
|
37
|
+
let begin,
|
|
38
|
+
end;
|
|
39
|
+
|
|
40
|
+
begin = -0;
|
|
41
|
+
|
|
42
|
+
end = start; ///
|
|
43
|
+
|
|
44
|
+
const leftString = substring(string, begin, end);
|
|
45
|
+
|
|
46
|
+
begin = start + deleteCount;
|
|
47
|
+
|
|
48
|
+
end = Infinity; ///
|
|
49
|
+
|
|
50
|
+
const rightString = substring(string, begin, end);
|
|
51
|
+
|
|
52
|
+
string = leftString + middleString + rightString; ///
|
|
53
|
+
|
|
54
|
+
return string;
|
|
55
|
+
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import withStyle from "easy-with-style";
|
|
4
|
-
|
|
5
|
-
import { Element } from "easy";
|
|
6
|
-
|
|
7
|
-
class PreviewPaneDiv extends Element {
|
|
8
|
-
update(node, tokens) {
|
|
9
|
-
let previousNode;
|
|
10
|
-
|
|
11
|
-
previousNode = this.getPreviousNode();
|
|
12
|
-
|
|
13
|
-
if (previousNode !== null) {
|
|
14
|
-
this.unmount(previousNode);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (node !== null) {
|
|
18
|
-
const context = {
|
|
19
|
-
tokens
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
node.createDOMElement(context);
|
|
23
|
-
|
|
24
|
-
this.mount(node);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
previousNode = node; ///
|
|
28
|
-
|
|
29
|
-
this.setPreviousNode(previousNode);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getPreviousNode() {
|
|
33
|
-
const { previousNode } = this.getState();
|
|
34
|
-
|
|
35
|
-
return previousNode;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
setPreviousNode(previousNode) {
|
|
39
|
-
this.updateState({
|
|
40
|
-
previousNode
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
setInitialState() {
|
|
45
|
-
const previousNode = null;
|
|
46
|
-
|
|
47
|
-
this.setState({
|
|
48
|
-
previousNode
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
parentContext() {
|
|
53
|
-
const updatePreviewPaneDiv = this.update.bind(this);
|
|
54
|
-
|
|
55
|
-
return ({
|
|
56
|
-
updatePreviewPaneDiv
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
initialise() {
|
|
61
|
-
this.setInitialState();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
static tagName = "div";
|
|
65
|
-
|
|
66
|
-
static defaultProperties = {
|
|
67
|
-
className: "preview-pane"
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export default withStyle(PreviewPaneDiv)`
|
|
72
|
-
|
|
73
|
-
top: 0;
|
|
74
|
-
left: 0;
|
|
75
|
-
width: 100%;
|
|
76
|
-
height: 100%;
|
|
77
|
-
border: 1px solid darkgrey;
|
|
78
|
-
overflow: scroll;
|
|
79
|
-
position: absolute;
|
|
80
|
-
font-size: 16pt;
|
|
81
|
-
|
|
82
|
-
`;
|