highmark-markdown 0.0.362 → 0.0.363

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "highmark-markdown",
3
3
  "author": "James Smith",
4
- "version": "0.0.362",
4
+ "version": "0.0.363",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/highmark-markdown",
7
7
  "description": "Highmark's Markdown and Markdown Style languages.",
@@ -99,7 +99,7 @@ const bnf = `
99
99
  includeDirective ::= "@include" [path] ;
100
100
 
101
101
 
102
- contentsDirective ::= "@contents" [number]? ;
102
+ contentsDirective ::= "@contents" ;
103
103
 
104
104
 
105
105
  footnotesDirective ::= "@footnotes" ;
@@ -1,28 +1,7 @@
1
1
  "use strict";
2
2
 
3
- import { arrayUtilities } from "necessary";
4
-
5
3
  import MarkdownNode from "../../../node/markdown";
6
4
 
7
- const { second } = arrayUtilities;
8
-
9
5
  export default class ContentsDirectiveMarkdownNode extends MarkdownNode {
10
- maximumLevel(context) {
11
- let maximumLevel = 1;
12
-
13
- const childNodes = this.getChildNodes(),
14
- childNodesLength = childNodes.length;
15
-
16
- if (childNodesLength> 1) {
17
- const secondChildNode = second(childNodes),
18
- terminalNode = secondChildNode, ///
19
- content = terminalNode.getContent();
20
-
21
- maximumLevel = Number(content); ///
22
- }
23
-
24
- return maximumLevel;
25
- }
26
-
27
6
  static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return MarkdownNode.fromRuleNameChildNodesAndOpacity(ContentsDirectiveMarkdownNode, ruleName, childNodes, opacity); }
28
7
  }
@@ -197,8 +197,8 @@ ${childNodesHTML}${indent}${closingTag}
197
197
  }
198
198
 
199
199
  function headingMarkdownNodesFromDivisionMarkdownNodeAndContentsDirectiveMarkdownNode(divisionMarkdownNode, contentsDirectiveMarkdownNode, context) {
200
- const headingMarkdownNodes = [],
201
- maximumLevel = contentsDirectiveMarkdownNode.maximumLevel(context);
200
+ const { contentsDepth } = context,
201
+ headingMarkdownNodes = [];
202
202
 
203
203
  let { divisionMarkdownNodes } = context;
204
204
 
@@ -214,9 +214,9 @@ function headingMarkdownNodesFromDivisionMarkdownNodeAndContentsDirectiveMarkdow
214
214
  });
215
215
 
216
216
  filter(headingMarkdownNodes, (headingMarkdownNode) => {
217
- const level = headingMarkdownNode.getLevel();
217
+ const depth = headingMarkdownNode.getDepth();
218
218
 
219
- if (level <= maximumLevel) {
219
+ if (depth <= contentsDepth) {
220
220
  return true;
221
221
  }
222
222
  });
@@ -3,7 +3,7 @@
3
3
  import HeadingMarkdownNode from "../../../node/markdown/heading";
4
4
 
5
5
  export default class PrimaryHeadingMarkdownNode extends HeadingMarkdownNode {
6
- static level = 1;
6
+ static depth = 1;
7
7
 
8
8
  static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return HeadingMarkdownNode.fromRuleNameChildNodesAndOpacity(PrimaryHeadingMarkdownNode, ruleName, childNodes, opacity); }
9
9
  }
@@ -3,7 +3,7 @@
3
3
  import HeadingMarkdownNode from "../../../node/markdown/heading";
4
4
 
5
5
  export default class QuaternaryHeadingMarkdownNode extends HeadingMarkdownNode {
6
- static level = 4;
6
+ static depth = 4;
7
7
 
8
8
  static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return HeadingMarkdownNode.fromRuleNameChildNodesAndOpacity(QuaternaryHeadingMarkdownNode, ruleName, childNodes, opacity); }
9
9
  }
@@ -3,7 +3,7 @@
3
3
  import HeadingMarkdownNode from "../../../node/markdown/heading";
4
4
 
5
5
  export default class SecondaryHeadingMarkdownNode extends HeadingMarkdownNode {
6
- static level = 2;
6
+ static depth = 2;
7
7
 
8
8
  static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return HeadingMarkdownNode.fromRuleNameChildNodesAndOpacity(SecondaryHeadingMarkdownNode, ruleName, childNodes, opacity); }
9
9
  }
@@ -3,7 +3,7 @@
3
3
  import HeadingMarkdownNode from "../../../node/markdown/heading";
4
4
 
5
5
  export default class TertiaryHeadingMarkdownNode extends HeadingMarkdownNode {
6
- static level = 3;
6
+ static depth = 3;
7
7
 
8
8
  static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return HeadingMarkdownNode.fromRuleNameChildNodesAndOpacity(TertiaryHeadingMarkdownNode, ruleName, childNodes, opacity); }
9
9
  }
@@ -11,10 +11,10 @@ import { replaceSpacesWithHyphens, removedLeadingWhitespace, removeNonAlphabetic
11
11
  const { last } = arrayUtilities;
12
12
 
13
13
  export default class HeadingMarkdownNode extends MarkdownNode {
14
- getLevel() {
15
- const { level } = this.constructor;
14
+ getDepth() {
15
+ const { depth } = this.constructor;
16
16
 
17
- return level;
17
+ return depth;
18
18
  }
19
19
 
20
20
  addAnchor(context) {
@@ -8,16 +8,16 @@ export function nestNodes(nodes) {
8
8
  const nestedNodesStack = NestedNodeStack.fromNothing();
9
9
 
10
10
  nodes.forEach((node) => {
11
- const level = node.getLevel();
11
+ const depth = node.getDepth();
12
12
 
13
- let nestedNodesStackLevel = nestedNodesStack.getLevel()
13
+ let nestedNodesStackDepth = nestedNodesStack.getDepth()
14
14
 
15
- while (nestedNodesStackLevel < level) {
16
- nestedNodesStackLevel = nestedNodesStack.increment();
15
+ while (nestedNodesStackDepth < depth) {
16
+ nestedNodesStackDepth = nestedNodesStack.increment();
17
17
  }
18
18
 
19
- while (nestedNodesStackLevel > level) {
20
- nestedNodesStackLevel = nestedNodesStack.decrement();
19
+ while (nestedNodesStackDepth > depth) {
20
+ nestedNodesStackDepth = nestedNodesStack.decrement();
21
21
  }
22
22
 
23
23
  const nestedNode = NestedNode.fromNode(node);
@@ -88,11 +88,11 @@ class NestedNodeStack {
88
88
  return nestedNode;
89
89
  }
90
90
 
91
- getLevel() {
91
+ getDepth() {
92
92
  const nestedNodesLength = this.nestedNodes.length,
93
- level = nestedNodesLength; ///
93
+ depth = nestedNodesLength; ///
94
94
 
95
- return level;
95
+ return depth;
96
96
  }
97
97
 
98
98
  increment() {
@@ -100,17 +100,17 @@ class NestedNodeStack {
100
100
 
101
101
  this.addNestedNode(nestedNode);
102
102
 
103
- const level = this.getLevel();
103
+ const depth = this.getDepth();
104
104
 
105
- return level;
105
+ return depth;
106
106
  }
107
107
 
108
108
  decrement() {
109
109
  this.removeNestedNode();
110
110
 
111
- const level = this.getLevel();
111
+ const depth = this.getDepth();
112
112
 
113
- return level;
113
+ return depth;
114
114
  }
115
115
 
116
116
  addNestedNode(nestedNode) {