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
@@ -2,314 +2,277 @@
2
2
 
3
3
  const bnf = `
4
4
 
5
- markdown ::= ( division | error )+ ;
5
+ markdown ::= ( division | error )+ ;
6
6
 
7
7
 
8
- division ::= ( subDivision | verticalSpace )+ ;
8
+ division ::= ( subDivision | verticalSpace )+ ;
9
9
 
10
10
 
11
- subDivision ::= directives
11
+ subDivision.. ::= directives
12
12
 
13
- | primaryHeading
13
+ | primaryHeading
14
14
 
15
- | secondaryHeading
15
+ | secondaryHeading
16
16
 
17
- | tertiaryHeading
17
+ | tertiaryHeading
18
18
 
19
- | quaternaryHeading
19
+ | quaternaryHeading
20
20
 
21
- | table
21
+ | table
22
22
 
23
- | footnote
23
+ | footnote
24
24
 
25
- | orderedList
25
+ | orderedList
26
26
 
27
- | unorderedList
27
+ | unorderedList
28
28
 
29
- | blockListing
29
+ | blockListing
30
30
 
31
- | paragraph
31
+ | paragraph
32
32
 
33
- ;
33
+ ;
34
34
 
35
35
 
36
- verticalSpace. ::= <END_OF_LINE>+ ;
36
+ verticalSpace ::= <END_OF_LINE>+ ;
37
37
 
38
38
 
39
- error. ::= . ;
39
+ error. ::= . ;
40
40
 
41
41
 
42
- directives ::= indexDirective
42
+ directives ::= indexDirective
43
43
 
44
- | ignoreDirective
44
+ | ignoreDirective
45
45
 
46
- | contentsDirective
46
+ | contentsDirective
47
47
 
48
- | footnotesDirective
48
+ | footnotesDirective
49
49
 
50
- | pageNumberDirective
50
+ | pageNumberDirective
51
51
 
52
- | embedDirective ( endOfLine embedDirective )*
52
+ | embedDirective ( endOfLine embedDirective )*
53
53
 
54
- | includeDirective ( endOfLine includeDirective )*
54
+ | includeDirective ( endOfLine includeDirective )*
55
55
 
56
56
  ;
57
57
 
58
58
 
59
- primaryHeading. ::= "#" line ;
59
+ primaryHeading ::= "#" line ;
60
60
 
61
61
 
62
- secondaryHeading. ::= "##" line ;
62
+ secondaryHeading ::= "##" line ;
63
63
 
64
64
 
65
- tertiaryHeading. ::= "###" line ;
65
+ tertiaryHeading ::= "###" line ;
66
66
 
67
67
 
68
- quaternaryHeading. ::= "####" line ;
68
+ quaternaryHeading ::= "####" line ;
69
69
 
70
70
 
71
- table ::= tableHead endOfLine tableDivider endOfLine tableBody ;
71
+ table ::= tableHead endOfLine tableDivider endOfLine tableBody ;
72
72
 
73
73
 
74
- footnote. ::= reference paragraph ;
74
+ footnote. ::= reference paragraph ;
75
75
 
76
76
 
77
- orderedList ::= orderedItem ( endOfLine orderedItem )* ;
77
+ orderedList ::= orderedItem ( endOfLine orderedItem )* ;
78
78
 
79
79
 
80
- unorderedList ::= unorderedItem ( endOfLine unorderedItem )* ;
80
+ unorderedList ::= unorderedItem ( endOfLine unorderedItem )* ;
81
81
 
82
82
 
83
- blockListing ::= blockStart blockLine* blockEnd ;
83
+ blockListing ::= blockStart blockLine* blockEnd ;
84
84
 
85
85
 
86
- paragraph ::= line ( endOfLine line )* ;
86
+ paragraph ::= line ( endOfLine line )* ;
87
87
 
88
88
 
89
- indexDirective ::= "@index" ;
89
+ indexDirective ::= "@index" ;
90
90
 
91
91
 
92
- ignoreDirective ::= "@ignore" ;
92
+ ignoreDirective ::= "@ignore" ;
93
93
 
94
94
 
95
- embedDirective. ::= "@embed" ( path | nonsense ) ;
95
+ embedDirective ::= "@embed" ( path | nonsense ) ;
96
96
 
97
97
 
98
- includeDirective. ::= "@include" ( path | nonsense ) ;
98
+ includeDirective ::= "@include" ( path | nonsense ) ;
99
99
 
100
100
 
101
- contentsDirective ::= "@contents" ;
101
+ contentsDirective ::= "@contents" ;
102
102
 
103
103
 
104
- footnotesDirective ::= "@footnotes" ;
104
+ footnotesDirective ::= "@footnotes" ;
105
105
 
106
106
 
107
- pageNumberDirective ::= "@pageNumber" ;
107
+ pageNumberDirective ::= "@pageNumber" ;
108
108
 
109
109
 
110
- nonsense ::= ( [escaped] | [number] | [identifier] | [word] | [special] | [unassigned] )+ ;
110
+ nonsense ::= ( [escaped] | [number] | [identifier] | [word] | [special] | [unassigned] )+ ;
111
111
 
112
112
 
113
- tableHead ::= tableHeadRow ;
113
+ tableHead ::= tableHeadRow ;
114
114
 
115
115
 
116
- tableBody ::= tableBodyRow ( endOfLine tableBodyRow )* ;
116
+ tableBody ::= tableBodyRow ( endOfLine tableBodyRow )* ;
117
117
 
118
118
 
119
- orderedItem ::= [marker] line ( endOfLine line )* ;
119
+ orderedItem ::= [marker] line ( endOfLine line )* ;
120
120
 
121
121
 
122
- unorderedItem ::= [bullet] line ( endOfLine line )* ;
122
+ unorderedItem ::= [bullet] line ( endOfLine line )* ;
123
123
 
124
124
 
125
- blockLine. ::= blockText* endOfLine ;
125
+ blockLine. ::= blockText* endOfLine ;
126
126
 
127
127
 
128
- tableHeadRow ::= tableCellDivider tableHeadCell+ ;
128
+ tableHeadRow ::= tableCellDivider tableHeadCell+ ;
129
129
 
130
130
 
131
- tableBodyRow ::= tableCellDivider tableBodyCell+ ;
131
+ tableBodyRow ::= tableCellDivider tableBodyCell+ ;
132
132
 
133
133
 
134
- tableHeadCell. ::= emptyTableCell
134
+ tableHeadCell ::= emptyTableCell
135
135
 
136
- | tableCell
136
+ | tableCell
137
137
 
138
- ;
138
+ ;
139
139
 
140
140
 
141
- tableBodyCell. ::= emptyTableCell
141
+ tableBodyCell ::= emptyTableCell
142
142
 
143
- | tableCell
143
+ | tableCell
144
144
 
145
- ;
145
+ ;
146
146
 
147
147
 
148
- emptyTableCell ::= "." tableCellDivider ;
148
+ emptyTableCell ::= "." tableCellDivider ;
149
149
 
150
150
 
151
- tableCell ::= line tableCellDivider ;
151
+ tableCell ::= line tableCellDivider ;
152
152
 
153
153
 
154
- contentsList ::= contentsItem+ ;
155
-
156
-
157
- contentsItem ::= contentsLink
154
+ line ::= ( inlineListing
158
155
 
159
- | contentsLink? contentsList
160
-
161
- ;
162
-
163
-
164
- contentsLink ::= line ;
165
-
166
-
167
- footnotesList ::= footnotesItem+ ;
168
-
169
-
170
- footnotesItem ::= anchor paragraph ;
171
-
172
-
173
- indexHeading ::= line ;
174
-
175
-
176
- indexList ::= indexItem+ ;
177
-
178
-
179
- indexItem ::= line... comma indexLink ( comma indexLink )* ;
180
-
181
-
182
- line. ::= ( inlineListing
183
-
184
- | footnoteLink
156
+ | footnoteLink
185
157
 
186
- | emailLink
158
+ | emailLink
187
159
 
188
- | hyperlink
160
+ | hyperlink
189
161
 
190
- | image
162
+ | image
191
163
 
192
- | plainText
164
+ | plainText
193
165
 
194
- | strongText
166
+ | strongText
195
167
 
196
- | emphasisedText
168
+ | emphasisedText
197
169
 
198
- | stronglyEmphasisedText )+ ;
170
+ | stronglyEmphasisedText )+ ;
199
171
 
200
172
 
201
- emailLink. ::= "[" inlineText... "]"<NO_WHITESPACE>"(" [email-address] ")"
173
+ footnoteLink. ::= [link] ;
174
+
175
+
176
+ emailLink. ::= "[" inlineText... "]"<NO_WHITESPACE>"(" [email-address] ")"
202
177
 
203
- | [email-address]
178
+ | [email-address]
204
179
 
205
- ;
180
+ ;
206
181
 
207
182
 
208
- hyperlink. ::= "[" inlineText... "]"<NO_WHITESPACE>"(" [url] ")"
183
+ hyperlink. ::= "[" inlineText... "]"<NO_WHITESPACE>"(" [url] ")"
209
184
 
210
- | [url]
185
+ | [url]
211
186
 
212
- ;
187
+ ;
213
188
 
214
189
 
215
- image. ::= "![" inlineText... "]"<NO_WHITESPACE>"(" path ")" ;
190
+ image. ::= "![" inlineText... "]"<NO_WHITESPACE>"(" path ")" ;
216
191
 
217
192
 
218
- inlineText ::= plainText+ ;
219
-
220
-
221
- strongText ::= "***" inlineText "***" ;
193
+ strongText ::= "***" inlineText "***" ;
222
194
 
223
195
 
224
- emphasisedText ::= "**" inlineText "**" ;
196
+ emphasisedText ::= "**" inlineText "**" ;
225
197
 
226
198
 
227
- stronglyEmphasisedText ::= "****" inlineText "****" ;
199
+ stronglyEmphasisedText. ::= "****" inlineText "****" ;
228
200
 
229
201
 
230
- className ::= <NO_WHITESPACE>[identifier] ;
202
+ inlineText. ::= plainText+ ;
203
+
204
+
205
+ className ::= <NO_WHITESPACE>[identifier] ;
231
206
 
232
207
 
233
- blockStart ::= [backticks] className? <END_OF_LINE> ;
234
-
208
+ blockStart ::= [backticks] className? <END_OF_LINE> ;
235
209
 
236
- blockEnd ::= [backticks] ;
237
210
 
211
+ blockEnd ::= [backticks] ;
238
212
 
239
- footnoteLink. ::= [link] ;
240
-
241
213
 
242
- tableCellDivider ::= [vertical-bar] ;
214
+ tableCellDivider ::= [vertical-bar] ;
243
215
 
244
216
 
245
- tableDivider ::= [dashes] ;
217
+ tableDivider ::= [dashes] ;
246
218
 
247
219
 
248
- plainText ::= [escaped]
220
+ plainText. ::= [escaped]
249
221
 
250
- | [number]
222
+ | [number]
251
223
 
252
- | [identifier]
224
+ | [identifier]
253
225
 
254
- | [email-address]
226
+ | [email-address]
255
227
 
256
- | [url]
228
+ | [url]
257
229
 
258
- | [path]
230
+ | [path]
259
231
 
260
- | [word]
232
+ | [word]
261
233
 
262
- | [special]
234
+ | [special]
263
235
 
264
- | [unassigned]
236
+ | [unassigned]
265
237
 
266
- ;
238
+ ;
267
239
 
268
240
 
269
- blockText ::= [escaped]
241
+ blockText. ::= [escaped]
270
242
 
271
- | [number]
243
+ | [number]
272
244
 
273
- | [identifier]
245
+ | [identifier]
274
246
 
275
- | [email-address]
247
+ | [email-address]
276
248
 
277
- | [url]
249
+ | [url]
278
250
 
279
- | [path]
251
+ | [path]
280
252
 
281
- | [word]
253
+ | [word]
282
254
 
283
- | [special]
255
+ | [special]
284
256
 
285
- | [unassigned]
257
+ | [unassigned]
286
258
 
287
- | [dashes]
259
+ | [dashes]
288
260
 
289
- | [vertical-bar]
261
+ | [vertical-bar]
290
262
 
291
- ;
263
+ ;
292
264
 
293
265
 
294
- inlineListing ::= [backticked-literal] ;
266
+ inlineListing. ::= [backticked-literal] ;
295
267
 
296
268
 
297
- reference. ::= [reference] ;
269
+ reference ::= [reference] ;
298
270
 
299
271
 
300
- indexLink ::= [number] ;
301
-
302
-
303
- path ::= [path] ;
272
+ path ::= [path] ;
304
273
 
305
274
 
306
- comma. ::= "," ;
307
-
308
-
309
- anchor. ::= ε ;
310
-
311
-
312
- endOfLine. ::= <END_OF_LINE> ;
275
+ endOfLine ::= <END_OF_LINE> ;
313
276
 
314
277
  `;
315
278
 
@@ -2,73 +2,64 @@
2
2
 
3
3
  import HTMLNode from "../../node/html";
4
4
 
5
+ import { EMPTY_STRING } from "../../constants";
6
+ import { ANCHOR_RULE_NAME } from "../../ruleNames";
5
7
  import { ID_ATTRIBUTE_NAME } from "../../attributeNames";
6
8
 
7
9
  export default class AnchorHTMLNode extends HTMLNode {
8
- attributeName(context) {
9
- const attributeName = ID_ATTRIBUTE_NAME;
10
+ constructor(outerNode, parentNode, childNodes, domElement, prepend, identifier) {
11
+ super(outerNode, parentNode, childNodes, domElement);
10
12
 
11
- return attributeName;
13
+ this.prepend = prepend;
14
+ this.identifier = identifier;
12
15
  }
13
16
 
14
- attributeValue(context) {
15
- const attributeValue = `${this.prepend}-${this.identifier}`;
16
-
17
- return attributeValue;
17
+ getPrepend() {
18
+ return this.prepend;
18
19
  }
19
20
 
20
- asHTML(indent, context) {
21
- if (context === undefined) {
22
- context = indent; ///
23
-
24
- indent = null;
25
- }
26
-
27
- indent = this.adjustIndent(indent);
21
+ getIdentifier() {
22
+ return this.identifier;
23
+ }
28
24
 
29
- const childNodesHTML = this.childNodesAsHTML(indent, context),
30
- startingTag = this.startingTag(context),
31
- closingTag = this.closingTag(context),
32
- html = (indent === null) ?
33
- `${startingTag}${childNodesHTML}${closingTag}` :
34
- `${indent}${startingTag}
35
- ${childNodesHTML}${indent}${closingTag}
36
- `;
25
+ getRuleName() {
26
+ const ruleName = ANCHOR_RULE_NAME; ///
37
27
 
38
- return html;
28
+ return ruleName;
39
29
  }
40
30
 
41
- createDOMElement(context) {
42
- let domElement;
31
+ content(context) {
32
+ const content = EMPTY_STRING;
43
33
 
44
- const content = this.content(context),
45
- textNode = document.createTextNode(content);
34
+ return content;
35
+ }
46
36
 
47
- domElement = super.createDOMElement(context)
37
+ attributeName(context) {
38
+ const attributeName = ID_ATTRIBUTE_NAME;
48
39
 
49
- const parentDOMElement = domElement; ///
40
+ return attributeName;
41
+ }
50
42
 
51
- domElement = textNode; ///
43
+ attributeValue(context) {
44
+ const attributeValue = `#${this.prepend}-${this.identifier}`; ///
52
45
 
53
- parentDOMElement.appendChild(domElement);
46
+ return attributeValue;
47
+ }
54
48
 
55
- domElement = parentDOMElement; ///
49
+ asString() {
50
+ const ruleName = this.getRuleName(),
51
+ string = ruleName; ///
56
52
 
57
- return domElement;
53
+ return string;
58
54
  }
59
55
 
60
- // childNodesAsHTML(indent, context) {
61
- // const content = this.content(context),
62
- // childNodesHTML = content; ///
63
- //
64
- // return childNodesHTML;
65
- // }
66
-
67
56
  static tagName = "a";
68
57
 
69
58
  static className = "anchor";
70
59
 
71
- static fromNothing() { return HTMLNode.fromNothing(AnchorHTMLNode); }
60
+ static fromPrependAndIdentifier(prepend, identifier) {
61
+ const anchorHTMLNode = HTMLNode.fromNothing(AnchorHTMLNode, prepend, identifier);
72
62
 
73
- static fromOuterNode(outerNode) { return HTMLNode.fromOuterNode(AnchorHTMLNode, outerNode); }
63
+ return anchorHTMLNode;
64
+ }
74
65
  }
@@ -2,26 +2,33 @@
2
2
 
3
3
  import HTMLNode from "../../node/html";
4
4
 
5
+ import { assignIndexes, deleteIndexes } from "../../utilities/whitespace";
5
6
  import { EMPTY_STRING, CARRIAGE_RETURN } from "../../constants";
6
7
 
7
8
  export default class BlockLineHTMLNode extends HTMLNode {
8
9
  mount(parentDOMElement, siblingDOMElement, context) {
10
+ const node = this; ///
11
+
12
+ assignIndexes(node, context);
13
+
9
14
  super.mount(parentDOMElement, siblingDOMElement, context);
10
15
 
11
16
  let domElement;
12
17
 
13
18
  domElement = this.getDOMElement();
14
19
 
15
- parentDOMElement = domElement;
20
+ parentDOMElement = domElement; ///
16
21
 
17
22
  siblingDOMElement = null;
18
23
 
19
24
  const content = CARRIAGE_RETURN,
20
25
  textNode = document.createTextNode(content);
21
26
 
22
- domElement = textNode;
27
+ domElement = textNode; ///
23
28
 
24
- parentDOMElement.insertBefore(domElement, siblingDOMElement)
29
+ parentDOMElement.insertBefore(domElement, siblingDOMElement);
30
+
31
+ deleteIndexes(context);
25
32
  }
26
33
 
27
34
  unmount(parentDOMElement, context) {
@@ -54,8 +61,28 @@ export default class BlockLineHTMLNode extends HTMLNode {
54
61
  return html;
55
62
  }
56
63
 
64
+ childNodesAsHTML(indent, context) {
65
+ let childNodesHTML;
66
+
67
+ const node = this; ///
68
+
69
+ assignIndexes(node, context);
70
+
71
+ childNodesHTML = super.childNodesAsHTML(indent, context);
72
+
73
+ deleteIndexes(context);
74
+
75
+ return childNodesHTML;
76
+ }
77
+
57
78
  childNodesAsPlainText(context) {
58
- const childNodesPlainText = this.reduceChildNode((childNodesPlainText, childNode) => {
79
+ let childNodesPlainText;
80
+
81
+ const node = this; ///
82
+
83
+ assignIndexes(node, context);
84
+
85
+ childNodesPlainText = this.reduceChildNode((childNodesPlainText, childNode) => {
59
86
  const childNodePlainText = childNode.asPlainText(context);
60
87
 
61
88
  childNodesPlainText = `${childNodesPlainText}${childNodePlainText}`;
@@ -63,6 +90,8 @@ export default class BlockLineHTMLNode extends HTMLNode {
63
90
  return childNodesPlainText;
64
91
  }, EMPTY_STRING);
65
92
 
93
+ deleteIndexes(context);
94
+
66
95
  return childNodesPlainText;
67
96
  }
68
97
 
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ import HTMLNode from "../../../node/html";
4
+
5
+ export default class ContentsDirectiveHTMLNode extends HTMLNode {
6
+ static fromNothing() { return HTMLNode.fromNothing(ContentsDirectiveHTMLNode); }
7
+
8
+ static fromOuterNode(outerNode) { return HTMLNode.fromOuterNode(ContentsDirectiveHTMLNode, outerNode); }
9
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ import HTMLNode from "../../../node/html";
4
+
5
+ export default class FootnotesDirectiveHTMLNode extends HTMLNode {
6
+ static fromNothing() { return HTMLNode.fromNothing(FootnotesDirectiveHTMLNode); }
7
+
8
+ static fromOuterNode(outerNode) { return HTMLNode.fromOuterNode(FootnotesDirectiveHTMLNode, outerNode); }
9
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ import HTMLNode from "../../../node/html";
4
+
5
+ export default class IndexDirectiveHTMLNode extends HTMLNode {
6
+ static fromNothing() { return HTMLNode.fromNothing(IndexDirectiveHTMLNode); }
7
+
8
+ static fromOuterNode(outerNode) { return HTMLNode.fromOuterNode(IndexDirectiveHTMLNode, outerNode); }
9
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ import HTMLNode from "../../../node/html";
4
+
5
+ export default class PageNumberDirectiveHTMLNode extends HTMLNode {
6
+ static fromNothing() { return HTMLNode.fromNothing(PageNumberDirectiveHTMLNode); }
7
+
8
+ static fromOuterNode(outerNode) { return HTMLNode.fromOuterNode(PageNumberDirectiveHTMLNode, outerNode); }
9
+ }