highmark-markdown 0.0.58 → 0.0.60

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 (50) hide show
  1. package/example.js +136 -203
  2. package/lib/example/view.js +2 -2
  3. package/lib/markdown/entries.js +2 -2
  4. package/lib/markdown/lexer.js +2 -2
  5. package/lib/mixins/content.js +3 -3
  6. package/lib/node/markdown/address.js +3 -2
  7. package/lib/node/markdown/blockListing.js +1 -8
  8. package/lib/node/markdown/blockText.js +4 -4
  9. package/lib/node/markdown/division.js +1 -2
  10. package/lib/node/markdown/emphasisedText.js +2 -2
  11. package/lib/node/markdown/endOfLine.js +5 -9
  12. package/lib/node/markdown/error.js +7 -13
  13. package/lib/node/markdown/hyperlink.js +24 -24
  14. package/lib/node/markdown/image.js +15 -22
  15. package/lib/node/markdown/inlineText.js +2 -2
  16. package/lib/node/markdown/line.js +4 -3
  17. package/lib/node/markdown/mailToLink.js +24 -24
  18. package/lib/node/markdown/strongText.js +2 -2
  19. package/lib/node/markdown/stronglyEmphasisedText.js +2 -2
  20. package/lib/node/markdown/tableCell.js +7 -43
  21. package/lib/node/markdown/text.js +2 -12
  22. package/lib/node/markdown/url.js +3 -2
  23. package/lib/node/markdown/verticalSpace.js +12 -14
  24. package/lib/node/markdown.js +15 -15
  25. package/lib/utilities/content.js +15 -12
  26. package/package.json +1 -1
  27. package/src/example/view.js +5 -1
  28. package/src/markdown/entries.js +1 -1
  29. package/src/markdown/lexer.js +1 -2
  30. package/src/mixins/content.js +3 -2
  31. package/src/node/markdown/address.js +3 -1
  32. package/src/node/markdown/blockListing.js +0 -9
  33. package/src/node/markdown/blockText.js +6 -5
  34. package/src/node/markdown/division.js +0 -1
  35. package/src/node/markdown/emphasisedText.js +1 -2
  36. package/src/node/markdown/endOfLine.js +6 -9
  37. package/src/node/markdown/error.js +7 -18
  38. package/src/node/markdown/hyperlink.js +30 -30
  39. package/src/node/markdown/image.js +22 -28
  40. package/src/node/markdown/inlineText.js +1 -2
  41. package/src/node/markdown/line.js +1 -4
  42. package/src/node/markdown/mailToLink.js +28 -28
  43. package/src/node/markdown/strongText.js +1 -2
  44. package/src/node/markdown/stronglyEmphasisedText.js +1 -2
  45. package/src/node/markdown/tableCell.js +6 -51
  46. package/src/node/markdown/text.js +0 -13
  47. package/src/node/markdown/url.js +3 -1
  48. package/src/node/markdown/verticalSpace.js +19 -16
  49. package/src/node/markdown.js +12 -12
  50. package/src/utilities/content.js +17 -15
@@ -3,7 +3,7 @@
3
3
  import MarkdownNode from "../../node/markdown";
4
4
  import contentMixins from "../../mixins/content";
5
5
 
6
- export default class URLMarkdownNode extends MarkdownNode {
6
+ class URLMarkdownNode extends MarkdownNode {
7
7
  asHTML(indent, context) {
8
8
  const content = this.content(context),
9
9
  html = content; ///
@@ -24,3 +24,5 @@ export default class URLMarkdownNode extends MarkdownNode {
24
24
  }
25
25
 
26
26
  Object.assign(URLMarkdownNode.prototype, contentMixins);
27
+
28
+ export default URLMarkdownNode;
@@ -1,28 +1,31 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import MarkdownNode from "../../node/markdown";
4
- import contentMixins from "../../mixins/content";
5
6
 
6
- class VerticalSpaceMarkdownNode extends MarkdownNode {
7
- asHTML(indent, context) {
8
- const content = this.content(context),
9
- html = content; ///
7
+ const { first } = arrayUtilities;
10
8
 
11
- return html;
12
- }
9
+ export default class VerticalSpaceMarkdownNode extends MarkdownNode {
10
+ childNodesAsHTML(indent, context) {
11
+ const childNodes = this.getChildNodes(),
12
+ firstChildNode = first(childNodes),
13
+ endOfLineMarkdownNode = firstChildNode,
14
+ content = endOfLineMarkdownNode.content(context),
15
+ childNodesHTML = content; ///
13
16
 
14
- createDOMElement(context) {
15
- const content = this.content(context),
16
- domElement = document.createTextNode(content);
17
+ return childNodesHTML;
18
+ }
17
19
 
18
- this.setDOMElement(domElement);
20
+ createChildNodeDOMElements(context) {
21
+ const childNodes = this.getChildNodes(),
22
+ firstChildNode = first(childNodes),
23
+ inlineTextMarkdownNode = firstChildNode, ///
24
+ content = inlineTextMarkdownNode.content(context),
25
+ childNodeDOMElement = document.createTextNode(content);
19
26
 
20
- return domElement;
27
+ this.insertDOMElement(childNodeDOMElement);
21
28
  }
22
29
 
23
30
  static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return MarkdownNode.fromRuleNameChildNodesAndOpacity(VerticalSpaceMarkdownNode, ruleName, childNodes, opacity); }
24
31
  }
25
-
26
- Object.assign(VerticalSpaceMarkdownNode.prototype, contentMixins);
27
-
28
- export default VerticalSpaceMarkdownNode;
@@ -36,18 +36,6 @@ class MarkdownNode extends NonTerminalNode {
36
36
  return className;
37
37
  }
38
38
 
39
- attributeName(context) {
40
- const attributeName = null;
41
-
42
- return attributeName;
43
- }
44
-
45
- attributeValue(context) {
46
- const attributeValue = null;
47
-
48
- return attributeValue;
49
- }
50
-
51
39
  asHTML(indent, context) {
52
40
  if (context === undefined) {
53
41
  context = indent; ///
@@ -148,6 +136,18 @@ ${indent}${closingTag}
148
136
  return indent;
149
137
  }
150
138
 
139
+ attributeName(context) {
140
+ const attributeName = null;
141
+
142
+ return attributeName;
143
+ }
144
+
145
+ attributeValue(context) {
146
+ const attributeValue = null;
147
+
148
+ return attributeValue;
149
+ }
150
+
151
151
  childNodesAsHTML(indent, context) {
152
152
  const childNodes = this.getChildNodes(),
153
153
  childNodesHTML = childNodes.reduce((childNodesHTML, childNode) => {
@@ -7,7 +7,7 @@ import { ESCAPED_TOKEN_TYPE } from "../tokenTypes";
7
7
 
8
8
  const { first, last } = arrayUtilities;
9
9
 
10
- export function contentFromMarkdownNodes(markdownNodes, context) {
10
+ export function contentFromMarkdownNodes(markdownNodes, context, trimmed = false) {
11
11
  let content = EMPTY_STRING;
12
12
 
13
13
  let { tokens } = context;
@@ -25,26 +25,28 @@ export function contentFromMarkdownNodes(markdownNodes, context) {
25
25
  let firstTokenIndex = firstSignificantTokenIndex, ///
26
26
  lastTokenIndex = lastSignificantTokenIndex; ///
27
27
 
28
- const previousTokenIndex = firstTokenIndex - 1,
29
- nextTokenIndex = lastTokenIndex + 1;
28
+ if (!trimmed) {
29
+ const previousTokenIndex = firstTokenIndex - 1,
30
+ nextTokenIndex = lastTokenIndex + 1;
30
31
 
31
- if (previousTokenIndex > -1) {
32
- const previousToken = tokens[previousTokenIndex],
33
- previousTokenSignificant = previousToken.isSignificant();
32
+ if (previousTokenIndex > -1) {
33
+ const previousToken = tokens[previousTokenIndex],
34
+ previousTokenSignificant = previousToken.isSignificant();
34
35
 
35
- if (!previousTokenSignificant) {
36
- firstTokenIndex--;
36
+ if (!previousTokenSignificant) {
37
+ firstTokenIndex--;
38
+ }
37
39
  }
38
- }
39
40
 
40
- const tokensLength = tokens.length;
41
+ const tokensLength = tokens.length;
41
42
 
42
- if (nextTokenIndex < tokensLength) {
43
- const nextToken = tokens[nextTokenIndex],
44
- nextTokenSignificant = nextToken.isSignificant();
43
+ if (nextTokenIndex < tokensLength) {
44
+ const nextToken = tokens[nextTokenIndex],
45
+ nextTokenSignificant = nextToken.isSignificant();
45
46
 
46
- if (!nextTokenSignificant) {
47
- lastTokenIndex++;
47
+ if (!nextTokenSignificant) {
48
+ lastTokenIndex++;
49
+ }
48
50
  }
49
51
  }
50
52