@readme/markdown 6.39.1 → 6.39.4

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/dist/main.js CHANGED
@@ -28136,7 +28136,7 @@ module.exports = function ImageCompiler() {
28136
28136
  var originalImageCompiler = visitors.image;
28137
28137
 
28138
28138
  visitors.image = function compile(node) {
28139
- var _node$data, _node$data$hPropertie, _visitors$figure;
28139
+ var _node$data, _node$data$hPropertie, _node$data2, _node$data2$hProperti, _visitors$figure;
28140
28140
 
28141
28141
  if (((_node$data = node.data) === null || _node$data === void 0 ? void 0 : (_node$data$hPropertie = _node$data.hProperties) === null || _node$data$hPropertie === void 0 ? void 0 : _node$data$hPropertie.className) === 'emoji') return node.title;
28142
28142
 
@@ -28144,7 +28144,7 @@ module.exports = function ImageCompiler() {
28144
28144
  args[_key - 1] = arguments[_key];
28145
28145
  }
28146
28146
 
28147
- if (node.data.hProperties.width) return (_visitors$figure = visitors.figure).call.apply(_visitors$figure, [this, node].concat(args));
28147
+ if ((_node$data2 = node.data) !== null && _node$data2 !== void 0 && (_node$data2$hProperti = _node$data2.hProperties) !== null && _node$data2$hProperti !== void 0 && _node$data2$hProperti.width) return (_visitors$figure = visitors.figure).call.apply(_visitors$figure, [this, node].concat(args));
28148
28148
  return originalImageCompiler.call.apply(originalImageCompiler, [this, node].concat(args));
28149
28149
  };
28150
28150
  };
@@ -28277,9 +28277,10 @@ module.exports = function TableCompiler() {
28277
28277
  }
28278
28278
 
28279
28279
  var data = {
28280
- align: _toConsumableArray(node.align),
28280
+ data: {},
28281
28281
  cols: ((_node$children$ = node.children[0]) === null || _node$children$ === void 0 ? void 0 : (_node$children$$child = _node$children$.children) === null || _node$children$$child === void 0 ? void 0 : _node$children$$child.length) || 0,
28282
- rows: node.children.length
28282
+ rows: node.children.length - 1,
28283
+ align: _toConsumableArray(node.align)
28283
28284
  };
28284
28285
  node.children.forEach(function (row, i) {
28285
28286
  row.children.forEach(function (cell, j) {
@@ -28287,7 +28288,7 @@ module.exports = function TableCompiler() {
28287
28288
 
28288
28289
  var string = _this.all(cell).join('').replace(/\\\n/g, ' \n');
28289
28290
 
28290
- data["".concat(col, "-").concat(j)] = string;
28291
+ data.data["".concat(col, "-").concat(j)] = string;
28291
28292
  });
28292
28293
  });
28293
28294
  return "[block:parameters]\n".concat(JSON.stringify(data, null, 2), "\n[/block]");
@@ -28315,7 +28316,7 @@ module.exports = function RdmeVarCompiler() {
28315
28316
 
28316
28317
  var _slicedToArray = __webpack_require__(3038);
28317
28318
 
28318
- var rgx = /^(#+)([^\n]+)\n{1,}/;
28319
+ var rgx = /^(#{1,6})(?!(?:#|\s))([^\n]+)\n/;
28319
28320
 
28320
28321
  function tokenizer(eat, value) {
28321
28322
  if (!rgx.test(value)) return true;
@@ -28326,8 +28327,14 @@ function tokenizer(eat, value) {
28326
28327
  hash = _rgx$exec2[1],
28327
28328
  text = _rgx$exec2[2];
28328
28329
 
28329
- var block = this.tokenizeBlock([hash, text].join(' '), eat.now());
28330
- return eat(match)(block[0]);
28330
+ var now = eat.now();
28331
+ now.column += match.length;
28332
+ now.offset += match.length;
28333
+ return eat(match)({
28334
+ type: 'heading',
28335
+ depth: hash.length,
28336
+ children: this.tokenizeInline(text, now)
28337
+ });
28331
28338
  }
28332
28339
 
28333
28340
  function parser() {
package/dist/main.node.js CHANGED
@@ -10959,7 +10959,7 @@ module.exports = function ImageCompiler() {
10959
10959
  var originalImageCompiler = visitors.image;
10960
10960
 
10961
10961
  visitors.image = function compile(node) {
10962
- var _node$data, _node$data$hPropertie, _visitors$figure;
10962
+ var _node$data, _node$data$hPropertie, _node$data2, _node$data2$hProperti, _visitors$figure;
10963
10963
 
10964
10964
  if (((_node$data = node.data) === null || _node$data === void 0 ? void 0 : (_node$data$hPropertie = _node$data.hProperties) === null || _node$data$hPropertie === void 0 ? void 0 : _node$data$hPropertie.className) === 'emoji') return node.title;
10965
10965
 
@@ -10967,7 +10967,7 @@ module.exports = function ImageCompiler() {
10967
10967
  args[_key - 1] = arguments[_key];
10968
10968
  }
10969
10969
 
10970
- if (node.data.hProperties.width) return (_visitors$figure = visitors.figure).call.apply(_visitors$figure, [this, node].concat(args));
10970
+ if ((_node$data2 = node.data) !== null && _node$data2 !== void 0 && (_node$data2$hProperti = _node$data2.hProperties) !== null && _node$data2$hProperti !== void 0 && _node$data2$hProperti.width) return (_visitors$figure = visitors.figure).call.apply(_visitors$figure, [this, node].concat(args));
10971
10971
  return originalImageCompiler.call.apply(originalImageCompiler, [this, node].concat(args));
10972
10972
  };
10973
10973
  };
@@ -11100,9 +11100,10 @@ module.exports = function TableCompiler() {
11100
11100
  }
11101
11101
 
11102
11102
  var data = {
11103
- align: _toConsumableArray(node.align),
11103
+ data: {},
11104
11104
  cols: ((_node$children$ = node.children[0]) === null || _node$children$ === void 0 ? void 0 : (_node$children$$child = _node$children$.children) === null || _node$children$$child === void 0 ? void 0 : _node$children$$child.length) || 0,
11105
- rows: node.children.length
11105
+ rows: node.children.length - 1,
11106
+ align: _toConsumableArray(node.align)
11106
11107
  };
11107
11108
  node.children.forEach(function (row, i) {
11108
11109
  row.children.forEach(function (cell, j) {
@@ -11110,7 +11111,7 @@ module.exports = function TableCompiler() {
11110
11111
 
11111
11112
  var string = _this.all(cell).join('').replace(/\\\n/g, ' \n');
11112
11113
 
11113
- data["".concat(col, "-").concat(j)] = string;
11114
+ data.data["".concat(col, "-").concat(j)] = string;
11114
11115
  });
11115
11116
  });
11116
11117
  return "[block:parameters]\n".concat(JSON.stringify(data, null, 2), "\n[/block]");
@@ -11138,7 +11139,7 @@ module.exports = function RdmeVarCompiler() {
11138
11139
 
11139
11140
  var _slicedToArray = __webpack_require__(3038);
11140
11141
 
11141
- var rgx = /^(#+)([^\n]+)\n{1,}/;
11142
+ var rgx = /^(#{1,6})(?!(?:#|\s))([^\n]+)\n/;
11142
11143
 
11143
11144
  function tokenizer(eat, value) {
11144
11145
  if (!rgx.test(value)) return true;
@@ -11149,8 +11150,14 @@ function tokenizer(eat, value) {
11149
11150
  hash = _rgx$exec2[1],
11150
11151
  text = _rgx$exec2[2];
11151
11152
 
11152
- var block = this.tokenizeBlock([hash, text].join(' '), eat.now());
11153
- return eat(match)(block[0]);
11153
+ var now = eat.now();
11154
+ now.column += match.length;
11155
+ now.offset += match.length;
11156
+ return eat(match)({
11157
+ type: 'heading',
11158
+ depth: hash.length,
11159
+ children: this.tokenizeInline(text, now)
11160
+ });
11154
11161
  }
11155
11162
 
11156
11163
  function parser() {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@readme/markdown",
3
3
  "description": "ReadMe's React-based Markdown parser",
4
4
  "author": "Rafe Goldberg <rafe@readme.io>",
5
- "version": "6.39.1",
5
+ "version": "6.39.4",
6
6
  "main": "dist/main.node.js",
7
7
  "browser": "dist/main.js",
8
8
  "files": [