@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.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],
@@ -28093,7 +28137,7 @@ var _require = __webpack_require__(7589),
28093
28137
 
28094
28138
  var compileImage = function compileImage(image) {
28095
28139
  var img = _objectSpread(_objectSpread({
28096
- image: [image.url, image.title]
28140
+ image: [image.url, image.title, image.alt]
28097
28141
  }, image.data.hProperties.width && {
28098
28142
  sizing: imgSizeByWidth[image.data.hProperties.width]
28099
28143
  }), image.border && {
@@ -28965,15 +29009,16 @@ function tokenize(eat, value) {
28965
29009
  var imgs = json.images.map(function (img) {
28966
29010
  if (!('image' in img)) return null;
28967
29011
 
28968
- var _img$image = _slicedToArray(img.image, 2),
29012
+ var _img$image = _slicedToArray(img.image, 3),
28969
29013
  url = _img$image[0],
28970
- title = _img$image[1];
29014
+ title = _img$image[1],
29015
+ alt = _img$image[2];
28971
29016
 
28972
29017
  var block = {
28973
29018
  type: 'image',
28974
29019
  url: url,
28975
29020
  title: title,
28976
- alt: 'caption' in img ? img.caption : '',
29021
+ alt: alt || ('caption' in img ? img.caption : ''),
28977
29022
  data: {
28978
29023
  hProperties: _objectSpread({
28979
29024
  className: img.border ? 'border' : ''
@@ -29260,16 +29305,51 @@ module.exports.sanitize = function (sanitizeSchema) {
29260
29305
  /***/ }),
29261
29306
 
29262
29307
  /***/ 4792:
29263
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29308
+ /***/ ((module) => {
29309
+
29310
+ /* @note: copied from https://github.com/rehypejs/rehype-minify/blob/main/packages/hast-util-to-string/index.js
29311
+ */
29312
+ function toString(node) {
29313
+ if ('children' in node) {
29314
+ // eslint-disable-next-line no-use-before-define
29315
+ return all(node);
29316
+ }
29264
29317
 
29265
- var toString = __webpack_require__(6034);
29318
+ return 'value' in node ? node.value : ' ';
29319
+ }
29266
29320
 
29267
- module.exports = function () {
29268
- return function compile(node) {
29269
- return toString(node);
29270
- };
29321
+ function one(node) {
29322
+ if (node.type === 'text') {
29323
+ return node.value;
29324
+ } // eslint-disable-next-line no-use-before-define
29325
+
29326
+
29327
+ return 'children' in node ? all(node) : ' ';
29328
+ }
29329
+
29330
+ function all(node) {
29331
+ var index = -1;
29332
+ var result = []; // eslint-disable-next-line no-plusplus
29333
+
29334
+ while (++index < node.children.length) {
29335
+ result[index] = one(node.children[index]);
29336
+ }
29337
+
29338
+ return result.join(' ').trim().replace(/ +/, ' ');
29339
+ }
29340
+
29341
+ var Compiler = function Compiler(node) {
29342
+ return toString(node);
29343
+ };
29344
+
29345
+ var toPlainText = function toPlainText() {
29346
+ Object.assign(this, {
29347
+ Compiler: Compiler
29348
+ });
29271
29349
  };
29272
29350
 
29351
+ module.exports = toPlainText;
29352
+
29273
29353
  /***/ }),
29274
29354
 
29275
29355
  /***/ 9620:
@@ -29396,22 +29476,35 @@ module.exports.tableFlattening = transformer;
29396
29476
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
29397
29477
 
29398
29478
  var _require = __webpack_require__(2781),
29399
- sanitize = _require.defaultSchema; // Sanitization Schema Defaults
29479
+ defaultSchema = _require.defaultSchema;
29480
+
29481
+ var createSchema = function createSchema() {
29482
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
29483
+ safeMode = _ref.safeMode;
29400
29484
 
29485
+ var schema = JSON.parse(JSON.stringify(defaultSchema)); // Sanitization Schema Defaults
29401
29486
 
29402
- sanitize.clobberPrefix = '';
29403
- sanitize.tagNames.push('span', 'style');
29404
- sanitize.attributes['*'].push('class', 'className', 'align', 'style');
29405
- sanitize.tagNames.push('rdme-pin');
29406
- sanitize.tagNames.push('rdme-embed');
29407
- sanitize.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon'];
29408
- sanitize.attributes.a = ['href', 'title', 'class', 'className', 'download'];
29409
- sanitize.tagNames.push('figure');
29410
- sanitize.tagNames.push('figcaption');
29411
- sanitize.tagNames.push('input'); // allow GitHub-style todo lists
29487
+ schema.clobberPrefix = '';
29488
+ schema.tagNames.push('span');
29489
+ schema.attributes['*'].push('class', 'className', 'align');
29490
+
29491
+ if (!safeMode) {
29492
+ schema.attributes['*'].push('style');
29493
+ }
29494
+
29495
+ schema.tagNames.push('rdme-pin');
29496
+ schema.tagNames.push('rdme-embed');
29497
+ schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon'];
29498
+ schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
29499
+ schema.tagNames.push('figure');
29500
+ schema.tagNames.push('figcaption');
29501
+ schema.tagNames.push('input'); // allow GitHub-style todo lists
29502
+
29503
+ schema.ancestors.input = ['li'];
29504
+ return schema;
29505
+ };
29412
29506
 
29413
- sanitize.ancestors.input = ['li'];
29414
- module.exports = sanitize;
29507
+ module.exports = createSchema;
29415
29508
 
29416
29509
  /***/ }),
29417
29510
 
@@ -32809,72 +32902,6 @@ function isLiteral(node) {
32809
32902
  }
32810
32903
 
32811
32904
 
32812
- /***/ }),
32813
-
32814
- /***/ 6034:
32815
- /***/ ((module) => {
32816
-
32817
- "use strict";
32818
- /**
32819
- * @fileoverview
32820
- * Get the plain-text value of a hast node.
32821
- * @longdescription
32822
- * ## Use
32823
- *
32824
- * ```js
32825
- * var h = require('hastscript')
32826
- * var toString = require('hast-util-to-string')
32827
- *
32828
- * toString(h('p', 'Alpha'))
32829
- * //=> 'Alpha'
32830
- * toString(h('div', [h('b', 'Bold'), ' and ', h('i', 'italic'), '.']))
32831
- * //=> 'Bold and italic.'
32832
- * ```
32833
- *
32834
- * ## API
32835
- *
32836
- * ### `toString(node)`
32837
- *
32838
- * Transform a node to a string.
32839
- */
32840
-
32841
-
32842
-
32843
- module.exports = toString
32844
-
32845
- function toString(node) {
32846
- // “The concatenation of data of all the Text node descendants of the context
32847
- // object, in tree order.”
32848
- if ('children' in node) {
32849
- return all(node)
32850
- }
32851
-
32852
- // “Context object’s data.”
32853
- return 'value' in node ? node.value : ''
32854
- }
32855
-
32856
- function one(node) {
32857
- if (node.type === 'text') {
32858
- return node.value
32859
- }
32860
-
32861
- return node.children ? all(node) : ''
32862
- }
32863
-
32864
- function all(node) {
32865
- var children = node.children
32866
- var length = children.length
32867
- var index = -1
32868
- var result = []
32869
-
32870
- while (++index < length) {
32871
- result[index] = one(children[index])
32872
- }
32873
-
32874
- return result.join('')
32875
- }
32876
-
32877
-
32878
32905
  /***/ }),
32879
32906
 
32880
32907
  /***/ 3560:
@@ -52081,7 +52108,7 @@ var unified = __webpack_require__(8835);
52081
52108
  */
52082
52109
 
52083
52110
 
52084
- var sanitize = __webpack_require__(8229);
52111
+ var createSchema = __webpack_require__(8229);
52085
52112
 
52086
52113
  var generateTOC = __webpack_require__(3263);
52087
52114
 
@@ -52133,14 +52160,13 @@ var GlossaryItem = Components.GlossaryItem,
52133
52160
  Image = Components.Image,
52134
52161
  Embed = Components.Embed,
52135
52162
  HTMLBlock = Components.HTMLBlock,
52163
+ Style = Components.Style,
52136
52164
  TableOfContents = Components.TableOfContents;
52137
52165
 
52138
52166
  /* Custom Unified Parsers
52139
52167
  */
52140
52168
 
52141
- var customParsers = Object.values(__webpack_require__(1332)).map(function (parser) {
52142
- return parser.sanitize(sanitize);
52143
- });
52169
+ var CustomParsers = Object.values(__webpack_require__(1332));
52144
52170
  /* Custom Unified Compilers
52145
52171
  */
52146
52172
 
@@ -52164,14 +52190,23 @@ var _require2 = __webpack_require__(2531),
52164
52190
 
52165
52191
  var registerCustomComponents = __webpack_require__(1264);
52166
52192
  /**
52167
- * Normalize Magic Block Raw Text
52193
+ * Setup Options
52194
+ * !Normalize Magic Block Raw Text!
52168
52195
  */
52169
52196
 
52170
52197
 
52171
52198
  function setup(blocks) {
52172
52199
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52173
52200
  // merge default and user options
52174
- opts = parseOptions(opts); // normalize magic block linebreaks
52201
+ opts = parseOptions(opts);
52202
+
52203
+ if (!opts.sanitize) {
52204
+ opts.sanitize = createSchema(opts);
52205
+ Object.values(Components).forEach(function (Component) {
52206
+ return Component.sanitize && Component.sanitize(opts.sanitize);
52207
+ });
52208
+ } // normalize magic block linebreaks
52209
+
52175
52210
 
52176
52211
  if (opts.normalize && blocks) {
52177
52212
  blocks = blocks.replace(/\[block:/g, '\n\n[block:').replace(/\[\/block\]/g, '[/block]\n');
@@ -52197,25 +52232,16 @@ var utils = {
52197
52232
  function processor() {
52198
52233
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
52199
52234
 
52200
- /*
52201
- * This is kinda complicated: "markdown" within ReadMe is
52202
- * often more than just markdown. It can also include HTML,
52203
- * as well as custom syntax constructs such as <<variables>>,
52204
- * and other special features.
52205
- *
52206
- * We use the Unified text processor to parse and transform
52207
- * Markdown to various output formats, such as a React component
52208
- * tree. (See https://github.com/unifiedjs/unified for more.)
52209
- *
52210
- * The order for processing ReadMe-flavored markdown is as follows:
52211
- * - parse markdown
52212
- * - parse custom syntaxes add-ons using custom compilers
52213
- * - convert from a remark mdast (markdown ast) to a rehype hast (hypertext ast)
52214
- * - extract any raw HTML elements
52215
- * - sanitize and remove any disallowed attributes
52216
- * - output the hast to a React vdom with our custom components
52217
- */
52218
- 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, {
52235
+ var _setup = setup('', opts);
52236
+
52237
+ var _setup2 = _slicedToArray(_setup, 2);
52238
+
52239
+ opts = _setup2[1];
52240
+ var _opts = opts,
52241
+ sanitize = _opts.sanitize;
52242
+ 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) {
52243
+ return parser.sanitize(sanitize);
52244
+ })).use(remarkSlug).use(remarkDisableTokenizers, opts.disableTokenizers).use(remarkRehype, {
52219
52245
  allowDangerousHtml: true
52220
52246
  }).use(rehypeRaw).use(rehypeSanitize, sanitize);
52221
52247
  }
@@ -52224,12 +52250,12 @@ function plain(text) {
52224
52250
  var components = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
52225
52251
  if (!text) return null;
52226
52252
 
52227
- var _setup = setup(text, opts);
52253
+ var _setup3 = setup(text, opts);
52228
52254
 
52229
- var _setup2 = _slicedToArray(_setup, 2);
52255
+ var _setup4 = _slicedToArray(_setup3, 2);
52230
52256
 
52231
- text = _setup2[0];
52232
- opts = _setup2[1];
52257
+ text = _setup4[0];
52258
+ opts = _setup4[1];
52233
52259
  return processor(opts).use(rehypeReact, {
52234
52260
  createElement: React.createElement,
52235
52261
  Fragment: React.Fragment,
@@ -52253,46 +52279,57 @@ var count = {};
52253
52279
  function reactProcessor() {
52254
52280
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
52255
52281
  var components = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52256
- return processor(opts).use(sectionAnchorId).use(rehypeReact, {
52282
+
52283
+ var _setup5 = setup('', opts);
52284
+
52285
+ var _setup6 = _slicedToArray(_setup5, 2);
52286
+
52287
+ opts = _setup6[1];
52288
+ var _opts2 = opts,
52289
+ sanitize = _opts2.sanitize;
52290
+ return processor(_objectSpread({
52291
+ sanitize: sanitize
52292
+ }, opts)).use(sectionAnchorId).use(rehypeReact, {
52257
52293
  createElement: React.createElement,
52258
52294
  Fragment: React.Fragment,
52259
52295
  components: _objectSpread({
52260
- 'code-tabs': CodeTabs(sanitize, opts),
52261
- 'html-block': HTMLBlock(sanitize, opts),
52262
- 'rdme-callout': Callout(sanitize),
52296
+ 'code-tabs': CodeTabs(opts),
52297
+ 'html-block': HTMLBlock(opts),
52298
+ 'rdme-callout': Callout,
52263
52299
  'readme-variable': Variable,
52264
52300
  'readme-glossary-item': GlossaryItem,
52265
- 'rdme-embed': Embed(sanitize),
52301
+ 'rdme-embed': Embed,
52266
52302
  'rdme-pin': PinWrap,
52267
- table: Table(sanitize),
52268
- a: Anchor(sanitize),
52303
+ table: Table,
52304
+ a: Anchor,
52269
52305
  h1: Heading(1, count, opts),
52270
52306
  h2: Heading(2, count, opts),
52271
52307
  h3: Heading(3, count, opts),
52272
52308
  h4: Heading(4, count, opts),
52273
52309
  h5: Heading(5, count, opts),
52274
52310
  h6: Heading(6, count, opts),
52275
- code: Code(sanitize, opts),
52276
- img: Image(sanitize)
52277
- }, registerCustomComponents(components, opts.customComponentPrefix))
52311
+ code: Code(opts),
52312
+ img: Image,
52313
+ style: Style(opts)
52314
+ }, registerCustomComponents(components, sanitize, opts.customComponentPrefix))
52278
52315
  });
52279
52316
  }
52280
52317
  function react(content) {
52281
52318
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52282
52319
  var components = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
52283
52320
  if (!content) return null;else if (typeof content === 'string') {
52284
- var _setup3 = setup(content, opts);
52321
+ var _setup7 = setup(content, opts);
52285
52322
 
52286
- var _setup4 = _slicedToArray(_setup3, 2);
52323
+ var _setup8 = _slicedToArray(_setup7, 2);
52287
52324
 
52288
- content = _setup4[0];
52289
- opts = _setup4[1];
52325
+ content = _setup8[0];
52326
+ opts = _setup8[1];
52290
52327
  } else {
52291
- var _setup5 = setup('', opts);
52328
+ var _setup9 = setup('', opts);
52292
52329
 
52293
- var _setup6 = _slicedToArray(_setup5, 2);
52330
+ var _setup10 = _slicedToArray(_setup9, 2);
52294
52331
 
52295
- opts = _setup6[1];
52332
+ opts = _setup10[1];
52296
52333
  }
52297
52334
  var proc = reactProcessor(opts, components);
52298
52335
  if (typeof content === 'string') content = proc.parse(content);
@@ -52302,11 +52339,11 @@ function reactTOC(tree) {
52302
52339
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52303
52340
  if (!tree) return null;
52304
52341
 
52305
- var _setup7 = setup('', opts);
52342
+ var _setup11 = setup('', opts);
52306
52343
 
52307
- var _setup8 = _slicedToArray(_setup7, 2);
52344
+ var _setup12 = _slicedToArray(_setup11, 2);
52308
52345
 
52309
- opts = _setup8[1];
52346
+ opts = _setup12[1];
52310
52347
  var proc = processor(opts).use(rehypeReact, {
52311
52348
  createElement: React.createElement,
52312
52349
  components: {
@@ -52339,12 +52376,12 @@ function html(text) {
52339
52376
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52340
52377
  if (!text) return null;
52341
52378
 
52342
- var _setup9 = setup(text, opts);
52379
+ var _setup13 = setup(text, opts);
52343
52380
 
52344
- var _setup10 = _slicedToArray(_setup9, 2);
52381
+ var _setup14 = _slicedToArray(_setup13, 2);
52345
52382
 
52346
- text = _setup10[0];
52347
- opts = _setup10[1];
52383
+ text = _setup14[0];
52384
+ opts = _setup14[1];
52348
52385
  return processor(opts).use(rehypeStringify).processSync(text).contents;
52349
52386
  }
52350
52387
  /**
@@ -52355,12 +52392,12 @@ function hast(text) {
52355
52392
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52356
52393
  if (!text) return null;
52357
52394
 
52358
- var _setup11 = setup(text, opts);
52395
+ var _setup15 = setup(text, opts);
52359
52396
 
52360
- var _setup12 = _slicedToArray(_setup11, 2);
52397
+ var _setup16 = _slicedToArray(_setup15, 2);
52361
52398
 
52362
- text = _setup12[0];
52363
- opts = _setup12[1];
52399
+ text = _setup16[0];
52400
+ opts = _setup16[1];
52364
52401
  var rdmd = processor(opts).use(tableFlattening);
52365
52402
  var node = rdmd.parse(text);
52366
52403
  return rdmd.runSync(node);
@@ -52373,12 +52410,12 @@ function mdast(text) {
52373
52410
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52374
52411
  if (!text) return null;
52375
52412
 
52376
- var _setup13 = setup(text, opts);
52413
+ var _setup17 = setup(text, opts);
52377
52414
 
52378
- var _setup14 = _slicedToArray(_setup13, 2);
52415
+ var _setup18 = _slicedToArray(_setup17, 2);
52379
52416
 
52380
- text = _setup14[0];
52381
- opts = _setup14[1];
52417
+ text = _setup18[0];
52418
+ opts = _setup18[1];
52382
52419
  return processor(opts).parse(text);
52383
52420
  }
52384
52421
  /**
@@ -52389,12 +52426,12 @@ function astToPlainText(node) {
52389
52426
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52390
52427
  if (!node) return '';
52391
52428
 
52392
- var _setup15 = setup('', opts);
52429
+ var _setup19 = setup('', opts);
52393
52430
 
52394
- var _setup16 = _slicedToArray(_setup15, 2);
52431
+ var _setup20 = _slicedToArray(_setup19, 2);
52395
52432
 
52396
- opts = _setup16[1];
52397
- return processor(opts).use(toPlainText).runSync(node);
52433
+ opts = _setup20[1];
52434
+ return processor(opts).use(toPlainText).stringify(node);
52398
52435
  }
52399
52436
  /**
52400
52437
  * compile mdast to ReadMe-flavored markdown
@@ -52404,11 +52441,11 @@ function md(tree) {
52404
52441
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52405
52442
  if (!tree) return null;
52406
52443
 
52407
- var _setup17 = setup('', opts);
52444
+ var _setup21 = setup('', opts);
52408
52445
 
52409
- var _setup18 = _slicedToArray(_setup17, 2);
52446
+ var _setup22 = _slicedToArray(_setup21, 2);
52410
52447
 
52411
- opts = _setup18[1];
52448
+ opts = _setup22[1];
52412
52449
  return processor(opts).use(remarkStringify, opts.markdownOptions).use(customCompilers).stringify(tree);
52413
52450
  }
52414
52451