@readme/markdown 6.43.0 → 6.44.0

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.
@@ -2,6 +2,7 @@
2
2
  */
3
3
  const React = require('react');
4
4
  const PropTypes = require('prop-types');
5
+ const escape = require('lodash.escape');
5
6
 
6
7
  const MATCH_SCRIPT_TAGS = /<script\b[^>]*>([\s\S]*?)<\/script *>\n?/gim;
7
8
 
@@ -32,7 +33,7 @@ class HTMLBlock extends React.Component {
32
33
  if (safeMode) {
33
34
  return (
34
35
  <pre className="html-unsafe">
35
- <code>{html}</code>
36
+ <code dangerouslySetInnerHTML={{ __html: escape(html) }} />
36
37
  </pre>
37
38
  );
38
39
  }
package/dist/main.js CHANGED
@@ -9713,6 +9713,8 @@ var React = __webpack_require__(4466);
9713
9713
 
9714
9714
  var PropTypes = __webpack_require__(5697);
9715
9715
 
9716
+ var escape = __webpack_require__(8686);
9717
+
9716
9718
  var MATCH_SCRIPT_TAGS = /<script\b[^>]*>([\s\S]*?)<\/script *>\n?/gim;
9717
9719
 
9718
9720
  var extractScripts = function extractScripts() {
@@ -9771,7 +9773,11 @@ var HTMLBlock = /*#__PURE__*/function (_React$Component) {
9771
9773
  if (safeMode) {
9772
9774
  return /*#__PURE__*/React.createElement("pre", {
9773
9775
  className: "html-unsafe"
9774
- }, /*#__PURE__*/React.createElement("code", null, html));
9776
+ }, /*#__PURE__*/React.createElement("code", {
9777
+ dangerouslySetInnerHTML: {
9778
+ __html: escape(html)
9779
+ }
9780
+ }));
9775
9781
  }
9776
9782
 
9777
9783
  return /*#__PURE__*/React.createElement("div", {
@@ -33628,6 +33634,227 @@ function wordCharacter(character) {
33628
33634
  }
33629
33635
 
33630
33636
 
33637
+ /***/ }),
33638
+
33639
+ /***/ 8686:
33640
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
33641
+
33642
+ /**
33643
+ * lodash (Custom Build) <https://lodash.com/>
33644
+ * Build: `lodash modularize exports="npm" -o ./`
33645
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
33646
+ * Released under MIT license <https://lodash.com/license>
33647
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
33648
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
33649
+ */
33650
+
33651
+ /** Used as references for various `Number` constants. */
33652
+ var INFINITY = 1 / 0;
33653
+
33654
+ /** `Object#toString` result references. */
33655
+ var symbolTag = '[object Symbol]';
33656
+
33657
+ /** Used to match HTML entities and HTML characters. */
33658
+ var reUnescapedHtml = /[&<>"'`]/g,
33659
+ reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
33660
+
33661
+ /** Used to map characters to HTML entities. */
33662
+ var htmlEscapes = {
33663
+ '&': '&amp;',
33664
+ '<': '&lt;',
33665
+ '>': '&gt;',
33666
+ '"': '&quot;',
33667
+ "'": '&#39;',
33668
+ '`': '&#96;'
33669
+ };
33670
+
33671
+ /** Detect free variable `global` from Node.js. */
33672
+ var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
33673
+
33674
+ /** Detect free variable `self`. */
33675
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
33676
+
33677
+ /** Used as a reference to the global object. */
33678
+ var root = freeGlobal || freeSelf || Function('return this')();
33679
+
33680
+ /**
33681
+ * The base implementation of `_.propertyOf` without support for deep paths.
33682
+ *
33683
+ * @private
33684
+ * @param {Object} object The object to query.
33685
+ * @returns {Function} Returns the new accessor function.
33686
+ */
33687
+ function basePropertyOf(object) {
33688
+ return function(key) {
33689
+ return object == null ? undefined : object[key];
33690
+ };
33691
+ }
33692
+
33693
+ /**
33694
+ * Used by `_.escape` to convert characters to HTML entities.
33695
+ *
33696
+ * @private
33697
+ * @param {string} chr The matched character to escape.
33698
+ * @returns {string} Returns the escaped character.
33699
+ */
33700
+ var escapeHtmlChar = basePropertyOf(htmlEscapes);
33701
+
33702
+ /** Used for built-in method references. */
33703
+ var objectProto = Object.prototype;
33704
+
33705
+ /**
33706
+ * Used to resolve the
33707
+ * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
33708
+ * of values.
33709
+ */
33710
+ var objectToString = objectProto.toString;
33711
+
33712
+ /** Built-in value references. */
33713
+ var Symbol = root.Symbol;
33714
+
33715
+ /** Used to convert symbols to primitives and strings. */
33716
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
33717
+ symbolToString = symbolProto ? symbolProto.toString : undefined;
33718
+
33719
+ /**
33720
+ * The base implementation of `_.toString` which doesn't convert nullish
33721
+ * values to empty strings.
33722
+ *
33723
+ * @private
33724
+ * @param {*} value The value to process.
33725
+ * @returns {string} Returns the string.
33726
+ */
33727
+ function baseToString(value) {
33728
+ // Exit early for strings to avoid a performance hit in some environments.
33729
+ if (typeof value == 'string') {
33730
+ return value;
33731
+ }
33732
+ if (isSymbol(value)) {
33733
+ return symbolToString ? symbolToString.call(value) : '';
33734
+ }
33735
+ var result = (value + '');
33736
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
33737
+ }
33738
+
33739
+ /**
33740
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
33741
+ * and has a `typeof` result of "object".
33742
+ *
33743
+ * @static
33744
+ * @memberOf _
33745
+ * @since 4.0.0
33746
+ * @category Lang
33747
+ * @param {*} value The value to check.
33748
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
33749
+ * @example
33750
+ *
33751
+ * _.isObjectLike({});
33752
+ * // => true
33753
+ *
33754
+ * _.isObjectLike([1, 2, 3]);
33755
+ * // => true
33756
+ *
33757
+ * _.isObjectLike(_.noop);
33758
+ * // => false
33759
+ *
33760
+ * _.isObjectLike(null);
33761
+ * // => false
33762
+ */
33763
+ function isObjectLike(value) {
33764
+ return !!value && typeof value == 'object';
33765
+ }
33766
+
33767
+ /**
33768
+ * Checks if `value` is classified as a `Symbol` primitive or object.
33769
+ *
33770
+ * @static
33771
+ * @memberOf _
33772
+ * @since 4.0.0
33773
+ * @category Lang
33774
+ * @param {*} value The value to check.
33775
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
33776
+ * @example
33777
+ *
33778
+ * _.isSymbol(Symbol.iterator);
33779
+ * // => true
33780
+ *
33781
+ * _.isSymbol('abc');
33782
+ * // => false
33783
+ */
33784
+ function isSymbol(value) {
33785
+ return typeof value == 'symbol' ||
33786
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
33787
+ }
33788
+
33789
+ /**
33790
+ * Converts `value` to a string. An empty string is returned for `null`
33791
+ * and `undefined` values. The sign of `-0` is preserved.
33792
+ *
33793
+ * @static
33794
+ * @memberOf _
33795
+ * @since 4.0.0
33796
+ * @category Lang
33797
+ * @param {*} value The value to process.
33798
+ * @returns {string} Returns the string.
33799
+ * @example
33800
+ *
33801
+ * _.toString(null);
33802
+ * // => ''
33803
+ *
33804
+ * _.toString(-0);
33805
+ * // => '-0'
33806
+ *
33807
+ * _.toString([1, 2, 3]);
33808
+ * // => '1,2,3'
33809
+ */
33810
+ function toString(value) {
33811
+ return value == null ? '' : baseToString(value);
33812
+ }
33813
+
33814
+ /**
33815
+ * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to
33816
+ * their corresponding HTML entities.
33817
+ *
33818
+ * **Note:** No other characters are escaped. To escape additional
33819
+ * characters use a third-party library like [_he_](https://mths.be/he).
33820
+ *
33821
+ * Though the ">" character is escaped for symmetry, characters like
33822
+ * ">" and "/" don't need escaping in HTML and have no special meaning
33823
+ * unless they're part of a tag or unquoted attribute value. See
33824
+ * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
33825
+ * (under "semi-related fun fact") for more details.
33826
+ *
33827
+ * Backticks are escaped because in IE < 9, they can break out of
33828
+ * attribute values or HTML comments. See [#59](https://html5sec.org/#59),
33829
+ * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
33830
+ * [#133](https://html5sec.org/#133) of the
33831
+ * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details.
33832
+ *
33833
+ * When working with HTML you should always
33834
+ * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
33835
+ * XSS vectors.
33836
+ *
33837
+ * @static
33838
+ * @since 0.1.0
33839
+ * @memberOf _
33840
+ * @category String
33841
+ * @param {string} [string=''] The string to escape.
33842
+ * @returns {string} Returns the escaped string.
33843
+ * @example
33844
+ *
33845
+ * _.escape('fred, barney, & pebbles');
33846
+ * // => 'fred, barney, &amp; pebbles'
33847
+ */
33848
+ function escape(string) {
33849
+ string = toString(string);
33850
+ return (string && reHasUnescapedHtml.test(string))
33851
+ ? string.replace(reUnescapedHtml, escapeHtmlChar)
33852
+ : string;
33853
+ }
33854
+
33855
+ module.exports = escape;
33856
+
33857
+
33631
33858
  /***/ }),
33632
33859
 
33633
33860
  /***/ 5683:
package/dist/main.node.js CHANGED
@@ -9713,6 +9713,8 @@ var React = __webpack_require__(4466);
9713
9713
 
9714
9714
  var PropTypes = __webpack_require__(5697);
9715
9715
 
9716
+ var escape = __webpack_require__(8686);
9717
+
9716
9718
  var MATCH_SCRIPT_TAGS = /<script\b[^>]*>([\s\S]*?)<\/script *>\n?/gim;
9717
9719
 
9718
9720
  var extractScripts = function extractScripts() {
@@ -9771,7 +9773,11 @@ var HTMLBlock = /*#__PURE__*/function (_React$Component) {
9771
9773
  if (safeMode) {
9772
9774
  return /*#__PURE__*/React.createElement("pre", {
9773
9775
  className: "html-unsafe"
9774
- }, /*#__PURE__*/React.createElement("code", null, html));
9776
+ }, /*#__PURE__*/React.createElement("code", {
9777
+ dangerouslySetInnerHTML: {
9778
+ __html: escape(html)
9779
+ }
9780
+ }));
9775
9781
  }
9776
9782
 
9777
9783
  return /*#__PURE__*/React.createElement("div", {
@@ -16466,6 +16472,227 @@ function wordCharacter(character) {
16466
16472
  }
16467
16473
 
16468
16474
 
16475
+ /***/ }),
16476
+
16477
+ /***/ 8686:
16478
+ /***/ ((module) => {
16479
+
16480
+ /**
16481
+ * lodash (Custom Build) <https://lodash.com/>
16482
+ * Build: `lodash modularize exports="npm" -o ./`
16483
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
16484
+ * Released under MIT license <https://lodash.com/license>
16485
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
16486
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
16487
+ */
16488
+
16489
+ /** Used as references for various `Number` constants. */
16490
+ var INFINITY = 1 / 0;
16491
+
16492
+ /** `Object#toString` result references. */
16493
+ var symbolTag = '[object Symbol]';
16494
+
16495
+ /** Used to match HTML entities and HTML characters. */
16496
+ var reUnescapedHtml = /[&<>"'`]/g,
16497
+ reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
16498
+
16499
+ /** Used to map characters to HTML entities. */
16500
+ var htmlEscapes = {
16501
+ '&': '&amp;',
16502
+ '<': '&lt;',
16503
+ '>': '&gt;',
16504
+ '"': '&quot;',
16505
+ "'": '&#39;',
16506
+ '`': '&#96;'
16507
+ };
16508
+
16509
+ /** Detect free variable `global` from Node.js. */
16510
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
16511
+
16512
+ /** Detect free variable `self`. */
16513
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
16514
+
16515
+ /** Used as a reference to the global object. */
16516
+ var root = freeGlobal || freeSelf || Function('return this')();
16517
+
16518
+ /**
16519
+ * The base implementation of `_.propertyOf` without support for deep paths.
16520
+ *
16521
+ * @private
16522
+ * @param {Object} object The object to query.
16523
+ * @returns {Function} Returns the new accessor function.
16524
+ */
16525
+ function basePropertyOf(object) {
16526
+ return function(key) {
16527
+ return object == null ? undefined : object[key];
16528
+ };
16529
+ }
16530
+
16531
+ /**
16532
+ * Used by `_.escape` to convert characters to HTML entities.
16533
+ *
16534
+ * @private
16535
+ * @param {string} chr The matched character to escape.
16536
+ * @returns {string} Returns the escaped character.
16537
+ */
16538
+ var escapeHtmlChar = basePropertyOf(htmlEscapes);
16539
+
16540
+ /** Used for built-in method references. */
16541
+ var objectProto = Object.prototype;
16542
+
16543
+ /**
16544
+ * Used to resolve the
16545
+ * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
16546
+ * of values.
16547
+ */
16548
+ var objectToString = objectProto.toString;
16549
+
16550
+ /** Built-in value references. */
16551
+ var Symbol = root.Symbol;
16552
+
16553
+ /** Used to convert symbols to primitives and strings. */
16554
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
16555
+ symbolToString = symbolProto ? symbolProto.toString : undefined;
16556
+
16557
+ /**
16558
+ * The base implementation of `_.toString` which doesn't convert nullish
16559
+ * values to empty strings.
16560
+ *
16561
+ * @private
16562
+ * @param {*} value The value to process.
16563
+ * @returns {string} Returns the string.
16564
+ */
16565
+ function baseToString(value) {
16566
+ // Exit early for strings to avoid a performance hit in some environments.
16567
+ if (typeof value == 'string') {
16568
+ return value;
16569
+ }
16570
+ if (isSymbol(value)) {
16571
+ return symbolToString ? symbolToString.call(value) : '';
16572
+ }
16573
+ var result = (value + '');
16574
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
16575
+ }
16576
+
16577
+ /**
16578
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
16579
+ * and has a `typeof` result of "object".
16580
+ *
16581
+ * @static
16582
+ * @memberOf _
16583
+ * @since 4.0.0
16584
+ * @category Lang
16585
+ * @param {*} value The value to check.
16586
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
16587
+ * @example
16588
+ *
16589
+ * _.isObjectLike({});
16590
+ * // => true
16591
+ *
16592
+ * _.isObjectLike([1, 2, 3]);
16593
+ * // => true
16594
+ *
16595
+ * _.isObjectLike(_.noop);
16596
+ * // => false
16597
+ *
16598
+ * _.isObjectLike(null);
16599
+ * // => false
16600
+ */
16601
+ function isObjectLike(value) {
16602
+ return !!value && typeof value == 'object';
16603
+ }
16604
+
16605
+ /**
16606
+ * Checks if `value` is classified as a `Symbol` primitive or object.
16607
+ *
16608
+ * @static
16609
+ * @memberOf _
16610
+ * @since 4.0.0
16611
+ * @category Lang
16612
+ * @param {*} value The value to check.
16613
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
16614
+ * @example
16615
+ *
16616
+ * _.isSymbol(Symbol.iterator);
16617
+ * // => true
16618
+ *
16619
+ * _.isSymbol('abc');
16620
+ * // => false
16621
+ */
16622
+ function isSymbol(value) {
16623
+ return typeof value == 'symbol' ||
16624
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
16625
+ }
16626
+
16627
+ /**
16628
+ * Converts `value` to a string. An empty string is returned for `null`
16629
+ * and `undefined` values. The sign of `-0` is preserved.
16630
+ *
16631
+ * @static
16632
+ * @memberOf _
16633
+ * @since 4.0.0
16634
+ * @category Lang
16635
+ * @param {*} value The value to process.
16636
+ * @returns {string} Returns the string.
16637
+ * @example
16638
+ *
16639
+ * _.toString(null);
16640
+ * // => ''
16641
+ *
16642
+ * _.toString(-0);
16643
+ * // => '-0'
16644
+ *
16645
+ * _.toString([1, 2, 3]);
16646
+ * // => '1,2,3'
16647
+ */
16648
+ function toString(value) {
16649
+ return value == null ? '' : baseToString(value);
16650
+ }
16651
+
16652
+ /**
16653
+ * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to
16654
+ * their corresponding HTML entities.
16655
+ *
16656
+ * **Note:** No other characters are escaped. To escape additional
16657
+ * characters use a third-party library like [_he_](https://mths.be/he).
16658
+ *
16659
+ * Though the ">" character is escaped for symmetry, characters like
16660
+ * ">" and "/" don't need escaping in HTML and have no special meaning
16661
+ * unless they're part of a tag or unquoted attribute value. See
16662
+ * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
16663
+ * (under "semi-related fun fact") for more details.
16664
+ *
16665
+ * Backticks are escaped because in IE < 9, they can break out of
16666
+ * attribute values or HTML comments. See [#59](https://html5sec.org/#59),
16667
+ * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
16668
+ * [#133](https://html5sec.org/#133) of the
16669
+ * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details.
16670
+ *
16671
+ * When working with HTML you should always
16672
+ * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
16673
+ * XSS vectors.
16674
+ *
16675
+ * @static
16676
+ * @since 0.1.0
16677
+ * @memberOf _
16678
+ * @category String
16679
+ * @param {string} [string=''] The string to escape.
16680
+ * @returns {string} Returns the escaped string.
16681
+ * @example
16682
+ *
16683
+ * _.escape('fred, barney, & pebbles');
16684
+ * // => 'fred, barney, &amp; pebbles'
16685
+ */
16686
+ function escape(string) {
16687
+ string = toString(string);
16688
+ return (string && reHasUnescapedHtml.test(string))
16689
+ ? string.replace(reUnescapedHtml, escapeHtmlChar)
16690
+ : string;
16691
+ }
16692
+
16693
+ module.exports = escape;
16694
+
16695
+
16469
16696
  /***/ }),
16470
16697
 
16471
16698
  /***/ 5683:
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.43.0",
5
+ "version": "6.44.0",
6
6
  "main": "dist/main.node.js",
7
7
  "browser": "dist/main.js",
8
8
  "files": [
@@ -32,6 +32,7 @@
32
32
  "copy-to-clipboard": "^3.3.1",
33
33
  "hast-util-sanitize": "^4.0.0",
34
34
  "hast-util-to-string": "^1.0.4",
35
+ "lodash.escape": "^4.0.1",
35
36
  "lodash.kebabcase": "^4.1.1",
36
37
  "mdast-util-toc": "^5.1.0",
37
38
  "path-browserify": "^1.0.1",