highmark-markdown 0.0.4 → 0.0.6
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 +159 -60
- package/lib/constants.js +4 -13
- package/lib/example/view/xmp.js +2 -2
- package/lib/example/view.js +2 -2
- package/lib/markdown/bnf.js +2 -2
- package/lib/markdown/entries.js +2 -17
- package/lib/node/markdown/emptyTableCell.js +134 -0
- package/lib/nodeMap.js +3 -2
- package/lib/ruleNames.js +6 -1
- package/lib/tokenTypes.js +2 -27
- package/package.json +1 -1
- package/src/constants.js +0 -1
- package/src/example/view/xmp.js +1 -0
- package/src/example/view.js +3 -7
- package/src/markdown/bnf.js +9 -6
- package/src/markdown/entries.js +1 -16
- package/src/node/markdown/emptyTableCell.js +17 -0
- package/src/nodeMap.js +3 -0
- package/src/ruleNames.js +2 -0
- package/src/tokenTypes.js +1 -11
package/src/example/view.js
CHANGED
|
@@ -107,13 +107,9 @@ class View extends Element {
|
|
|
107
107
|
this.update();
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
static initialMarkdown =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Another paragraph!
|
|
114
|
-
|
|
115
|
-
And yet another'
|
|
116
|
-
\`\`\`
|
|
110
|
+
static initialMarkdown = `|. |
|
|
111
|
+
------
|
|
112
|
+
|[Body]|
|
|
117
113
|
`;
|
|
118
114
|
|
|
119
115
|
static tagName = "div";
|
package/src/markdown/bnf.js
CHANGED
|
@@ -77,28 +77,31 @@ const bnf = `
|
|
|
77
77
|
tableBodyRow ::= [vertical-bar] tableBodyCell+ endOfLine ;
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
tableHeadCell! ::= tableCell ;
|
|
80
|
+
tableHeadCell! ::= emptyTableCell | tableCell ;
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
tableBodyCell! ::= tableCell ;
|
|
83
|
+
tableBodyCell! ::= emptyTableCell | tableCell ;
|
|
84
84
|
|
|
85
85
|
|
|
86
|
+
emptyTableCell ::= "." [vertical-bar];
|
|
87
|
+
|
|
88
|
+
|
|
86
89
|
tableCell ::= ( link | hyperlink | inlineListing | stronglyEmphasisedText | emphasisedText | strongText | text )+ [vertical-bar] ;
|
|
87
90
|
|
|
88
91
|
|
|
89
92
|
line! ::= ( link | image | hyperlink | inlineListing | stronglyEmphasisedText | emphasisedText | strongText | text )+ endOfLine ;
|
|
90
93
|
|
|
91
94
|
|
|
92
|
-
link! ::= [
|
|
95
|
+
link! ::= "[^" [identifier] "]" ;
|
|
93
96
|
|
|
94
97
|
|
|
95
|
-
image ::= [
|
|
98
|
+
image ::= "![" inlineText... "]"<NO_WHITESPACE>"(" url ")" ;
|
|
96
99
|
|
|
97
100
|
|
|
98
|
-
hyperlink ::= [
|
|
101
|
+
hyperlink ::= "[" inlineText... "]"<NO_WHITESPACE>"(" url ")" ;
|
|
99
102
|
|
|
100
103
|
|
|
101
|
-
reference! ::= [
|
|
104
|
+
reference! ::= "[^" [identifier] "]:" ;
|
|
102
105
|
|
|
103
106
|
|
|
104
107
|
inlineListing ::= [backtick] inlineText... [backtick] ;
|
package/src/markdown/entries.js
CHANGED
|
@@ -4,21 +4,6 @@ const entries = [
|
|
|
4
4
|
{
|
|
5
5
|
"escaped": "^\\\\[^\\s]"
|
|
6
6
|
},
|
|
7
|
-
{
|
|
8
|
-
"exclamation-mark-open-square-bracket": "^!\\["
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"close-square-bracket-colon": "^\\]:"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"open-square-bracket-caret": "^\\[\\^"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"close-square-bracket": "^\\]"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"open-square-bracket": "^\\["
|
|
21
|
-
},
|
|
22
7
|
{
|
|
23
8
|
"triple-asterisk": "^\\*\\*\\*"
|
|
24
9
|
},
|
|
@@ -74,7 +59,7 @@ const entries = [
|
|
|
74
59
|
"word": "^\\w+"
|
|
75
60
|
},
|
|
76
61
|
{
|
|
77
|
-
"special": "^\\.\\.\\.|\\.|\\?|\\(|\\)|\\^|\\/|-|@|,|!|;|:|`|'|\""
|
|
62
|
+
"special": "^\\.\\.\\.|\\.|\\?|\\(|\\)|!\\[|\\[\\^|\\]:|\\[|\\]|\\^|\\/|-|@|,|!|;|:|`|'|\""
|
|
78
63
|
},
|
|
79
64
|
{
|
|
80
65
|
"unassigned": "^[^\\s]+"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import MarkdownNode from "../../node/markdown";
|
|
4
|
+
|
|
5
|
+
export default class EmptyTableCellMarkdownNode extends MarkdownNode {
|
|
6
|
+
childNodesAsHTML(indent, context) {
|
|
7
|
+
const childNodesHTML = null;
|
|
8
|
+
|
|
9
|
+
return childNodesHTML;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
createChildNodeDOMElements(domElement, context) {
|
|
13
|
+
///
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static fromRuleNameChildNodesAndAmbiguous(ruleName, childNodes, ambiguous) { return MarkdownNode.fromRuleNameChildNodesAndAmbiguous(EmptyTableCellMarkdownNode, ruleName, childNodes, ambiguous); }
|
|
17
|
+
}
|
package/src/nodeMap.js
CHANGED
|
@@ -36,6 +36,7 @@ import TableBodyCellMarkdownNode from "./node/markdown/tableBodyCell";
|
|
|
36
36
|
import TableSeparatorMarkdownNode from "./node/markdown/tableSeparator";
|
|
37
37
|
import EmphasisedTextMarkdownNode from "./node/markdown/emphasisedText";
|
|
38
38
|
import PrimaryHeadingMarkdownNode from "./node/markdown/primaryHeading";
|
|
39
|
+
import EmptyTableCellMarkdownNode from "./node/markdown/emptyTableCell";
|
|
39
40
|
import TertiaryHeadingMarkdownNode from "./node/markdown/tertiaryHeading";
|
|
40
41
|
import OrderedListItemMarkdownNode from "./node/markdown/orderedListItem";
|
|
41
42
|
import BlockListingEndMarkdownNode from "./node/markdown/blockListingEnd";
|
|
@@ -81,6 +82,7 @@ import { URL_RULE_NAME,
|
|
|
81
82
|
TABLE_SEPARATOR_RULE_NAME,
|
|
82
83
|
EMPHASISED_TEXT_RULE_NAME,
|
|
83
84
|
PRIMARY_HEADING_RULE_NAME,
|
|
85
|
+
EMPTY_TABLE_CELL_RULE_NAME,
|
|
84
86
|
TERTIARY_HEADING_RULE_NAME,
|
|
85
87
|
ORDERED_LIST_ITEM_RULE_NAME,
|
|
86
88
|
BLOCK_LISTING_END_RULE_NAME,
|
|
@@ -127,6 +129,7 @@ const nodeMap = {
|
|
|
127
129
|
[TABLE_SEPARATOR_RULE_NAME]: TableSeparatorMarkdownNode,
|
|
128
130
|
[EMPHASISED_TEXT_RULE_NAME]: EmphasisedTextMarkdownNode,
|
|
129
131
|
[PRIMARY_HEADING_RULE_NAME]: PrimaryHeadingMarkdownNode,
|
|
132
|
+
[EMPTY_TABLE_CELL_RULE_NAME]: EmptyTableCellMarkdownNode,
|
|
130
133
|
[TERTIARY_HEADING_RULE_NAME]: TertiaryHeadingMarkdownNode,
|
|
131
134
|
[ORDERED_LIST_ITEM_RULE_NAME]: OrderedListItemMarkdownNode,
|
|
132
135
|
[BLOCK_LISTING_END_RULE_NAME]: BlockListingEndMarkdownNode,
|
package/src/ruleNames.js
CHANGED
|
@@ -36,6 +36,7 @@ export const TABLE_BODY_CELL_RULE_NAME = "tableBodyCell";
|
|
|
36
36
|
export const TABLE_SEPARATOR_RULE_NAME = "tableSeparator";
|
|
37
37
|
export const EMPHASISED_TEXT_RULE_NAME = "emphasisedText";
|
|
38
38
|
export const PRIMARY_HEADING_RULE_NAME = "primaryHeading";
|
|
39
|
+
export const EMPTY_TABLE_CELL_RULE_NAME = "emptyTableCell";
|
|
39
40
|
export const TERTIARY_HEADING_RULE_NAME = "tertiaryHeading";
|
|
40
41
|
export const ORDERED_LIST_ITEM_RULE_NAME = "orderedListItem";
|
|
41
42
|
export const BLOCK_LISTING_END_RULE_NAME = "blockListingEnd";
|
|
@@ -82,6 +83,7 @@ const ruleNames = {
|
|
|
82
83
|
TABLE_SEPARATOR_RULE_NAME,
|
|
83
84
|
EMPHASISED_TEXT_RULE_NAME,
|
|
84
85
|
PRIMARY_HEADING_RULE_NAME,
|
|
86
|
+
EMPTY_TABLE_CELL_RULE_NAME,
|
|
85
87
|
TERTIARY_HEADING_RULE_NAME,
|
|
86
88
|
ORDERED_LIST_ITEM_RULE_NAME,
|
|
87
89
|
BLOCK_LISTING_END_RULE_NAME,
|
package/src/tokenTypes.js
CHANGED
|
@@ -21,11 +21,6 @@ export const QUADRUPLE_HASH_TOKEN_TYPE = "quadruple-hash";
|
|
|
21
21
|
export const SINGLE_ASTERISK_TOKEN_TYPE = "single-asterisk";
|
|
22
22
|
export const DOUBLE_ASTERISK_TOKEN_TYPE = "double-asterisk";
|
|
23
23
|
export const TRIPLE_ASTERISK_TOKEN_TYPE = "triple-asterisk";
|
|
24
|
-
export const OPEN_SQUARE_BRACKET_TOKEN_TYPE = "open-square-bracket";
|
|
25
|
-
export const CLOSE_SQUARE_BRACKET_TOKEN_TYPE = "close-square-bracket";
|
|
26
|
-
export const OPEN_SQUARE_BRACKET_CARET_TOKEN_TYPE = "open-square-bracket-caret";
|
|
27
|
-
export const CLOSE_SQUARE_BRACKET_COLON_TOKEN_TYPE = "close-square-bracket-colon";
|
|
28
|
-
export const EXCLAMATION_MARK_OPEN_SQUARE_BRACKET_TOKEN_TYPE = "exclamation-mark-open-square-bracket";
|
|
29
24
|
|
|
30
25
|
const tokenTypes = {
|
|
31
26
|
WORD_TOKEN_TYPE,
|
|
@@ -48,12 +43,7 @@ const tokenTypes = {
|
|
|
48
43
|
QUADRUPLE_HASH_TOKEN_TYPE,
|
|
49
44
|
SINGLE_ASTERISK_TOKEN_TYPE,
|
|
50
45
|
DOUBLE_ASTERISK_TOKEN_TYPE,
|
|
51
|
-
TRIPLE_ASTERISK_TOKEN_TYPE
|
|
52
|
-
OPEN_SQUARE_BRACKET_TOKEN_TYPE,
|
|
53
|
-
CLOSE_SQUARE_BRACKET_TOKEN_TYPE,
|
|
54
|
-
OPEN_SQUARE_BRACKET_CARET_TOKEN_TYPE,
|
|
55
|
-
CLOSE_SQUARE_BRACKET_COLON_TOKEN_TYPE,
|
|
56
|
-
EXCLAMATION_MARK_OPEN_SQUARE_BRACKET_TOKEN_TYPE
|
|
46
|
+
TRIPLE_ASTERISK_TOKEN_TYPE
|
|
57
47
|
};
|
|
58
48
|
|
|
59
49
|
export default tokenTypes;
|