@readme/markdown 6.44.0 → 6.46.1

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.node.js CHANGED
@@ -9180,7 +9180,7 @@ Anchor.defaultProps = {
9180
9180
  title: ''
9181
9181
  };
9182
9182
 
9183
- var AnchorContext = function AnchorContext(props) {
9183
+ var AnchorWithContext = function AnchorWithContext(props) {
9184
9184
  return /*#__PURE__*/React.createElement(BaseUrlContext.Consumer, null, function (baseUrl) {
9185
9185
  return /*#__PURE__*/React.createElement(Anchor, _extends({
9186
9186
  baseUrl: baseUrl
@@ -9188,12 +9188,14 @@ var AnchorContext = function AnchorContext(props) {
9188
9188
  });
9189
9189
  };
9190
9190
 
9191
- module.exports = function (sanitizeSchema) {
9191
+ AnchorWithContext.sanitize = function (sanitizeSchema) {
9192
9192
  // This is for our custom link formats
9193
9193
  sanitizeSchema.protocols.href.push('doc', 'target', 'ref', 'blog', 'changelog', 'page');
9194
- return AnchorContext;
9194
+ return sanitizeSchema;
9195
9195
  };
9196
9196
 
9197
+ module.exports = AnchorWithContext;
9198
+
9197
9199
  /***/ }),
9198
9200
 
9199
9201
  /***/ 2015:
@@ -9257,11 +9259,13 @@ Callout.defaultProps = {
9257
9259
  node: null
9258
9260
  };
9259
9261
 
9260
- module.exports = function (sanitizeSchema) {
9262
+ Callout.sanitize = function (sanitizeSchema) {
9261
9263
  sanitizeSchema.attributes['rdme-callout'] = ['icon', 'theme', 'title', 'value'];
9262
- return Callout;
9264
+ return sanitizeSchema;
9263
9265
  };
9264
9266
 
9267
+ module.exports = Callout;
9268
+
9265
9269
  /***/ }),
9266
9270
 
9267
9271
  /***/ 8297:
@@ -9357,12 +9361,10 @@ function Code(props) {
9357
9361
  }), codeContent));
9358
9362
  }
9359
9363
 
9360
- function CreateCode(sanitizeSchema, _ref2) {
9364
+ function CreateCode(_ref2) {
9361
9365
  var copyButtons = _ref2.copyButtons,
9362
9366
  theme = _ref2.theme;
9363
- // This is for code blocks class name
9364
- sanitizeSchema.attributes.code = ['className', 'lang', 'meta', 'value']; // eslint-disable-next-line react/display-name
9365
-
9367
+ // eslint-disable-next-line react/display-name
9366
9368
  return function (props) {
9367
9369
  return /*#__PURE__*/React.createElement(Code, _extends({}, props, {
9368
9370
  copyButtons: copyButtons,
@@ -9386,10 +9388,14 @@ Code.defaultProps = {
9386
9388
  meta: ''
9387
9389
  };
9388
9390
 
9389
- module.exports = function (sanitizeSchema, opts) {
9390
- return CreateCode(sanitizeSchema, opts);
9391
+ CreateCode.sanitize = function (sanitizeSchema) {
9392
+ // This is for code blocks class name
9393
+ sanitizeSchema.attributes.code = ['className', 'lang', 'meta', 'value'];
9394
+ return sanitizeSchema;
9391
9395
  };
9392
9396
 
9397
+ module.exports = CreateCode;
9398
+
9393
9399
  /***/ }),
9394
9400
 
9395
9401
  /***/ 6553:
@@ -9468,9 +9474,7 @@ function CreateCodeTabs(_ref3) {
9468
9474
  };
9469
9475
  }
9470
9476
 
9471
- module.exports = function (_, opts) {
9472
- return CreateCodeTabs(opts);
9473
- };
9477
+ module.exports = CreateCodeTabs;
9474
9478
 
9475
9479
  /***/ }),
9476
9480
 
@@ -9625,10 +9629,7 @@ Embed.defaultProps = {
9625
9629
  height: '300px',
9626
9630
  width: '100%'
9627
9631
  };
9628
-
9629
- module.exports = function () {
9630
- return Embed;
9631
- };
9632
+ module.exports = Embed;
9632
9633
 
9633
9634
  /***/ }),
9634
9635
 
@@ -9813,12 +9814,14 @@ var CreateHtmlBlock = function CreateHtmlBlock(_ref) {
9813
9814
  );
9814
9815
  };
9815
9816
 
9816
- module.exports = function (sanitize, opts) {
9817
- sanitize.tagNames.push('html-block');
9818
- sanitize.attributes['html-block'] = ['html', 'runScripts'];
9819
- return CreateHtmlBlock(opts);
9817
+ CreateHtmlBlock.sanitize = function (schema) {
9818
+ schema.tagNames.push('html-block');
9819
+ schema.attributes['html-block'] = ['html', 'runScripts'];
9820
+ return schema;
9820
9821
  };
9821
9822
 
9823
+ module.exports = CreateHtmlBlock;
9824
+
9822
9825
  /***/ }),
9823
9826
 
9824
9827
  /***/ 1984:
@@ -10119,11 +10122,53 @@ Image.defaultProps = {
10119
10122
  width: 'auto'
10120
10123
  };
10121
10124
 
10122
- module.exports = function (sanitizeSchema) {
10125
+ Image.sanitize = function (sanitizeSchema) {
10123
10126
  sanitizeSchema.attributes.img = ['className', 'title', 'alt', 'width', 'height', 'align', 'src', 'longDesc'];
10124
- return Image;
10127
+ return sanitizeSchema;
10128
+ };
10129
+
10130
+ module.exports = Image;
10131
+
10132
+ /***/ }),
10133
+
10134
+ /***/ 3197:
10135
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
10136
+
10137
+ var _extends = __webpack_require__(7154);
10138
+
10139
+ var React = __webpack_require__(4466);
10140
+
10141
+ var PropTypes = __webpack_require__(5697);
10142
+
10143
+ var Style = function Style(_ref) {
10144
+ var children = _ref.children,
10145
+ safeMode = _ref.safeMode;
10146
+ return safeMode ? /*#__PURE__*/React.createElement("pre", null, /*#__PURE__*/React.createElement("code", null, "<style>\n".concat(children, "\n</style>"))) : /*#__PURE__*/React.createElement("style", null, children);
10147
+ };
10148
+
10149
+ Style.propTypes = {
10150
+ children: PropTypes.node,
10151
+ safeMode: PropTypes.bool
10152
+ };
10153
+
10154
+ var CreateStyle = function CreateStyle(_ref2) {
10155
+ var safeMode = _ref2.safeMode;
10156
+ return (// eslint-disable-next-line react/display-name
10157
+ function (props) {
10158
+ return /*#__PURE__*/React.createElement(Style, _extends({}, props, {
10159
+ safeMode: safeMode
10160
+ }));
10161
+ }
10162
+ );
10163
+ };
10164
+
10165
+ CreateStyle.sanitize = function (sanitize) {
10166
+ sanitize.tagNames.push('style');
10167
+ return sanitize;
10125
10168
  };
10126
10169
 
10170
+ module.exports = CreateStyle;
10171
+
10127
10172
  /***/ }),
10128
10173
 
10129
10174
  /***/ 484:
@@ -10145,10 +10190,7 @@ function Table(props) {
10145
10190
  Table.propTypes = {
10146
10191
  children: PropTypes.arrayOf(PropTypes.node).isRequired
10147
10192
  };
10148
-
10149
- module.exports = function () {
10150
- return Table;
10151
- };
10193
+ module.exports = Table;
10152
10194
 
10153
10195
  /***/ }),
10154
10196
 
@@ -10195,8 +10237,9 @@ __webpack_require__.r(__webpack_exports__);
10195
10237
  /* harmony export */ "HTMLBlock": () => (/* reexport default from dynamic */ _HTMLBlock__WEBPACK_IMPORTED_MODULE_6___default.a),
10196
10238
  /* harmony export */ "Heading": () => (/* reexport default from dynamic */ _Heading__WEBPACK_IMPORTED_MODULE_7___default.a),
10197
10239
  /* harmony export */ "Image": () => (/* reexport default from dynamic */ _Image__WEBPACK_IMPORTED_MODULE_8___default.a),
10198
- /* harmony export */ "Table": () => (/* reexport default from dynamic */ _Table__WEBPACK_IMPORTED_MODULE_9___default.a),
10199
- /* harmony export */ "TableOfContents": () => (/* reexport default from dynamic */ _TableOfContents__WEBPACK_IMPORTED_MODULE_10___default.a)
10240
+ /* harmony export */ "Style": () => (/* reexport default from dynamic */ _Style__WEBPACK_IMPORTED_MODULE_9___default.a),
10241
+ /* harmony export */ "Table": () => (/* reexport default from dynamic */ _Table__WEBPACK_IMPORTED_MODULE_10___default.a),
10242
+ /* harmony export */ "TableOfContents": () => (/* reexport default from dynamic */ _TableOfContents__WEBPACK_IMPORTED_MODULE_11___default.a)
10200
10243
  /* harmony export */ });
10201
10244
  /* harmony import */ var _Anchor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8447);
10202
10245
  /* harmony import */ var _Anchor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_Anchor__WEBPACK_IMPORTED_MODULE_0__);
@@ -10216,10 +10259,13 @@ __webpack_require__.r(__webpack_exports__);
10216
10259
  /* harmony import */ var _Heading__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_Heading__WEBPACK_IMPORTED_MODULE_7__);
10217
10260
  /* harmony import */ var _Image__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9167);
10218
10261
  /* harmony import */ var _Image__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Image__WEBPACK_IMPORTED_MODULE_8__);
10219
- /* harmony import */ var _Table__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(484);
10220
- /* harmony import */ var _Table__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_Table__WEBPACK_IMPORTED_MODULE_9__);
10221
- /* harmony import */ var _TableOfContents__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4479);
10222
- /* harmony import */ var _TableOfContents__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_TableOfContents__WEBPACK_IMPORTED_MODULE_10__);
10262
+ /* harmony import */ var _Style__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3197);
10263
+ /* harmony import */ var _Style__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_Style__WEBPACK_IMPORTED_MODULE_9__);
10264
+ /* harmony import */ var _Table__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(484);
10265
+ /* harmony import */ var _Table__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_Table__WEBPACK_IMPORTED_MODULE_10__);
10266
+ /* harmony import */ var _TableOfContents__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(4479);
10267
+ /* harmony import */ var _TableOfContents__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_TableOfContents__WEBPACK_IMPORTED_MODULE_11__);
10268
+
10223
10269
 
10224
10270
 
10225
10271
 
@@ -10259,12 +10305,10 @@ var _slicedToArray = __webpack_require__(3038);
10259
10305
 
10260
10306
  /* eslint-disable no-param-reassign
10261
10307
  */
10262
- var sanitize = __webpack_require__(8229);
10263
-
10264
10308
  var kebabCase = __webpack_require__(5683);
10265
10309
 
10266
- var registerCustomComponents = function registerCustomComponents(components) {
10267
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'x';
10310
+ var registerCustomComponents = function registerCustomComponents(components, sanitize) {
10311
+ var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'x';
10268
10312
  return Object.entries(components).reduce(function (all, _ref) {
10269
10313
  var _ref2 = _slicedToArray(_ref, 2),
10270
10314
  tag = _ref2[0],
@@ -10915,7 +10959,7 @@ var _require = __webpack_require__(7589),
10915
10959
 
10916
10960
  var compileImage = function compileImage(image) {
10917
10961
  var img = _objectSpread(_objectSpread({
10918
- image: [image.url, image.title]
10962
+ image: [image.url, image.title, image.alt]
10919
10963
  }, image.data.hProperties.width && {
10920
10964
  sizing: imgSizeByWidth[image.data.hProperties.width]
10921
10965
  }), image.border && {
@@ -11787,15 +11831,16 @@ function tokenize(eat, value) {
11787
11831
  var imgs = json.images.map(function (img) {
11788
11832
  if (!('image' in img)) return null;
11789
11833
 
11790
- var _img$image = _slicedToArray(img.image, 2),
11834
+ var _img$image = _slicedToArray(img.image, 3),
11791
11835
  url = _img$image[0],
11792
- title = _img$image[1];
11836
+ title = _img$image[1],
11837
+ alt = _img$image[2];
11793
11838
 
11794
11839
  var block = {
11795
11840
  type: 'image',
11796
11841
  url: url,
11797
11842
  title: title,
11798
- alt: 'caption' in img ? img.caption : '',
11843
+ alt: alt || ('caption' in img ? img.caption : ''),
11799
11844
  data: {
11800
11845
  hProperties: _objectSpread({
11801
11846
  className: img.border ? 'border' : ''
@@ -12082,16 +12127,51 @@ module.exports.sanitize = function (sanitizeSchema) {
12082
12127
  /***/ }),
12083
12128
 
12084
12129
  /***/ 4792:
12085
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
12130
+ /***/ ((module) => {
12131
+
12132
+ /* @note: copied from https://github.com/rehypejs/rehype-minify/blob/main/packages/hast-util-to-string/index.js
12133
+ */
12134
+ function toString(node) {
12135
+ if ('children' in node) {
12136
+ // eslint-disable-next-line no-use-before-define
12137
+ return all(node);
12138
+ }
12086
12139
 
12087
- var toString = __webpack_require__(6034);
12140
+ return 'value' in node ? node.value : ' ';
12141
+ }
12088
12142
 
12089
- module.exports = function () {
12090
- return function compile(node) {
12091
- return toString(node);
12092
- };
12143
+ function one(node) {
12144
+ if (node.type === 'text') {
12145
+ return node.value;
12146
+ } // eslint-disable-next-line no-use-before-define
12147
+
12148
+
12149
+ return 'children' in node ? all(node) : ' ';
12150
+ }
12151
+
12152
+ function all(node) {
12153
+ var index = -1;
12154
+ var result = []; // eslint-disable-next-line no-plusplus
12155
+
12156
+ while (++index < node.children.length) {
12157
+ result[index] = one(node.children[index]);
12158
+ }
12159
+
12160
+ return result.join(' ').trim().replace(/ +/, ' ');
12161
+ }
12162
+
12163
+ var Compiler = function Compiler(node) {
12164
+ return toString(node);
12165
+ };
12166
+
12167
+ var toPlainText = function toPlainText() {
12168
+ Object.assign(this, {
12169
+ Compiler: Compiler
12170
+ });
12093
12171
  };
12094
12172
 
12173
+ module.exports = toPlainText;
12174
+
12095
12175
  /***/ }),
12096
12176
 
12097
12177
  /***/ 9620:
@@ -12218,22 +12298,35 @@ module.exports.tableFlattening = transformer;
12218
12298
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
12219
12299
 
12220
12300
  var _require = __webpack_require__(2781),
12221
- sanitize = _require.defaultSchema; // Sanitization Schema Defaults
12301
+ defaultSchema = _require.defaultSchema;
12302
+
12303
+ var createSchema = function createSchema() {
12304
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
12305
+ safeMode = _ref.safeMode;
12222
12306
 
12307
+ var schema = JSON.parse(JSON.stringify(defaultSchema)); // Sanitization Schema Defaults
12223
12308
 
12224
- sanitize.clobberPrefix = '';
12225
- sanitize.tagNames.push('span', 'style');
12226
- sanitize.attributes['*'].push('class', 'className', 'align', 'style');
12227
- sanitize.tagNames.push('rdme-pin');
12228
- sanitize.tagNames.push('rdme-embed');
12229
- sanitize.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon'];
12230
- sanitize.attributes.a = ['href', 'title', 'class', 'className', 'download'];
12231
- sanitize.tagNames.push('figure');
12232
- sanitize.tagNames.push('figcaption');
12233
- sanitize.tagNames.push('input'); // allow GitHub-style todo lists
12309
+ schema.clobberPrefix = '';
12310
+ schema.tagNames.push('span');
12311
+ schema.attributes['*'].push('class', 'className', 'align');
12312
+
12313
+ if (!safeMode) {
12314
+ schema.attributes['*'].push('style');
12315
+ }
12316
+
12317
+ schema.tagNames.push('rdme-pin');
12318
+ schema.tagNames.push('rdme-embed');
12319
+ schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon'];
12320
+ schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
12321
+ schema.tagNames.push('figure');
12322
+ schema.tagNames.push('figcaption');
12323
+ schema.tagNames.push('input'); // allow GitHub-style todo lists
12324
+
12325
+ schema.ancestors.input = ['li'];
12326
+ return schema;
12327
+ };
12234
12328
 
12235
- sanitize.ancestors.input = ['li'];
12236
- module.exports = sanitize;
12329
+ module.exports = createSchema;
12237
12330
 
12238
12331
  /***/ }),
12239
12332
 
@@ -15631,72 +15724,6 @@ function isLiteral(node) {
15631
15724
  }
15632
15725
 
15633
15726
 
15634
- /***/ }),
15635
-
15636
- /***/ 6034:
15637
- /***/ ((module) => {
15638
-
15639
- "use strict";
15640
- /**
15641
- * @fileoverview
15642
- * Get the plain-text value of a hast node.
15643
- * @longdescription
15644
- * ## Use
15645
- *
15646
- * ```js
15647
- * var h = require('hastscript')
15648
- * var toString = require('hast-util-to-string')
15649
- *
15650
- * toString(h('p', 'Alpha'))
15651
- * //=> 'Alpha'
15652
- * toString(h('div', [h('b', 'Bold'), ' and ', h('i', 'italic'), '.']))
15653
- * //=> 'Bold and italic.'
15654
- * ```
15655
- *
15656
- * ## API
15657
- *
15658
- * ### `toString(node)`
15659
- *
15660
- * Transform a node to a string.
15661
- */
15662
-
15663
-
15664
-
15665
- module.exports = toString
15666
-
15667
- function toString(node) {
15668
- // “The concatenation of data of all the Text node descendants of the context
15669
- // object, in tree order.”
15670
- if ('children' in node) {
15671
- return all(node)
15672
- }
15673
-
15674
- // “Context object’s data.”
15675
- return 'value' in node ? node.value : ''
15676
- }
15677
-
15678
- function one(node) {
15679
- if (node.type === 'text') {
15680
- return node.value
15681
- }
15682
-
15683
- return node.children ? all(node) : ''
15684
- }
15685
-
15686
- function all(node) {
15687
- var children = node.children
15688
- var length = children.length
15689
- var index = -1
15690
- var result = []
15691
-
15692
- while (++index < length) {
15693
- result[index] = one(children[index])
15694
- }
15695
-
15696
- return result.join('')
15697
- }
15698
-
15699
-
15700
15727
  /***/ }),
15701
15728
 
15702
15729
  /***/ 3560:
@@ -34426,7 +34453,7 @@ var unified = __webpack_require__(8835);
34426
34453
  */
34427
34454
 
34428
34455
 
34429
- var sanitize = __webpack_require__(8229);
34456
+ var createSchema = __webpack_require__(8229);
34430
34457
 
34431
34458
  var generateTOC = __webpack_require__(3263);
34432
34459
 
@@ -34478,14 +34505,13 @@ var GlossaryItem = Components.GlossaryItem,
34478
34505
  Image = Components.Image,
34479
34506
  Embed = Components.Embed,
34480
34507
  HTMLBlock = Components.HTMLBlock,
34508
+ Style = Components.Style,
34481
34509
  TableOfContents = Components.TableOfContents;
34482
34510
 
34483
34511
  /* Custom Unified Parsers
34484
34512
  */
34485
34513
 
34486
- var customParsers = Object.values(__webpack_require__(1332)).map(function (parser) {
34487
- return parser.sanitize(sanitize);
34488
- });
34514
+ var CustomParsers = Object.values(__webpack_require__(1332));
34489
34515
  /* Custom Unified Compilers
34490
34516
  */
34491
34517
 
@@ -34509,14 +34535,23 @@ var _require2 = __webpack_require__(2531),
34509
34535
 
34510
34536
  var registerCustomComponents = __webpack_require__(1264);
34511
34537
  /**
34512
- * Normalize Magic Block Raw Text
34538
+ * Setup Options
34539
+ * !Normalize Magic Block Raw Text!
34513
34540
  */
34514
34541
 
34515
34542
 
34516
34543
  function setup(blocks) {
34517
34544
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34518
34545
  // merge default and user options
34519
- opts = parseOptions(opts); // normalize magic block linebreaks
34546
+ opts = parseOptions(opts);
34547
+
34548
+ if (!opts.sanitize) {
34549
+ opts.sanitize = createSchema(opts);
34550
+ Object.values(Components).forEach(function (Component) {
34551
+ return Component.sanitize && Component.sanitize(opts.sanitize);
34552
+ });
34553
+ } // normalize magic block linebreaks
34554
+
34520
34555
 
34521
34556
  if (opts.normalize && blocks) {
34522
34557
  blocks = blocks.replace(/\[block:/g, '\n\n[block:').replace(/\[\/block\]/g, '[/block]\n');
@@ -34542,25 +34577,16 @@ var utils = {
34542
34577
  function processor() {
34543
34578
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
34544
34579
 
34545
- /*
34546
- * This is kinda complicated: "markdown" within ReadMe is
34547
- * often more than just markdown. It can also include HTML,
34548
- * as well as custom syntax constructs such as <<variables>>,
34549
- * and other special features.
34550
- *
34551
- * We use the Unified text processor to parse and transform
34552
- * Markdown to various output formats, such as a React component
34553
- * tree. (See https://github.com/unifiedjs/unified for more.)
34554
- *
34555
- * The order for processing ReadMe-flavored markdown is as follows:
34556
- * - parse markdown
34557
- * - parse custom syntaxes add-ons using custom compilers
34558
- * - convert from a remark mdast (markdown ast) to a rehype hast (hypertext ast)
34559
- * - extract any raw HTML elements
34560
- * - sanitize and remove any disallowed attributes
34561
- * - output the hast to a React vdom with our custom components
34562
- */
34563
- return unified().use(remarkParse, opts.markdownOptions).use(remarkFrontmatter, ['yaml', 'toml']).data('settings', opts.settings).data('compatibilityMode', opts.compatibilityMode).use(!opts.correctnewlines ? remarkBreaks : function () {}).use(customParsers).use(remarkSlug).use(remarkDisableTokenizers, opts.disableTokenizers).use(remarkRehype, {
34580
+ var _setup = setup('', opts);
34581
+
34582
+ var _setup2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup, 2);
34583
+
34584
+ opts = _setup2[1];
34585
+ var _opts = opts,
34586
+ sanitize = _opts.sanitize;
34587
+ return unified().use(remarkParse, opts.markdownOptions).use(remarkFrontmatter, ['yaml', 'toml']).data('settings', opts.settings).data('compatibilityMode', opts.compatibilityMode).use(!opts.correctnewlines ? remarkBreaks : function () {}).use(CustomParsers.map(function (parser) {
34588
+ return parser.sanitize(sanitize);
34589
+ })).use(remarkSlug).use(remarkDisableTokenizers, opts.disableTokenizers).use(remarkRehype, {
34564
34590
  allowDangerousHtml: true
34565
34591
  }).use(rehypeRaw).use(rehypeSanitize, sanitize);
34566
34592
  }
@@ -34569,12 +34595,12 @@ function plain(text) {
34569
34595
  var components = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
34570
34596
  if (!text) return null;
34571
34597
 
34572
- var _setup = setup(text, opts);
34598
+ var _setup3 = setup(text, opts);
34573
34599
 
34574
- var _setup2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup, 2);
34600
+ var _setup4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup3, 2);
34575
34601
 
34576
- text = _setup2[0];
34577
- opts = _setup2[1];
34602
+ text = _setup4[0];
34603
+ opts = _setup4[1];
34578
34604
  return processor(opts).use(rehypeReact, {
34579
34605
  createElement: React.createElement,
34580
34606
  Fragment: React.Fragment,
@@ -34598,46 +34624,57 @@ var count = {};
34598
34624
  function reactProcessor() {
34599
34625
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
34600
34626
  var components = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34601
- return processor(opts).use(sectionAnchorId).use(rehypeReact, {
34627
+
34628
+ var _setup5 = setup('', opts);
34629
+
34630
+ var _setup6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup5, 2);
34631
+
34632
+ opts = _setup6[1];
34633
+ var _opts2 = opts,
34634
+ sanitize = _opts2.sanitize;
34635
+ return processor(_objectSpread({
34636
+ sanitize: sanitize
34637
+ }, opts)).use(sectionAnchorId).use(rehypeReact, {
34602
34638
  createElement: React.createElement,
34603
34639
  Fragment: React.Fragment,
34604
34640
  components: _objectSpread({
34605
- 'code-tabs': CodeTabs(sanitize, opts),
34606
- 'html-block': HTMLBlock(sanitize, opts),
34607
- 'rdme-callout': Callout(sanitize),
34641
+ 'code-tabs': CodeTabs(opts),
34642
+ 'html-block': HTMLBlock(opts),
34643
+ 'rdme-callout': Callout,
34608
34644
  'readme-variable': Variable,
34609
34645
  'readme-glossary-item': GlossaryItem,
34610
- 'rdme-embed': Embed(sanitize),
34646
+ 'rdme-embed': Embed,
34611
34647
  'rdme-pin': PinWrap,
34612
- table: Table(sanitize),
34613
- a: Anchor(sanitize),
34648
+ table: Table,
34649
+ a: Anchor,
34614
34650
  h1: Heading(1, count, opts),
34615
34651
  h2: Heading(2, count, opts),
34616
34652
  h3: Heading(3, count, opts),
34617
34653
  h4: Heading(4, count, opts),
34618
34654
  h5: Heading(5, count, opts),
34619
34655
  h6: Heading(6, count, opts),
34620
- code: Code(sanitize, opts),
34621
- img: Image(sanitize)
34622
- }, registerCustomComponents(components, opts.customComponentPrefix))
34656
+ code: Code(opts),
34657
+ img: Image,
34658
+ style: Style(opts)
34659
+ }, registerCustomComponents(components, sanitize, opts.customComponentPrefix))
34623
34660
  });
34624
34661
  }
34625
34662
  function react(content) {
34626
34663
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34627
34664
  var components = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
34628
34665
  if (!content) return null;else if (typeof content === 'string') {
34629
- var _setup3 = setup(content, opts);
34666
+ var _setup7 = setup(content, opts);
34630
34667
 
34631
- var _setup4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup3, 2);
34668
+ var _setup8 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup7, 2);
34632
34669
 
34633
- content = _setup4[0];
34634
- opts = _setup4[1];
34670
+ content = _setup8[0];
34671
+ opts = _setup8[1];
34635
34672
  } else {
34636
- var _setup5 = setup('', opts);
34673
+ var _setup9 = setup('', opts);
34637
34674
 
34638
- var _setup6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup5, 2);
34675
+ var _setup10 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup9, 2);
34639
34676
 
34640
- opts = _setup6[1];
34677
+ opts = _setup10[1];
34641
34678
  }
34642
34679
  var proc = reactProcessor(opts, components);
34643
34680
  if (typeof content === 'string') content = proc.parse(content);
@@ -34647,11 +34684,11 @@ function reactTOC(tree) {
34647
34684
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34648
34685
  if (!tree) return null;
34649
34686
 
34650
- var _setup7 = setup('', opts);
34687
+ var _setup11 = setup('', opts);
34651
34688
 
34652
- var _setup8 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup7, 2);
34689
+ var _setup12 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup11, 2);
34653
34690
 
34654
- opts = _setup8[1];
34691
+ opts = _setup12[1];
34655
34692
  var proc = processor(opts).use(rehypeReact, {
34656
34693
  createElement: React.createElement,
34657
34694
  components: {
@@ -34684,12 +34721,12 @@ function html(text) {
34684
34721
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34685
34722
  if (!text) return null;
34686
34723
 
34687
- var _setup9 = setup(text, opts);
34724
+ var _setup13 = setup(text, opts);
34688
34725
 
34689
- var _setup10 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup9, 2);
34726
+ var _setup14 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup13, 2);
34690
34727
 
34691
- text = _setup10[0];
34692
- opts = _setup10[1];
34728
+ text = _setup14[0];
34729
+ opts = _setup14[1];
34693
34730
  return processor(opts).use(rehypeStringify).processSync(text).contents;
34694
34731
  }
34695
34732
  /**
@@ -34700,12 +34737,12 @@ function hast(text) {
34700
34737
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34701
34738
  if (!text) return null;
34702
34739
 
34703
- var _setup11 = setup(text, opts);
34740
+ var _setup15 = setup(text, opts);
34704
34741
 
34705
- var _setup12 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup11, 2);
34742
+ var _setup16 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup15, 2);
34706
34743
 
34707
- text = _setup12[0];
34708
- opts = _setup12[1];
34744
+ text = _setup16[0];
34745
+ opts = _setup16[1];
34709
34746
  var rdmd = processor(opts).use(tableFlattening);
34710
34747
  var node = rdmd.parse(text);
34711
34748
  return rdmd.runSync(node);
@@ -34718,12 +34755,12 @@ function mdast(text) {
34718
34755
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34719
34756
  if (!text) return null;
34720
34757
 
34721
- var _setup13 = setup(text, opts);
34758
+ var _setup17 = setup(text, opts);
34722
34759
 
34723
- var _setup14 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup13, 2);
34760
+ var _setup18 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup17, 2);
34724
34761
 
34725
- text = _setup14[0];
34726
- opts = _setup14[1];
34762
+ text = _setup18[0];
34763
+ opts = _setup18[1];
34727
34764
  return processor(opts).parse(text);
34728
34765
  }
34729
34766
  /**
@@ -34734,12 +34771,12 @@ function astToPlainText(node) {
34734
34771
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34735
34772
  if (!node) return '';
34736
34773
 
34737
- var _setup15 = setup('', opts);
34774
+ var _setup19 = setup('', opts);
34738
34775
 
34739
- var _setup16 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup15, 2);
34776
+ var _setup20 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup19, 2);
34740
34777
 
34741
- opts = _setup16[1];
34742
- return processor(opts).use(toPlainText).runSync(node);
34778
+ opts = _setup20[1];
34779
+ return processor(opts).use(toPlainText).stringify(node);
34743
34780
  }
34744
34781
  /**
34745
34782
  * compile mdast to ReadMe-flavored markdown
@@ -34749,11 +34786,11 @@ function md(tree) {
34749
34786
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34750
34787
  if (!tree) return null;
34751
34788
 
34752
- var _setup17 = setup('', opts);
34789
+ var _setup21 = setup('', opts);
34753
34790
 
34754
- var _setup18 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup17, 2);
34791
+ var _setup22 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_setup21, 2);
34755
34792
 
34756
- opts = _setup18[1];
34793
+ opts = _setup22[1];
34757
34794
  return processor(opts).use(remarkStringify, opts.markdownOptions).use(customCompilers).stringify(tree);
34758
34795
  }
34759
34796