highmark-markdown 1.0.183 → 1.0.185
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 +10243 -6411
- package/lib/constants.js +9 -1
- package/lib/defaultMarkdownStyle.js +2 -2
- package/lib/example/importer.js +3 -3
- package/lib/example/indexOptions.js +1 -98
- package/lib/example/view/div/container/markdown.js +2 -2
- package/lib/example/view/div/container/markdownStyle.js +2 -2
- package/lib/example/view/div/container.js +2 -2
- package/lib/example/view/div/pageButtons.js +7 -4
- package/lib/example/view/div/preview.js +1 -5
- package/lib/example/view/div/sizeable/left.js +2 -2
- package/lib/example/view/div/tabButtons/right.js +5 -5
- package/lib/example/view/textarea/markdown.js +2 -2
- package/lib/example/view/textarea/markdownStyle.js +2 -2
- package/lib/example/view/textarea/parseTree/html.js +2 -2
- package/lib/example/view/textarea/plainText.js +1 -5
- package/lib/example/view/xmp.js +1 -5
- package/lib/example/view.js +51 -48
- package/lib/index/list.js +4 -4
- package/lib/index.js +2 -2
- package/lib/map/node/html.js +13 -7
- package/lib/map/node/markdown.js +5 -24
- package/lib/markdown/bnf.js +2 -2
- package/lib/node/html/anchor.js +49 -64
- package/lib/node/html/blockLine.js +23 -4
- package/lib/node/{markdown/paragraph.js → html/directive/contents.js} +20 -14
- package/lib/node/{markdown/strongText.js → html/directive/footnotes.js} +20 -14
- package/lib/node/{markdown/emphasisedText.js → html/directive/index.js} +20 -14
- package/lib/node/{markdown/inlineText.js → html/directive/pageNumber.js} +20 -14
- package/lib/node/html/division.js +118 -7
- package/lib/node/html/footnote.js +4 -10
- package/lib/node/html/heading/index.js +71 -10
- package/lib/node/html/heading/primary.js +8 -7
- package/lib/node/html/heading/quaternary.js +8 -7
- package/lib/node/html/heading/secondary.js +8 -7
- package/lib/node/html/heading/tertiary.js +8 -7
- package/lib/node/html/heading.js +165 -0
- package/lib/node/html/image.js +7 -6
- package/lib/node/html/item/contents.js +22 -8
- package/lib/node/html/item/footnote.js +144 -0
- package/lib/node/html/item/index.js +27 -43
- package/lib/node/html/line.js +55 -2
- package/lib/node/html/link/contents.js +34 -14
- package/lib/node/html/link/email.js +32 -8
- package/lib/node/html/link/footnote.js +95 -5
- package/lib/node/html/link/hyper.js +32 -8
- package/lib/node/html/link/index.js +66 -35
- package/lib/node/html/list/contents.js +22 -8
- package/lib/node/html/list/footnotes.js +39 -12
- package/lib/node/html/list/index.js +22 -8
- package/lib/node/html/pageNumber.js +70 -23
- package/lib/node/html/{item/footnotes.js → reference.js} +14 -14
- package/lib/node/{markdown/heading/primary.js → html/text/comma.js} +38 -28
- package/lib/node/html/text/index.js +146 -0
- package/lib/node/html/text/stronglyEmphasised.js +15 -8
- package/lib/node/html/text.js +43 -5
- package/lib/node/html/topmost.js +67 -1
- package/lib/node/html.js +77 -4
- package/lib/node/markdown/directive/{embee.js → embed.js} +1 -1
- package/lib/node/markdown/division.js +13 -22
- package/lib/node/markdown/link/footnote.js +5 -102
- package/lib/node/markdown/subDivision.js +2 -2
- package/lib/node/markdown/text/block.js +1 -1
- package/lib/node/markdown/text.js +25 -29
- package/lib/ruleNames.js +87 -81
- package/lib/style/selector.js +4 -4
- package/lib/{node/markdown/heading/tertiary.js → transform/html/directive/contents.js} +23 -28
- package/lib/{node/markdown/stronglyEmphasisedText.js → transform/html/directive/footnotes.js} +15 -14
- package/lib/{node/markdown/line.js → transform/html/directive/index.js} +19 -18
- package/lib/transform/html/directive/pageNumber.js +108 -0
- package/lib/transform/html/division.js +130 -0
- package/lib/transform/html/footnote.js +159 -0
- package/lib/transform/html/heading/index.js +109 -0
- package/lib/transform/html/index.js +159 -0
- package/lib/transform/{indexAnchor.js → html/indexAnchor.js} +20 -20
- package/lib/transform/html/item/contents.js +130 -0
- package/lib/transform/html/item/footnote.js +117 -0
- package/lib/transform/html/item/index.js +117 -0
- package/lib/transform/html/line.js +123 -0
- package/lib/transform/html/link/contents.js +130 -0
- package/lib/transform/html/link/footnote.js +158 -0
- package/lib/transform/html/link/nestedFootnote.js +108 -0
- package/lib/transform/html/list/contents.js +180 -0
- package/lib/transform/html/list/footnotes.js +117 -0
- package/lib/transform/html/list/index.js +118 -0
- package/lib/transform/html/pageNumber.js +117 -0
- package/lib/transform/html.js +168 -0
- package/lib/transform/markdown/directive/embed.js +14 -9
- package/lib/transform/markdown/directive/ignore.js +12 -38
- package/lib/transform/markdown/directive/include.js +11 -6
- package/lib/transform/markdown/subDivision.js +18 -50
- package/lib/transform/markdown.js +148 -0
- package/lib/utilities/contents.js +16 -16
- package/lib/utilities/division.js +247 -0
- package/lib/utilities/footnotes.js +8 -8
- package/lib/utilities/html.js +37 -79
- package/lib/utilities/index.js +23 -16
- package/lib/utilities/markdown.js +2 -10
- package/lib/utilities/string.js +16 -10
- package/lib/utilities/whitespace.js +33 -0
- package/package.json +6 -6
- package/src/constants.js +2 -0
- package/src/defaultMarkdownStyle.js +6 -9
- package/src/example/importer.js +11 -5
- package/src/example/indexOptions.js +0 -97
- package/src/example/view/div/container/markdown.js +1 -1
- package/src/example/view/div/container/markdownStyle.js +1 -1
- package/src/example/view/div/container.js +1 -1
- package/src/example/view/div/pageButtons.js +8 -2
- package/src/example/view/div/preview.js +0 -6
- package/src/example/view/div/sizeable/left.js +1 -1
- package/src/example/view/div/tabButtons/right.js +3 -3
- package/src/example/view/textarea/markdown.js +1 -0
- package/src/example/view/textarea/markdownStyle.js +1 -0
- package/src/example/view/textarea/parseTree/html.js +1 -1
- package/src/example/view/textarea/plainText.js +0 -6
- package/src/example/view/xmp.js +0 -6
- package/src/example/view.js +75 -74
- package/src/index/list.js +3 -3
- package/src/index.js +1 -1
- package/src/map/node/html.js +29 -11
- package/src/map/node/markdown.js +8 -65
- package/src/markdown/bnf.js +112 -149
- package/src/node/html/anchor.js +34 -43
- package/src/node/html/blockLine.js +33 -4
- package/src/node/html/directive/contents.js +9 -0
- package/src/node/html/directive/footnotes.js +9 -0
- package/src/node/html/directive/index.js +9 -0
- package/src/node/html/directive/pageNumber.js +9 -0
- package/src/node/html/division.js +154 -4
- package/src/node/html/footnote.js +1 -7
- package/src/node/html/heading/index.js +78 -2
- package/src/node/html/heading/primary.js +6 -4
- package/src/node/html/heading/quaternary.js +6 -4
- package/src/node/html/heading/secondary.js +6 -4
- package/src/node/html/heading/tertiary.js +6 -4
- package/src/node/html/heading.js +59 -0
- package/src/node/html/image.js +8 -5
- package/src/node/html/item/contents.js +25 -2
- package/src/node/html/item/footnote.js +39 -0
- package/src/node/html/item/index.js +35 -16
- package/src/node/html/line.js +41 -2
- package/src/node/html/link/contents.js +32 -5
- package/src/node/html/link/email.js +51 -17
- package/src/node/html/link/footnote.js +98 -2
- package/src/node/html/link/hyper.js +51 -17
- package/src/node/html/link/index.js +63 -30
- package/src/node/html/list/contents.js +25 -2
- package/src/node/html/list/footnotes.js +34 -2
- package/src/node/html/list/index.js +25 -2
- package/src/node/html/pageNumber.js +60 -16
- package/src/node/html/reference.js +13 -0
- package/src/node/html/text/comma.js +29 -0
- package/src/node/html/text/index.js +43 -0
- package/src/node/html/text/stronglyEmphasised.js +22 -11
- package/src/node/html/text.js +3 -3
- package/src/node/html/topmost.js +93 -1
- package/src/node/html.js +34 -6
- package/src/node/markdown/division.js +11 -227
- package/src/node/markdown/link/footnote.js +6 -82
- package/src/node/markdown/subDivision.js +1 -1
- package/src/node/markdown/text/block.js +1 -1
- package/src/node/markdown/text.js +38 -39
- package/src/ruleNames.js +11 -8
- package/src/style/selector.js +3 -4
- package/src/transform/html/directive/contents.js +19 -0
- package/src/transform/html/directive/footnotes.js +12 -0
- package/src/transform/html/directive/index.js +19 -0
- package/src/transform/html/directive/pageNumber.js +12 -0
- package/src/transform/html/division.js +33 -0
- package/src/transform/html/footnote.js +66 -0
- package/src/transform/html/heading/index.js +14 -0
- package/src/transform/html/index.js +77 -0
- package/src/transform/html/indexAnchor.js +24 -0
- package/src/transform/html/item/contents.js +48 -0
- package/src/transform/html/item/footnote.js +21 -0
- package/src/transform/html/item/index.js +21 -0
- package/src/transform/html/line.js +27 -0
- package/src/transform/html/link/contents.js +40 -0
- package/src/transform/html/link/footnote.js +58 -0
- package/src/transform/html/link/nestedFootnote.js +12 -0
- package/src/transform/html/list/contents.js +86 -0
- package/src/transform/html/list/footnotes.js +20 -0
- package/src/transform/html/list/index.js +27 -0
- package/src/transform/html/pageNumber.js +20 -0
- package/src/transform/html.js +78 -0
- package/src/transform/markdown/directive/embed.js +6 -7
- package/src/transform/markdown/directive/ignore.js +3 -9
- package/src/transform/markdown/directive/include.js +3 -3
- package/src/transform/markdown/subDivision.js +5 -17
- package/src/transform/markdown.js +9 -0
- package/src/utilities/contents.js +12 -12
- package/src/utilities/division.js +256 -0
- package/src/utilities/footnotes.js +5 -5
- package/src/utilities/html.js +39 -86
- package/src/utilities/index.js +26 -16
- package/src/utilities/markdown.js +0 -8
- package/src/utilities/string.js +5 -3
- package/src/utilities/whitespace.js +21 -0
- package/lib/node/markdown/anchor.js +0 -171
- package/lib/node/markdown/contentsItem.js +0 -112
- package/lib/node/markdown/directive/pageNumber.js +0 -163
- package/lib/node/markdown/heading/quaternary.js +0 -121
- package/lib/node/markdown/heading/secondary.js +0 -121
- package/lib/node/markdown/heading.js +0 -140
- package/lib/node/markdown/item/footnotes.js +0 -120
- package/lib/node/markdown/link/contents.js +0 -156
- package/lib/node/markdown/link/index.js +0 -117
- package/lib/node/markdown/list/contents.js +0 -112
- package/lib/node/markdown/list/footnotes.js +0 -165
- package/lib/node/markdown/list/index.js +0 -112
- package/lib/transform/contentsDirective.js +0 -112
- package/lib/transform/contentsItem.js +0 -134
- package/lib/transform/contentsLink.js +0 -115
- package/lib/transform/contentsList.js +0 -193
- package/lib/transform/footnote.js +0 -181
- package/lib/transform/footnoteIdentifier.js +0 -120
- package/lib/transform/footnotesDirective.js +0 -112
- package/lib/transform/footnotesItem.js +0 -123
- package/lib/transform/footnotesList.js +0 -172
- package/lib/transform/index.js +0 -166
- package/lib/transform/indexDirective.js +0 -112
- package/lib/transform/indexHeading.js +0 -104
- package/lib/transform/indexItem.js +0 -113
- package/lib/transform/indexList.js +0 -121
- package/lib/transform/line.js +0 -111
- package/lib/transform/pageNumberDirective.js +0 -112
- package/src/node/html/item/footnotes.js +0 -13
- package/src/node/markdown/anchor.js +0 -45
- package/src/node/markdown/contentsItem.js +0 -21
- package/src/node/markdown/directive/pageNumber.js +0 -34
- package/src/node/markdown/emphasisedText.js +0 -7
- package/src/node/markdown/heading/primary.js +0 -9
- package/src/node/markdown/heading/quaternary.js +0 -9
- package/src/node/markdown/heading/secondary.js +0 -9
- package/src/node/markdown/heading/tertiary.js +0 -9
- package/src/node/markdown/heading.js +0 -47
- package/src/node/markdown/inlineText.js +0 -7
- package/src/node/markdown/item/footnotes.js +0 -39
- package/src/node/markdown/line.js +0 -17
- package/src/node/markdown/link/contents.js +0 -31
- package/src/node/markdown/link/index.js +0 -18
- package/src/node/markdown/list/contents.js +0 -21
- package/src/node/markdown/list/footnotes.js +0 -45
- package/src/node/markdown/list/index.js +0 -21
- package/src/node/markdown/paragraph.js +0 -7
- package/src/node/markdown/strongText.js +0 -7
- package/src/node/markdown/stronglyEmphasisedText.js +0 -7
- package/src/transform/contentsDirective.js +0 -18
- package/src/transform/contentsItem.js +0 -55
- package/src/transform/contentsLink.js +0 -28
- package/src/transform/contentsList.js +0 -110
- package/src/transform/footnote.js +0 -51
- package/src/transform/footnoteIdentifier.js +0 -27
- package/src/transform/footnotesDirective.js +0 -18
- package/src/transform/footnotesItem.js +0 -25
- package/src/transform/footnotesList.js +0 -77
- package/src/transform/index.js +0 -90
- package/src/transform/indexAnchor.js +0 -27
- package/src/transform/indexDirective.js +0 -18
- package/src/transform/indexHeading.js +0 -18
- package/src/transform/indexItem.js +0 -29
- package/src/transform/indexList.js +0 -33
- package/src/transform/line.js +0 -19
- package/src/transform/pageNumberDirective.js +0 -18
- /package/src/node/markdown/directive/{embee.js → embed.js} +0 -0
package/src/example/importer.js
CHANGED
|
@@ -42,9 +42,11 @@ const INDEX_PATH = "index.md",
|
|
|
42
42
|
INSTALLING_THE_CLI_PATH = "installing-the-cli.md",
|
|
43
43
|
GETTING_TO_GRIPS_WITH_THE_IDE_PATH = "getting-to-grips-with-the-ide.md";
|
|
44
44
|
|
|
45
|
-
export const initialMarkdown = `@ignore
|
|
45
|
+
export const initialMarkdown = `@ignore
|
|
46
46
|
|
|
47
47
|
@include ${FRONT_MATTER_PATH}
|
|
48
|
+
@include ${CONTENT_PATH}
|
|
49
|
+
@include ${INDEX_PATH}
|
|
48
50
|
`;
|
|
49
51
|
|
|
50
52
|
const indexContent = `## Index
|
|
@@ -64,7 +66,8 @@ const indexContent = `## Index
|
|
|
64
66
|
frontMatterContent = `@ignore
|
|
65
67
|
|
|
66
68
|
@include ${HALF_TITLE_PATH}
|
|
67
|
-
@include ${CONTENTS_PATH}
|
|
69
|
+
@include ${CONTENTS_PATH}
|
|
70
|
+
@include ${INTRODUCTION_PATH}`,
|
|
68
71
|
|
|
69
72
|
introductionContent = `# Introduction
|
|
70
73
|
|
|
@@ -77,7 +80,7 @@ Constructor.
|
|
|
77
80
|
|
|
78
81
|
gettingStartedContent = `# Getting started
|
|
79
82
|
|
|
80
|
-
|
|
83
|
+
A short paragraph with a reference to a footnote[^occam].
|
|
81
84
|
|
|
82
85
|
[^occam]: The word Occam is used somewhat nebulously here.
|
|
83
86
|
It is most often associated with Occam's IDE but in fact it encompasses a range of software and services.
|
|
@@ -85,13 +88,15 @@ This book explains these divers parts and there is a companion book, called The
|
|
|
85
88
|
|
|
86
89
|
@footnotes
|
|
87
90
|
|
|
88
|
-
@
|
|
89
|
-
@
|
|
91
|
+
@include ${INSTALLING_THE_CLI_PATH}
|
|
92
|
+
@include ${GETTING_TO_GRIPS_WITH_THE_IDE_PATH}
|
|
90
93
|
|
|
91
94
|
@pageNumber
|
|
92
95
|
`,
|
|
93
96
|
|
|
94
97
|
installingTheCLIContent = `## Installing the CLI
|
|
98
|
+
|
|
99
|
+
@pageNumber
|
|
95
100
|
`,
|
|
96
101
|
|
|
97
102
|
gettingToGripsWithTheIDEIContent = `## Getting to grips with the IDE
|
|
@@ -102,6 +107,7 @@ This book explains these divers parts and there is a companion book, called The
|
|
|
102
107
|
1. As well as an...
|
|
103
108
|
2. ...ordered list.
|
|
104
109
|
|
|
110
|
+
@pageNumber
|
|
105
111
|
`;
|
|
106
112
|
|
|
107
113
|
const contentMap = {
|
|
@@ -26,103 +26,6 @@ const indexOptions = {
|
|
|
26
26
|
"are",
|
|
27
27
|
"as",
|
|
28
28
|
"associated",
|
|
29
|
-
"at",
|
|
30
|
-
"between",
|
|
31
|
-
"boils",
|
|
32
|
-
"book",
|
|
33
|
-
"but",
|
|
34
|
-
"called",
|
|
35
|
-
"cannot",
|
|
36
|
-
"companion",
|
|
37
|
-
"considerable",
|
|
38
|
-
"contents",
|
|
39
|
-
"controlled",
|
|
40
|
-
"covers",
|
|
41
|
-
"day",
|
|
42
|
-
"detail",
|
|
43
|
-
"detailed",
|
|
44
|
-
"distinguish",
|
|
45
|
-
"divers",
|
|
46
|
-
"down",
|
|
47
|
-
"encompasses",
|
|
48
|
-
"end",
|
|
49
|
-
"expert",
|
|
50
|
-
"explains",
|
|
51
|
-
"explanation",
|
|
52
|
-
"explanations",
|
|
53
|
-
"fact",
|
|
54
|
-
"footnote",
|
|
55
|
-
"former",
|
|
56
|
-
"foundations",
|
|
57
|
-
"future",
|
|
58
|
-
"getting",
|
|
59
|
-
"goes",
|
|
60
|
-
"grips",
|
|
61
|
-
"has",
|
|
62
|
-
"have",
|
|
63
|
-
"here",
|
|
64
|
-
"how",
|
|
65
|
-
"i",
|
|
66
|
-
"ide",
|
|
67
|
-
"in",
|
|
68
|
-
"indeed",
|
|
69
|
-
"index",
|
|
70
|
-
"indexing",
|
|
71
|
-
"into",
|
|
72
|
-
"introduction",
|
|
73
|
-
"is",
|
|
74
|
-
"it",
|
|
75
|
-
"its",
|
|
76
|
-
"largely",
|
|
77
|
-
"least",
|
|
78
|
-
"limits",
|
|
79
|
-
"list",
|
|
80
|
-
"make",
|
|
81
|
-
"more",
|
|
82
|
-
"most",
|
|
83
|
-
"natural",
|
|
84
|
-
"near",
|
|
85
|
-
"nebulously",
|
|
86
|
-
"need",
|
|
87
|
-
"not",
|
|
88
|
-
"of",
|
|
89
|
-
"often",
|
|
90
|
-
"on",
|
|
91
|
-
"ordered",
|
|
92
|
-
"originally",
|
|
93
|
-
"own",
|
|
94
|
-
"paragraph",
|
|
95
|
-
"parts",
|
|
96
|
-
"possible",
|
|
97
|
-
"provide",
|
|
98
|
-
"purpose",
|
|
99
|
-
"range",
|
|
100
|
-
"reference",
|
|
101
|
-
"s",
|
|
102
|
-
"seemed",
|
|
103
|
-
"services",
|
|
104
|
-
"short",
|
|
105
|
-
"some",
|
|
106
|
-
"somewhat",
|
|
107
|
-
"started",
|
|
108
|
-
"subject",
|
|
109
|
-
"support",
|
|
110
|
-
"system",
|
|
111
|
-
"test",
|
|
112
|
-
"that",
|
|
113
|
-
"the",
|
|
114
|
-
"there",
|
|
115
|
-
"these",
|
|
116
|
-
"this",
|
|
117
|
-
"to",
|
|
118
|
-
"tried",
|
|
119
|
-
"underlying",
|
|
120
|
-
"unordered",
|
|
121
|
-
"use",
|
|
122
|
-
"useable",
|
|
123
|
-
"used",
|
|
124
|
-
"was",
|
|
125
|
-
"well",
|
|
126
29
|
"which",
|
|
127
30
|
"will",
|
|
128
31
|
"with",
|
|
@@ -50,7 +50,13 @@ class PageButtonsDiv extends Element {
|
|
|
50
50
|
return pageButtons;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
update(length, index
|
|
53
|
+
update(length, index) {
|
|
54
|
+
if (index === undefined) {
|
|
55
|
+
index = length; ///
|
|
56
|
+
|
|
57
|
+
length = null;
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
if (length !== null) {
|
|
55
61
|
this.unmountPageButtons();
|
|
56
62
|
|
|
@@ -58,7 +64,7 @@ class PageButtonsDiv extends Element {
|
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
const pageButtons = this.getPageButtons(),
|
|
61
|
-
currentIndex = index;
|
|
67
|
+
currentIndex = index; ///
|
|
62
68
|
|
|
63
69
|
pageButtons.forEach((pageButton, index) => {
|
|
64
70
|
(index === currentIndex) ?
|
|
@@ -31,12 +31,6 @@ class PreviewDiv extends Element {
|
|
|
31
31
|
update(divisionHTMLNode, context) {
|
|
32
32
|
this.clear();
|
|
33
33
|
|
|
34
|
-
const whitespaceTokenIndex = -1;
|
|
35
|
-
|
|
36
|
-
Object.assign(context, {
|
|
37
|
-
whitespaceTokenIndex
|
|
38
|
-
});
|
|
39
|
-
|
|
40
34
|
const parentDOMElement = this.getParentDOMElement(),
|
|
41
35
|
siblingDOMElement = null;
|
|
42
36
|
|
|
@@ -76,7 +76,7 @@ class RightTabButtonsDiv extends TabButtonsDiv {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
didMount() {
|
|
79
|
-
this.
|
|
79
|
+
this.html();
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
willUnmount() {
|
|
@@ -86,10 +86,10 @@ class RightTabButtonsDiv extends TabButtonsDiv {
|
|
|
86
86
|
childElements() {
|
|
87
87
|
return ([
|
|
88
88
|
|
|
89
|
-
<CSSTabButton onClick={this.cssTabButtonClickHandler} />,
|
|
90
89
|
<HTMLTabButton onClick={this.htmlTabButtonClickHandler} />,
|
|
91
90
|
<PreviewTabButton onClick={this.previewTabButtonClickHandler} />,
|
|
92
|
-
<PlainTextTabButton onClick={this.plainTextTabButtonClickHandler}
|
|
91
|
+
<PlainTextTabButton onClick={this.plainTextTabButtonClickHandler} />,
|
|
92
|
+
<CSSTabButton onClick={this.cssTabButtonClickHandler} />
|
|
93
93
|
|
|
94
94
|
]);
|
|
95
95
|
}
|
|
@@ -20,12 +20,6 @@ class PlainTextTextarea extends Textarea {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
update(divisionHTMLNode, context) {
|
|
23
|
-
const whitespaceTokenIndex = -1;
|
|
24
|
-
|
|
25
|
-
Object.assign(context, {
|
|
26
|
-
whitespaceTokenIndex
|
|
27
|
-
});
|
|
28
|
-
|
|
29
23
|
const plainText = divisionHTMLNode.asPlainText(context);
|
|
30
24
|
|
|
31
25
|
this.setPlainText(plainText);
|
package/src/example/view/xmp.js
CHANGED
|
@@ -8,12 +8,6 @@ import { EMPTY_STRING } from "../constants";
|
|
|
8
8
|
|
|
9
9
|
class XMP extends Element {
|
|
10
10
|
update(divisionHTMLNode, context) {
|
|
11
|
-
const whitespaceTokenIndex = -1;
|
|
12
|
-
|
|
13
|
-
Object.assign(context, {
|
|
14
|
-
whitespaceTokenIndex
|
|
15
|
-
});
|
|
16
|
-
|
|
17
11
|
const indent = null,
|
|
18
12
|
html = divisionHTMLNode.asHTML(indent, context);
|
|
19
13
|
|
package/src/example/view.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Element } from "easy";
|
|
|
6
6
|
import { RowsDiv, ColumnDiv, ColumnsDiv, VerticalSplitterDiv } from "easy-layout";
|
|
7
7
|
import { MarkdownLexer, MarkdownParser, MarkdownStyleLexer, MarkdownStyleParser } from "../index";
|
|
8
8
|
|
|
9
|
+
import indexOptions from "./indexOptions";
|
|
9
10
|
import PageButtonsDiv from "./view/div/pageButtons";
|
|
10
11
|
import LeftSizeableDiv from "./view/div/sizeable/left";
|
|
11
12
|
import CSSContainerDiv from "./view/div/container/css";
|
|
@@ -32,9 +33,9 @@ class View extends Element {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
pageUpdateCustomHandler = (event, element, index) => {
|
|
35
|
-
this.
|
|
36
|
+
this.updateMarkdown();
|
|
36
37
|
|
|
37
|
-
this.
|
|
38
|
+
this.updateHTML(index);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
plainTextCustomHandler = (event, element) => {
|
|
@@ -63,25 +64,45 @@ class View extends Element {
|
|
|
63
64
|
|
|
64
65
|
update() {
|
|
65
66
|
this.updateMarkdownStyle();
|
|
67
|
+
|
|
66
68
|
this.updateMarkdown();
|
|
67
|
-
|
|
69
|
+
|
|
70
|
+
this.updateHTML();
|
|
68
71
|
}
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
updateHTML(index = 0) {
|
|
74
|
+
const topmostHTMLNode = this.getTopmostHTMLNode();
|
|
75
|
+
|
|
71
76
|
this.clearXMP();
|
|
77
|
+
|
|
72
78
|
this.clearPreviewDiv();
|
|
79
|
+
|
|
80
|
+
this.clearPlainTextTextarea();
|
|
81
|
+
|
|
73
82
|
this.clearHTMLParseTreeTextarea();
|
|
74
|
-
}
|
|
75
83
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
this.clearPageButtonsDiv();
|
|
85
|
+
|
|
86
|
+
if (topmostHTMLNode === null) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const divisionHTMLNOde = topmostHTMLNode.getDivisionHTMLNodeAt(index);
|
|
91
|
+
|
|
92
|
+
if (divisionHTMLNOde === null) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const divisionHTMLNOdeParseTree = divisionHTMLNOde.asParseTree(),
|
|
97
|
+
htmlParseTree = divisionHTMLNOdeParseTree, ///
|
|
98
|
+
tokens = this.getTokens();
|
|
99
|
+
|
|
100
|
+
let context;
|
|
101
|
+
|
|
102
|
+
context = {
|
|
103
|
+
tokens,
|
|
104
|
+
pathToURL
|
|
105
|
+
};
|
|
85
106
|
|
|
86
107
|
this.updateXMP(divisionHTMLNOde, context);
|
|
87
108
|
|
|
@@ -89,14 +110,9 @@ class View extends Element {
|
|
|
89
110
|
|
|
90
111
|
this.updatePlainTextTextarea(divisionHTMLNOde, context);
|
|
91
112
|
|
|
92
|
-
const multiplicity = topmostHTMLNode.getMultiplicity(),
|
|
93
|
-
length = multiplicity, ///
|
|
94
|
-
parseTree = divisionHTMLNOde.asParseTree(),
|
|
95
|
-
htmlParseTree = parseTree; ///
|
|
96
|
-
|
|
97
|
-
this.updatePageButtonsDiv(length, index);
|
|
98
|
-
|
|
99
113
|
this.updateHTMLParseTreeTextarea(htmlParseTree);
|
|
114
|
+
|
|
115
|
+
this.updatePageButtonsDiv(index);
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
updateMarkdown() {
|
|
@@ -110,33 +126,44 @@ class View extends Element {
|
|
|
110
126
|
if (node === null) {
|
|
111
127
|
this.resetTokens();
|
|
112
128
|
|
|
113
|
-
this.
|
|
129
|
+
this.resetTopmostHTMLNode();
|
|
114
130
|
|
|
115
131
|
this.clearMarkdownParseTreeTextarea();
|
|
116
132
|
|
|
117
|
-
this.clearPageButtonsDiv();
|
|
118
|
-
|
|
119
|
-
this.clearPage();
|
|
120
|
-
|
|
121
133
|
return;
|
|
122
134
|
}
|
|
123
135
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
let context;
|
|
137
|
+
|
|
138
|
+
const topmostMarkdownNode = node; ///
|
|
139
|
+
|
|
140
|
+
context = {
|
|
141
|
+
tokens,
|
|
142
|
+
importer
|
|
143
|
+
};
|
|
131
144
|
|
|
132
145
|
topmostMarkdownNode.resolve(context);
|
|
133
146
|
|
|
134
|
-
const
|
|
135
|
-
|
|
147
|
+
const topmostHTMLNode = htmlNodeFromMarkdownNode(topmostMarkdownNode);
|
|
148
|
+
|
|
149
|
+
context = {
|
|
150
|
+
indexOptions,
|
|
151
|
+
tokens
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
topmostHTMLNode.resolve(context);
|
|
155
|
+
|
|
156
|
+
const topmostMarkdownNodeParseTree = topmostMarkdownNode.asParseTree(tokens),
|
|
157
|
+
markdownParseTree = topmostMarkdownNodeParseTree, ///
|
|
158
|
+
multiplicity = topmostHTMLNode.getMultiplicity(),
|
|
159
|
+
length = multiplicity, ///
|
|
160
|
+
index = 0;
|
|
136
161
|
|
|
137
162
|
this.setTokens(tokens);
|
|
138
163
|
|
|
139
|
-
this.
|
|
164
|
+
this.setTopmostHTMLNode(topmostHTMLNode);
|
|
165
|
+
|
|
166
|
+
this.updatePageButtonsDiv(length, index);
|
|
140
167
|
|
|
141
168
|
this.updateMarkdownParseTreeTextarea(markdownParseTree);
|
|
142
169
|
}
|
|
@@ -208,10 +235,10 @@ class View extends Element {
|
|
|
208
235
|
this.setTokens(tokens);
|
|
209
236
|
}
|
|
210
237
|
|
|
211
|
-
|
|
212
|
-
const
|
|
238
|
+
resetTopmostHTMLNode() {
|
|
239
|
+
const topmostHTMLNode = null;
|
|
213
240
|
|
|
214
|
-
this.
|
|
241
|
+
this.setTopmostHTMLNode(topmostHTMLNode);
|
|
215
242
|
}
|
|
216
243
|
|
|
217
244
|
getTokens() {
|
|
@@ -220,10 +247,10 @@ class View extends Element {
|
|
|
220
247
|
return tokens;
|
|
221
248
|
}
|
|
222
249
|
|
|
223
|
-
|
|
224
|
-
const {
|
|
250
|
+
getTopmostHTMLNode() {
|
|
251
|
+
const { topmostMHTMLNode } = this.getState();
|
|
225
252
|
|
|
226
|
-
return
|
|
253
|
+
return topmostMHTMLNode;
|
|
227
254
|
}
|
|
228
255
|
|
|
229
256
|
setTokens(tokens) {
|
|
@@ -232,19 +259,19 @@ class View extends Element {
|
|
|
232
259
|
});
|
|
233
260
|
}
|
|
234
261
|
|
|
235
|
-
|
|
262
|
+
setTopmostHTMLNode(topmostMHTMLNode) {
|
|
236
263
|
this.updateState({
|
|
237
|
-
|
|
264
|
+
topmostMHTMLNode
|
|
238
265
|
});
|
|
239
266
|
}
|
|
240
267
|
|
|
241
268
|
setInitialState() {
|
|
242
269
|
const tokens = null,
|
|
243
|
-
|
|
270
|
+
topmostHTMLNode = null;
|
|
244
271
|
|
|
245
272
|
this.setState({
|
|
246
273
|
tokens,
|
|
247
|
-
|
|
274
|
+
topmostHTMLNode
|
|
248
275
|
});
|
|
249
276
|
}
|
|
250
277
|
|
|
@@ -266,10 +293,10 @@ class View extends Element {
|
|
|
266
293
|
onCustomPlainText={this.plainTextCustomHandler}
|
|
267
294
|
/>
|
|
268
295
|
<PageButtonsDiv onCustomPageUpdate={this.pageUpdateCustomHandler} />
|
|
269
|
-
<CSSContainerDiv/>
|
|
270
296
|
<HTMLContainerDiv/>
|
|
271
297
|
<PreviewContainerDiv/>
|
|
272
298
|
<PlainTextContainerDiv/>
|
|
299
|
+
<CSSContainerDiv/>
|
|
273
300
|
<HTMLParseTreeTextarea/>
|
|
274
301
|
</RowsDiv>
|
|
275
302
|
</ColumnDiv>
|
|
@@ -298,17 +325,7 @@ class View extends Element {
|
|
|
298
325
|
|
|
299
326
|
static initialMarkdown = initialMarkdown;
|
|
300
327
|
|
|
301
|
-
static initialMarkdownStyle =
|
|
302
|
-
height: 100%;
|
|
303
|
-
font-size: 2rem;
|
|
304
|
-
|
|
305
|
-
blockListing {
|
|
306
|
-
colour: white;
|
|
307
|
-
text-align: left;
|
|
308
|
-
font-family: monospace;
|
|
309
|
-
background-colour: black;
|
|
310
|
-
}
|
|
311
|
-
`;
|
|
328
|
+
static initialMarkdownStyle = ``;
|
|
312
329
|
|
|
313
330
|
static tagName = "div";
|
|
314
331
|
|
|
@@ -327,22 +344,6 @@ export default withStyle(View)`
|
|
|
327
344
|
|
|
328
345
|
`;
|
|
329
346
|
|
|
330
|
-
function tokensFromContent(content) {
|
|
331
|
-
const tokens = markdownLexer.tokenise(content);
|
|
332
|
-
|
|
333
|
-
return tokens;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
function nodeFromTokens(tokens, startRuleName = null) {
|
|
337
|
-
const ruleMap = markdownParser.getRuleMap(),
|
|
338
|
-
startRule = (startRuleName !== null) ?
|
|
339
|
-
ruleMap[startRuleName] :
|
|
340
|
-
markdownParser.getStartRule(),
|
|
341
|
-
node = markdownParser.parse(tokens, startRule);
|
|
342
|
-
|
|
343
|
-
return node;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
347
|
function pathToURL(path) {
|
|
347
348
|
const url = `https://static.djalbat.com/${path}`;
|
|
348
349
|
|
package/src/index/list.js
CHANGED
|
@@ -4,7 +4,7 @@ import { stringUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import IndexItem from "../index/item";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { indexMapFromIndexDirectiveHTMLNodeAndDivisionHTMLNodes } from "../utilities/index";
|
|
8
8
|
|
|
9
9
|
const { strcmp } = stringUtilities;
|
|
10
10
|
|
|
@@ -31,8 +31,8 @@ export default class IndexList {
|
|
|
31
31
|
return result;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
static
|
|
35
|
-
const indexMap =
|
|
34
|
+
static fromIndexDirectiveHTMLNodeAndDivisionHTMLNodes(indexDirectiveHTMLNode, divisionHTMLNodes, context) {
|
|
35
|
+
const indexMap = indexMapFromIndexDirectiveHTMLNodeAndDivisionHTMLNodes(indexDirectiveHTMLNode, divisionHTMLNodes, context),
|
|
36
36
|
indexItems = indexItemsFromIndexMap(indexMap),
|
|
37
37
|
indexList = new IndexList(indexItems);
|
|
38
38
|
|
package/src/index.js
CHANGED
|
@@ -19,6 +19,6 @@ export { default as htmlNodeMap } from "./map/node/html";
|
|
|
19
19
|
export { default as classNameMap } from "./map/className";
|
|
20
20
|
export { default as MarkdownNode } from "./node/markdown";
|
|
21
21
|
export { default as markdownNodeMap } from "./map/node/markdown";
|
|
22
|
-
export { default as MarkdownStyleElement } from "./styleElement/markdown";
|
|
23
22
|
export { default as defaultMarkdownStyle } from "./defaultMarkdownStyle";
|
|
23
|
+
export { default as MarkdownStyleElement } from "./styleElement/markdown";
|
|
24
24
|
export { default as DefaultMarkdownStyleElement } from "./styleElement/markdown/default";
|