@canopycanopycanopy/b-ber-parser-section 3.0.0 → 3.0.2

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 (2) hide show
  1. package/dist/index.js +7 -15
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,17 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
9
  var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
14
-
15
10
  /* eslint-disable no-param-reassign,no-continue */
16
11
 
17
12
  /*!
@@ -19,6 +14,7 @@ An adapted version of markdown-it-container 2.0.0
19
14
  https://github.com//markdown-it/markdown-it-container
20
15
  MIT license
21
16
  */
17
+
22
18
  const containerPlugin = (md, name, options = {}) => {
23
19
  const minMarkers = options.minMarkers || 3;
24
20
  const markerStr = options.marker || ':';
@@ -27,11 +23,11 @@ const containerPlugin = (md, name, options = {}) => {
27
23
  const {
28
24
  validateOpen,
29
25
  render
30
- } = options; // const validateClose = options.validateClose
26
+ } = options;
27
+ // const validateClose = options.validateClose
31
28
 
32
29
  function container(state, startLine, endLine, silent) {
33
30
  var _context, _context2, _context3;
34
-
35
31
  const lineNumber = startLine + 1;
36
32
  let pos;
37
33
  let nextLine;
@@ -39,14 +35,14 @@ const containerPlugin = (md, name, options = {}) => {
39
35
  let autoClosed = false;
40
36
  let start = state.bMarks[startLine] + state.tShift[startLine];
41
37
  let max = state.eMarks[startLine];
42
- if (markerChar !== state.src.charCodeAt(start)) return false; // Check out the rest of the marker string, i.e., count the number of markers
38
+ if (markerChar !== state.src.charCodeAt(start)) return false;
43
39
 
40
+ // Check out the rest of the marker string, i.e., count the number of markers
44
41
  for (pos = start + 1; pos <= max; pos++) {
45
42
  if (markerStr[(pos - start) % markerLen] !== state.src[pos]) {
46
43
  break;
47
44
  }
48
45
  }
49
-
50
46
  const markerCount = Math.floor((pos - start) / markerLen);
51
47
  if (markerCount < minMarkers) return false;
52
48
  pos -= (pos - start) % markerLen;
@@ -56,7 +52,6 @@ const containerPlugin = (md, name, options = {}) => {
56
52
  if (silent) return true; // for testing validation
57
53
 
58
54
  nextLine = startLine;
59
-
60
55
  for (;;) {
61
56
  nextLine += 1;
62
57
  if (nextLine >= endLine) break; // unclosed block is autoclosed by end of document
@@ -64,17 +59,16 @@ const containerPlugin = (md, name, options = {}) => {
64
59
  start = state.bMarks[nextLine] + state.tShift[nextLine];
65
60
  max = state.eMarks[nextLine];
66
61
  if (state.sCount[nextLine] - state.blkIndent >= 4) continue; // closing fence must be indented less than 4 spaces
67
-
68
62
  if (Math.floor((pos - start) / markerLen) < markerCount) continue;
69
63
  if (pos < max) continue;
70
64
  autoClosed = true;
71
65
  break;
72
66
  }
73
-
74
67
  const oldParent = state.parentType;
75
68
  const oldLineMax = state.lineMax;
76
- state.parentType = 'container'; // this will prevent lazy continuations from ever going past our end marker
69
+ state.parentType = 'container';
77
70
 
71
+ // this will prevent lazy continuations from ever going past our end marker
78
72
  state.lineMax = nextLine;
79
73
  token = state.push(`container_${name}_open`, 'section', 1);
80
74
  token.markup = markup;
@@ -91,13 +85,11 @@ const containerPlugin = (md, name, options = {}) => {
91
85
  state.line = nextLine + (autoClosed ? 1 : 0);
92
86
  return true;
93
87
  }
94
-
95
88
  md.block.ruler.before('fence', `container_${name}`, container, {
96
89
  alt: ['paragraph', 'reference', 'blockquote']
97
90
  });
98
91
  md.renderer.rules[`container_${name}_open`] = render;
99
92
  md.renderer.rules[`container_${name}_close`] = render;
100
93
  };
101
-
102
94
  var _default = containerPlugin;
103
95
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-parser-section",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -25,10 +25,10 @@
25
25
  "rimraf": "^2.7.1"
26
26
  },
27
27
  "dependencies": {
28
- "@canopycanopycanopy/b-ber-lib": "3.0.0",
29
- "@canopycanopycanopy/b-ber-logger": "3.0.0",
30
- "@canopycanopycanopy/b-ber-shapes-directives": "3.0.0",
31
- "@canopycanopycanopy/b-ber-templates": "3.0.0",
28
+ "@canopycanopycanopy/b-ber-lib": "3.0.2",
29
+ "@canopycanopycanopy/b-ber-logger": "3.0.2",
30
+ "@canopycanopycanopy/b-ber-shapes-directives": "3.0.2",
31
+ "@canopycanopycanopy/b-ber-templates": "3.0.2",
32
32
  "lodash": "^4.17.21",
33
33
  "tar": "^6.1.11"
34
34
  },
@@ -49,5 +49,5 @@
49
49
  "url": "https://maxwellsimmer.com"
50
50
  }
51
51
  ],
52
- "gitHead": "676dbec7fbdcc46eb8168f1d437d294ed549e2e8"
52
+ "gitHead": "1ec8ab9a4030fb59839d347beb04ab7605e3d5dd"
53
53
  }