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.
Files changed (266) hide show
  1. package/example.js +10243 -6411
  2. package/lib/constants.js +9 -1
  3. package/lib/defaultMarkdownStyle.js +2 -2
  4. package/lib/example/importer.js +3 -3
  5. package/lib/example/indexOptions.js +1 -98
  6. package/lib/example/view/div/container/markdown.js +2 -2
  7. package/lib/example/view/div/container/markdownStyle.js +2 -2
  8. package/lib/example/view/div/container.js +2 -2
  9. package/lib/example/view/div/pageButtons.js +7 -4
  10. package/lib/example/view/div/preview.js +1 -5
  11. package/lib/example/view/div/sizeable/left.js +2 -2
  12. package/lib/example/view/div/tabButtons/right.js +5 -5
  13. package/lib/example/view/textarea/markdown.js +2 -2
  14. package/lib/example/view/textarea/markdownStyle.js +2 -2
  15. package/lib/example/view/textarea/parseTree/html.js +2 -2
  16. package/lib/example/view/textarea/plainText.js +1 -5
  17. package/lib/example/view/xmp.js +1 -5
  18. package/lib/example/view.js +51 -48
  19. package/lib/index/list.js +4 -4
  20. package/lib/index.js +2 -2
  21. package/lib/map/node/html.js +13 -7
  22. package/lib/map/node/markdown.js +5 -24
  23. package/lib/markdown/bnf.js +2 -2
  24. package/lib/node/html/anchor.js +49 -64
  25. package/lib/node/html/blockLine.js +23 -4
  26. package/lib/node/{markdown/paragraph.js → html/directive/contents.js} +20 -14
  27. package/lib/node/{markdown/strongText.js → html/directive/footnotes.js} +20 -14
  28. package/lib/node/{markdown/emphasisedText.js → html/directive/index.js} +20 -14
  29. package/lib/node/{markdown/inlineText.js → html/directive/pageNumber.js} +20 -14
  30. package/lib/node/html/division.js +118 -7
  31. package/lib/node/html/footnote.js +4 -10
  32. package/lib/node/html/heading/index.js +71 -10
  33. package/lib/node/html/heading/primary.js +8 -7
  34. package/lib/node/html/heading/quaternary.js +8 -7
  35. package/lib/node/html/heading/secondary.js +8 -7
  36. package/lib/node/html/heading/tertiary.js +8 -7
  37. package/lib/node/html/heading.js +165 -0
  38. package/lib/node/html/image.js +7 -6
  39. package/lib/node/html/item/contents.js +22 -8
  40. package/lib/node/html/item/footnote.js +144 -0
  41. package/lib/node/html/item/index.js +27 -43
  42. package/lib/node/html/line.js +55 -2
  43. package/lib/node/html/link/contents.js +34 -14
  44. package/lib/node/html/link/email.js +32 -8
  45. package/lib/node/html/link/footnote.js +95 -5
  46. package/lib/node/html/link/hyper.js +32 -8
  47. package/lib/node/html/link/index.js +66 -35
  48. package/lib/node/html/list/contents.js +22 -8
  49. package/lib/node/html/list/footnotes.js +39 -12
  50. package/lib/node/html/list/index.js +22 -8
  51. package/lib/node/html/pageNumber.js +70 -23
  52. package/lib/node/html/{item/footnotes.js → reference.js} +14 -14
  53. package/lib/node/{markdown/heading/primary.js → html/text/comma.js} +38 -28
  54. package/lib/node/html/text/index.js +146 -0
  55. package/lib/node/html/text/stronglyEmphasised.js +15 -8
  56. package/lib/node/html/text.js +43 -5
  57. package/lib/node/html/topmost.js +67 -1
  58. package/lib/node/html.js +77 -4
  59. package/lib/node/markdown/directive/{embee.js → embed.js} +1 -1
  60. package/lib/node/markdown/division.js +13 -22
  61. package/lib/node/markdown/link/footnote.js +5 -102
  62. package/lib/node/markdown/subDivision.js +2 -2
  63. package/lib/node/markdown/text/block.js +1 -1
  64. package/lib/node/markdown/text.js +25 -29
  65. package/lib/ruleNames.js +87 -81
  66. package/lib/style/selector.js +4 -4
  67. package/lib/{node/markdown/heading/tertiary.js → transform/html/directive/contents.js} +23 -28
  68. package/lib/{node/markdown/stronglyEmphasisedText.js → transform/html/directive/footnotes.js} +15 -14
  69. package/lib/{node/markdown/line.js → transform/html/directive/index.js} +19 -18
  70. package/lib/transform/html/directive/pageNumber.js +108 -0
  71. package/lib/transform/html/division.js +130 -0
  72. package/lib/transform/html/footnote.js +159 -0
  73. package/lib/transform/html/heading/index.js +109 -0
  74. package/lib/transform/html/index.js +159 -0
  75. package/lib/transform/{indexAnchor.js → html/indexAnchor.js} +20 -20
  76. package/lib/transform/html/item/contents.js +130 -0
  77. package/lib/transform/html/item/footnote.js +117 -0
  78. package/lib/transform/html/item/index.js +117 -0
  79. package/lib/transform/html/line.js +123 -0
  80. package/lib/transform/html/link/contents.js +130 -0
  81. package/lib/transform/html/link/footnote.js +158 -0
  82. package/lib/transform/html/link/nestedFootnote.js +108 -0
  83. package/lib/transform/html/list/contents.js +180 -0
  84. package/lib/transform/html/list/footnotes.js +117 -0
  85. package/lib/transform/html/list/index.js +118 -0
  86. package/lib/transform/html/pageNumber.js +117 -0
  87. package/lib/transform/html.js +168 -0
  88. package/lib/transform/markdown/directive/embed.js +14 -9
  89. package/lib/transform/markdown/directive/ignore.js +12 -38
  90. package/lib/transform/markdown/directive/include.js +11 -6
  91. package/lib/transform/markdown/subDivision.js +18 -50
  92. package/lib/transform/markdown.js +148 -0
  93. package/lib/utilities/contents.js +16 -16
  94. package/lib/utilities/division.js +247 -0
  95. package/lib/utilities/footnotes.js +8 -8
  96. package/lib/utilities/html.js +37 -79
  97. package/lib/utilities/index.js +23 -16
  98. package/lib/utilities/markdown.js +2 -10
  99. package/lib/utilities/string.js +16 -10
  100. package/lib/utilities/whitespace.js +33 -0
  101. package/package.json +6 -6
  102. package/src/constants.js +2 -0
  103. package/src/defaultMarkdownStyle.js +6 -9
  104. package/src/example/importer.js +11 -5
  105. package/src/example/indexOptions.js +0 -97
  106. package/src/example/view/div/container/markdown.js +1 -1
  107. package/src/example/view/div/container/markdownStyle.js +1 -1
  108. package/src/example/view/div/container.js +1 -1
  109. package/src/example/view/div/pageButtons.js +8 -2
  110. package/src/example/view/div/preview.js +0 -6
  111. package/src/example/view/div/sizeable/left.js +1 -1
  112. package/src/example/view/div/tabButtons/right.js +3 -3
  113. package/src/example/view/textarea/markdown.js +1 -0
  114. package/src/example/view/textarea/markdownStyle.js +1 -0
  115. package/src/example/view/textarea/parseTree/html.js +1 -1
  116. package/src/example/view/textarea/plainText.js +0 -6
  117. package/src/example/view/xmp.js +0 -6
  118. package/src/example/view.js +75 -74
  119. package/src/index/list.js +3 -3
  120. package/src/index.js +1 -1
  121. package/src/map/node/html.js +29 -11
  122. package/src/map/node/markdown.js +8 -65
  123. package/src/markdown/bnf.js +112 -149
  124. package/src/node/html/anchor.js +34 -43
  125. package/src/node/html/blockLine.js +33 -4
  126. package/src/node/html/directive/contents.js +9 -0
  127. package/src/node/html/directive/footnotes.js +9 -0
  128. package/src/node/html/directive/index.js +9 -0
  129. package/src/node/html/directive/pageNumber.js +9 -0
  130. package/src/node/html/division.js +154 -4
  131. package/src/node/html/footnote.js +1 -7
  132. package/src/node/html/heading/index.js +78 -2
  133. package/src/node/html/heading/primary.js +6 -4
  134. package/src/node/html/heading/quaternary.js +6 -4
  135. package/src/node/html/heading/secondary.js +6 -4
  136. package/src/node/html/heading/tertiary.js +6 -4
  137. package/src/node/html/heading.js +59 -0
  138. package/src/node/html/image.js +8 -5
  139. package/src/node/html/item/contents.js +25 -2
  140. package/src/node/html/item/footnote.js +39 -0
  141. package/src/node/html/item/index.js +35 -16
  142. package/src/node/html/line.js +41 -2
  143. package/src/node/html/link/contents.js +32 -5
  144. package/src/node/html/link/email.js +51 -17
  145. package/src/node/html/link/footnote.js +98 -2
  146. package/src/node/html/link/hyper.js +51 -17
  147. package/src/node/html/link/index.js +63 -30
  148. package/src/node/html/list/contents.js +25 -2
  149. package/src/node/html/list/footnotes.js +34 -2
  150. package/src/node/html/list/index.js +25 -2
  151. package/src/node/html/pageNumber.js +60 -16
  152. package/src/node/html/reference.js +13 -0
  153. package/src/node/html/text/comma.js +29 -0
  154. package/src/node/html/text/index.js +43 -0
  155. package/src/node/html/text/stronglyEmphasised.js +22 -11
  156. package/src/node/html/text.js +3 -3
  157. package/src/node/html/topmost.js +93 -1
  158. package/src/node/html.js +34 -6
  159. package/src/node/markdown/division.js +11 -227
  160. package/src/node/markdown/link/footnote.js +6 -82
  161. package/src/node/markdown/subDivision.js +1 -1
  162. package/src/node/markdown/text/block.js +1 -1
  163. package/src/node/markdown/text.js +38 -39
  164. package/src/ruleNames.js +11 -8
  165. package/src/style/selector.js +3 -4
  166. package/src/transform/html/directive/contents.js +19 -0
  167. package/src/transform/html/directive/footnotes.js +12 -0
  168. package/src/transform/html/directive/index.js +19 -0
  169. package/src/transform/html/directive/pageNumber.js +12 -0
  170. package/src/transform/html/division.js +33 -0
  171. package/src/transform/html/footnote.js +66 -0
  172. package/src/transform/html/heading/index.js +14 -0
  173. package/src/transform/html/index.js +77 -0
  174. package/src/transform/html/indexAnchor.js +24 -0
  175. package/src/transform/html/item/contents.js +48 -0
  176. package/src/transform/html/item/footnote.js +21 -0
  177. package/src/transform/html/item/index.js +21 -0
  178. package/src/transform/html/line.js +27 -0
  179. package/src/transform/html/link/contents.js +40 -0
  180. package/src/transform/html/link/footnote.js +58 -0
  181. package/src/transform/html/link/nestedFootnote.js +12 -0
  182. package/src/transform/html/list/contents.js +86 -0
  183. package/src/transform/html/list/footnotes.js +20 -0
  184. package/src/transform/html/list/index.js +27 -0
  185. package/src/transform/html/pageNumber.js +20 -0
  186. package/src/transform/html.js +78 -0
  187. package/src/transform/markdown/directive/embed.js +6 -7
  188. package/src/transform/markdown/directive/ignore.js +3 -9
  189. package/src/transform/markdown/directive/include.js +3 -3
  190. package/src/transform/markdown/subDivision.js +5 -17
  191. package/src/transform/markdown.js +9 -0
  192. package/src/utilities/contents.js +12 -12
  193. package/src/utilities/division.js +256 -0
  194. package/src/utilities/footnotes.js +5 -5
  195. package/src/utilities/html.js +39 -86
  196. package/src/utilities/index.js +26 -16
  197. package/src/utilities/markdown.js +0 -8
  198. package/src/utilities/string.js +5 -3
  199. package/src/utilities/whitespace.js +21 -0
  200. package/lib/node/markdown/anchor.js +0 -171
  201. package/lib/node/markdown/contentsItem.js +0 -112
  202. package/lib/node/markdown/directive/pageNumber.js +0 -163
  203. package/lib/node/markdown/heading/quaternary.js +0 -121
  204. package/lib/node/markdown/heading/secondary.js +0 -121
  205. package/lib/node/markdown/heading.js +0 -140
  206. package/lib/node/markdown/item/footnotes.js +0 -120
  207. package/lib/node/markdown/link/contents.js +0 -156
  208. package/lib/node/markdown/link/index.js +0 -117
  209. package/lib/node/markdown/list/contents.js +0 -112
  210. package/lib/node/markdown/list/footnotes.js +0 -165
  211. package/lib/node/markdown/list/index.js +0 -112
  212. package/lib/transform/contentsDirective.js +0 -112
  213. package/lib/transform/contentsItem.js +0 -134
  214. package/lib/transform/contentsLink.js +0 -115
  215. package/lib/transform/contentsList.js +0 -193
  216. package/lib/transform/footnote.js +0 -181
  217. package/lib/transform/footnoteIdentifier.js +0 -120
  218. package/lib/transform/footnotesDirective.js +0 -112
  219. package/lib/transform/footnotesItem.js +0 -123
  220. package/lib/transform/footnotesList.js +0 -172
  221. package/lib/transform/index.js +0 -166
  222. package/lib/transform/indexDirective.js +0 -112
  223. package/lib/transform/indexHeading.js +0 -104
  224. package/lib/transform/indexItem.js +0 -113
  225. package/lib/transform/indexList.js +0 -121
  226. package/lib/transform/line.js +0 -111
  227. package/lib/transform/pageNumberDirective.js +0 -112
  228. package/src/node/html/item/footnotes.js +0 -13
  229. package/src/node/markdown/anchor.js +0 -45
  230. package/src/node/markdown/contentsItem.js +0 -21
  231. package/src/node/markdown/directive/pageNumber.js +0 -34
  232. package/src/node/markdown/emphasisedText.js +0 -7
  233. package/src/node/markdown/heading/primary.js +0 -9
  234. package/src/node/markdown/heading/quaternary.js +0 -9
  235. package/src/node/markdown/heading/secondary.js +0 -9
  236. package/src/node/markdown/heading/tertiary.js +0 -9
  237. package/src/node/markdown/heading.js +0 -47
  238. package/src/node/markdown/inlineText.js +0 -7
  239. package/src/node/markdown/item/footnotes.js +0 -39
  240. package/src/node/markdown/line.js +0 -17
  241. package/src/node/markdown/link/contents.js +0 -31
  242. package/src/node/markdown/link/index.js +0 -18
  243. package/src/node/markdown/list/contents.js +0 -21
  244. package/src/node/markdown/list/footnotes.js +0 -45
  245. package/src/node/markdown/list/index.js +0 -21
  246. package/src/node/markdown/paragraph.js +0 -7
  247. package/src/node/markdown/strongText.js +0 -7
  248. package/src/node/markdown/stronglyEmphasisedText.js +0 -7
  249. package/src/transform/contentsDirective.js +0 -18
  250. package/src/transform/contentsItem.js +0 -55
  251. package/src/transform/contentsLink.js +0 -28
  252. package/src/transform/contentsList.js +0 -110
  253. package/src/transform/footnote.js +0 -51
  254. package/src/transform/footnoteIdentifier.js +0 -27
  255. package/src/transform/footnotesDirective.js +0 -18
  256. package/src/transform/footnotesItem.js +0 -25
  257. package/src/transform/footnotesList.js +0 -77
  258. package/src/transform/index.js +0 -90
  259. package/src/transform/indexAnchor.js +0 -27
  260. package/src/transform/indexDirective.js +0 -18
  261. package/src/transform/indexHeading.js +0 -18
  262. package/src/transform/indexItem.js +0 -29
  263. package/src/transform/indexList.js +0 -33
  264. package/src/transform/line.js +0 -19
  265. package/src/transform/pageNumberDirective.js +0 -18
  266. /package/src/node/markdown/directive/{embee.js → embed.js} +0 -0
@@ -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
- Another short paragraph with a reference to a footnote[^occam].
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
- @embed ${INSTALLING_THE_CLI_PATH}
89
- @embed ${GETTING_TO_GRIPS_WITH_THE_IDE_PATH}
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",
@@ -44,7 +44,7 @@ class MarkdownContainerDiv extends ContainerDiv {
44
44
  export default withStyle(MarkdownContainerDiv)`
45
45
 
46
46
  gap: 1rem;
47
- height: 65rem;
47
+ height: 97rem;
48
48
  display: flex;
49
49
  flex-direction: column;
50
50
  justify-content: space-between;
@@ -46,7 +46,7 @@ class MarkdownStyleContainerDiv extends ContainerDiv {
46
46
  export default withStyle(MarkdownStyleContainerDiv)`
47
47
 
48
48
  gap: 1rem;
49
- height: 65rem;
49
+ height: 97rem;
50
50
  display: flex;
51
51
  flex-direction: column;
52
52
  justify-content: space-between;
@@ -23,7 +23,7 @@ class ContainerDiv extends Element {
23
23
  export default withStyle(ContainerDiv)`
24
24
 
25
25
  border: 1px solid black;
26
- height: 32rem;
26
+ height: 48rem;
27
27
  padding: 1rem;
28
28
  overflow: hidden;
29
29
  border-top: 0;
@@ -50,7 +50,13 @@ class PageButtonsDiv extends Element {
50
50
  return pageButtons;
51
51
  }
52
52
 
53
- update(length, index = 0) {
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
 
@@ -12,7 +12,7 @@ class LeftSizeableDiv extends SizeableDiv {
12
12
 
13
13
  export default withStyle(LeftSizeableDiv)`
14
14
 
15
- width: 80rem;
15
+ width: 96rem;
16
16
  min-width: 12rem;
17
17
  flex-direction: column;
18
18
 
@@ -76,7 +76,7 @@ class RightTabButtonsDiv extends TabButtonsDiv {
76
76
  }
77
77
 
78
78
  didMount() {
79
- this.css();
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
  }
@@ -36,6 +36,7 @@ class MarkdownTextarea extends Textarea {
36
36
 
37
37
  export default withStyle(MarkdownTextarea)`
38
38
 
39
+ height: 32em;
39
40
  resize: vertical;
40
41
  min-height: 12rem;
41
42
 
@@ -36,6 +36,7 @@ class MarkdownStyleTextarea extends Textarea {
36
36
 
37
37
  export default withStyle(MarkdownStyleTextarea)`
38
38
 
39
+ height: 32em;
39
40
  resize: vertical;
40
41
  min-height: 12rem;
41
42
 
@@ -23,6 +23,6 @@ class HTMLParseTreeTextarea extends ParseTreeTextarea {
23
23
  export default withStyle(HTMLParseTreeTextarea)`
24
24
 
25
25
  margin-top: 1rem;
26
- height: 32rem;
26
+ height: 48rem;
27
27
 
28
28
  `;
@@ -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);
@@ -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
 
@@ -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.clearPage();
36
+ this.updateMarkdown();
36
37
 
37
- this.updatePage(index);
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
- this.updatePage();
69
+
70
+ this.updateHTML();
68
71
  }
69
72
 
70
- clearPage() {
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
- updatePage(index = 0) {
77
- const tokens = this.getTokens(),
78
- topmostMarkdownNode = this.getTopmostMarkdownNode(),
79
- topmostHTMLNode = htmlNodeFromMarkdownNode(topmostMarkdownNode),
80
- divisionHTMLNOde = topmostHTMLNode.getDivisionHTMLNodeAt(index),
81
- context = {
82
- tokens,
83
- pathToURL
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.resetTopmostMarkdownNode();
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
- const topmostMarkdownNode = node, ///
125
- context = {
126
- tokens,
127
- importer,
128
- nodeFromTokens,
129
- tokensFromContent
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 parseTree = topmostMarkdownNode.asParseTree(tokens),
135
- markdownParseTree = parseTree; ///
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.setTopmostMarkdownNode(topmostMarkdownNode);
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
- resetTopmostMarkdownNode() {
212
- const topmostMarkdownNode = null;
238
+ resetTopmostHTMLNode() {
239
+ const topmostHTMLNode = null;
213
240
 
214
- this.setTopmostMarkdownNode(topmostMarkdownNode);
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
- getTopmostMarkdownNode() {
224
- const { topmostMarkdownNode } = this.getState();
250
+ getTopmostHTMLNode() {
251
+ const { topmostMHTMLNode } = this.getState();
225
252
 
226
- return topmostMarkdownNode;
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
- setTopmostMarkdownNode(topmostMarkdownNode) {
262
+ setTopmostHTMLNode(topmostMHTMLNode) {
236
263
  this.updateState({
237
- topmostMarkdownNode
264
+ topmostMHTMLNode
238
265
  });
239
266
  }
240
267
 
241
268
  setInitialState() {
242
269
  const tokens = null,
243
- topmostMarkdownNode = null;
270
+ topmostHTMLNode = null;
244
271
 
245
272
  this.setState({
246
273
  tokens,
247
- topmostMarkdownNode
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 = `width: 100%;
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 { indexMapFromDivisionMarkdownNodes } from "../utilities/index";
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 fromDivisionMarkdownNodes(divisionMarkdownNodes, context) {
35
- const indexMap = indexMapFromDivisionMarkdownNodes(divisionMarkdownNodes, context),
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";