@readme/markdown 6.41.0 → 6.41.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
@@ -28827,6 +28827,16 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
28827
28827
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
28828
28828
 
28829
28829
  /* eslint-disable consistent-return */
28830
+ var unified = __webpack_require__(8835);
28831
+
28832
+ var rehypeParse = __webpack_require__(3322);
28833
+
28834
+ var rehypeSanitize = __webpack_require__(1667);
28835
+
28836
+ var rehypeStringify = __webpack_require__(7532);
28837
+
28838
+ var globalSanitizeSchema = __webpack_require__(8229);
28839
+
28830
28840
  var RGXP = /^\[block:(.*)\]([^]+?)\[\/block\]/;
28831
28841
  var compatibilityMode;
28832
28842
 
@@ -28857,6 +28867,13 @@ var imgSizeByWidth = new Proxy(new Map(Array.from(imgSizeValues).reverse()), {
28857
28867
  return match ? match[1] : width in sizes ? sizes[width] : width;
28858
28868
  }
28859
28869
  });
28870
+ var processor = unified().use(rehypeParse, {
28871
+ fragment: true
28872
+ }).use(rehypeSanitize, globalSanitizeSchema).use(rehypeStringify);
28873
+
28874
+ var sanitize = function sanitize(html) {
28875
+ return processor.processSync(html).toString();
28876
+ };
28860
28877
 
28861
28878
  function tokenize(eat, value) {
28862
28879
  var _this = this;
@@ -29104,7 +29121,7 @@ function tokenize(eat, value) {
29104
29121
  data: {
29105
29122
  hName: 'html-block',
29106
29123
  hProperties: {
29107
- html: json.html,
29124
+ html: sanitize(json.html),
29108
29125
  runScripts: compatibilityMode
29109
29126
  }
29110
29127
  }
@@ -31319,54 +31336,134 @@ function ok() {
31319
31336
 
31320
31337
  /***/ }),
31321
31338
 
31322
- /***/ 8909:
31339
+ /***/ 3216:
31323
31340
  /***/ ((module) => {
31324
31341
 
31325
31342
  "use strict";
31326
31343
 
31327
31344
 
31328
- module.exports = isElement
31345
+ module.exports = convert
31329
31346
 
31330
- // Check if if `node` is an `element` and, if `tagNames` is given, `node`
31331
- // matches them `tagNames`.
31332
- function isElement(node, tagNames) {
31333
- var name
31347
+ function convert(test) {
31348
+ if (typeof test === 'string') {
31349
+ return tagNameFactory(test)
31350
+ }
31334
31351
 
31335
- if (
31336
- !(
31337
- tagNames === null ||
31338
- tagNames === undefined ||
31339
- typeof tagNames === 'string' ||
31340
- (typeof tagNames === 'object' && tagNames.length !== 0)
31341
- )
31342
- ) {
31343
- throw new Error(
31344
- 'Expected `string` or `Array.<string>` for `tagNames`, not `' +
31345
- tagNames +
31346
- '`'
31347
- )
31352
+ if (test === null || test === undefined) {
31353
+ return element
31354
+ }
31355
+
31356
+ if (typeof test === 'object') {
31357
+ return any(test)
31348
31358
  }
31349
31359
 
31360
+ if (typeof test === 'function') {
31361
+ return callFactory(test)
31362
+ }
31363
+
31364
+ throw new Error('Expected function, string, or array as test')
31365
+ }
31366
+
31367
+ function convertAll(tests) {
31368
+ var length = tests.length
31369
+ var index = -1
31370
+ var results = []
31371
+
31372
+ while (++index < length) {
31373
+ results[index] = convert(tests[index])
31374
+ }
31375
+
31376
+ return results
31377
+ }
31378
+
31379
+ function any(tests) {
31380
+ var checks = convertAll(tests)
31381
+ var length = checks.length
31382
+
31383
+ return matches
31384
+
31385
+ function matches() {
31386
+ var index = -1
31387
+
31388
+ while (++index < length) {
31389
+ if (checks[index].apply(this, arguments)) {
31390
+ return true
31391
+ }
31392
+ }
31393
+
31394
+ return false
31395
+ }
31396
+ }
31397
+
31398
+ // Utility to convert a string a tag name check.
31399
+ function tagNameFactory(test) {
31400
+ return tagName
31401
+
31402
+ function tagName(node) {
31403
+ return element(node) && node.tagName === test
31404
+ }
31405
+ }
31406
+
31407
+ // Utility to convert a function check.
31408
+ function callFactory(test) {
31409
+ return call
31410
+
31411
+ function call(node) {
31412
+ return element(node) && Boolean(test.apply(this, arguments))
31413
+ }
31414
+ }
31415
+
31416
+ // Utility to return true if this is an element.
31417
+ function element(node) {
31418
+ return (
31419
+ node &&
31420
+ typeof node === 'object' &&
31421
+ node.type === 'element' &&
31422
+ typeof node.tagName === 'string'
31423
+ )
31424
+ }
31425
+
31426
+
31427
+ /***/ }),
31428
+
31429
+ /***/ 8909:
31430
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
31431
+
31432
+ "use strict";
31433
+
31434
+
31435
+ var convert = __webpack_require__(3216)
31436
+
31437
+ module.exports = isElement
31438
+
31439
+ isElement.convert = convert
31440
+
31441
+ // Check if if `node` is an `element` and whether it passes the given test.
31442
+ function isElement(node, test, index, parent, context) {
31443
+ var hasParent = parent !== null && parent !== undefined
31444
+ var hasIndex = index !== null && index !== undefined
31445
+ var check = convert(test)
31446
+
31350
31447
  if (
31351
- !node ||
31352
- typeof node !== 'object' ||
31353
- node.type !== 'element' ||
31354
- typeof node.tagName !== 'string'
31448
+ hasIndex &&
31449
+ (typeof index !== 'number' || index < 0 || index === Infinity)
31355
31450
  ) {
31356
- return false
31451
+ throw new Error('Expected positive finite index for child node')
31357
31452
  }
31358
31453
 
31359
- if (tagNames === null || tagNames === undefined) {
31360
- return true
31454
+ if (hasParent && (!parent.type || !parent.children)) {
31455
+ throw new Error('Expected parent node')
31361
31456
  }
31362
31457
 
31363
- name = node.tagName
31458
+ if (!node || !node.type || typeof node.type !== 'string') {
31459
+ return false
31460
+ }
31364
31461
 
31365
- if (typeof tagNames === 'string') {
31366
- return name === tagNames
31462
+ if (hasParent !== hasIndex) {
31463
+ throw new Error('Expected both parent and index')
31367
31464
  }
31368
31465
 
31369
- return tagNames.indexOf(name) !== -1
31466
+ return check.call(context, node, index, parent)
31370
31467
  }
31371
31468
 
31372
31469
 
@@ -38267,6 +38364,104 @@ var svg = __webpack_require__(5789)
38267
38364
  module.exports = merge([xml, xlink, xmlns, aria, svg])
38268
38365
 
38269
38366
 
38367
+ /***/ }),
38368
+
38369
+ /***/ 3322:
38370
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
38371
+
38372
+ "use strict";
38373
+
38374
+
38375
+ var fromParse5 = __webpack_require__(7721)
38376
+ var Parser5 = __webpack_require__(6425)
38377
+ var errors = __webpack_require__(2471)
38378
+
38379
+ var base = 'https://html.spec.whatwg.org/multipage/parsing.html#parse-error-'
38380
+
38381
+ var fatalities = {2: true, 1: false, 0: null}
38382
+
38383
+ module.exports = parse
38384
+
38385
+ function parse(options) {
38386
+ var settings = Object.assign({}, options, this.data('settings'))
38387
+ var position = settings.position
38388
+
38389
+ position = typeof position === 'boolean' ? position : true
38390
+
38391
+ this.Parser = parser
38392
+
38393
+ function parser(doc, file) {
38394
+ var fn = settings.fragment ? 'parseFragment' : 'parse'
38395
+ var onParseError = settings.emitParseErrors ? onerror : null
38396
+ var parse5 = new Parser5({
38397
+ sourceCodeLocationInfo: position,
38398
+ onParseError: onParseError,
38399
+ scriptingEnabled: false
38400
+ })
38401
+
38402
+ return fromParse5(parse5[fn](doc), {
38403
+ space: settings.space,
38404
+ file: file,
38405
+ verbose: settings.verbose
38406
+ })
38407
+
38408
+ function onerror(err) {
38409
+ var code = err.code
38410
+ var name = camelcase(code)
38411
+ var setting = settings[name]
38412
+ var config = setting === undefined || setting === null ? true : setting
38413
+ var level = typeof config === 'number' ? config : config ? 1 : 0
38414
+ var start = {
38415
+ line: err.startLine,
38416
+ column: err.startCol,
38417
+ offset: err.startOffset
38418
+ }
38419
+ var end = {line: err.endLine, column: err.endCol, offset: err.endOffset}
38420
+ var info
38421
+ var message
38422
+
38423
+ if (level) {
38424
+ info = errors[name] || /* istanbul ignore next */ {
38425
+ reason: '',
38426
+ description: ''
38427
+ }
38428
+
38429
+ message = file.message(format(info.reason), {start: start, end: end})
38430
+ message.source = 'parse-error'
38431
+ message.ruleId = code
38432
+ message.fatal = fatalities[level]
38433
+ message.note = format(info.description)
38434
+ message.url = info.url === false ? null : base + code
38435
+ }
38436
+
38437
+ function format(value) {
38438
+ return value.replace(/%c(?:-(\d+))?/g, char).replace(/%x/g, encodedChar)
38439
+ }
38440
+
38441
+ function char($0, $1) {
38442
+ var offset = $1 ? -parseInt($1, 10) : 0
38443
+ var char = doc.charAt(err.startOffset + offset)
38444
+ return char === '`' ? '` ` `' : char
38445
+ }
38446
+
38447
+ function encodedChar() {
38448
+ var char = doc.charCodeAt(err.startOffset).toString(16).toUpperCase()
38449
+
38450
+ return '0x' + char
38451
+ }
38452
+ }
38453
+ }
38454
+ }
38455
+
38456
+ function camelcase(value) {
38457
+ return value.replace(/-[a-z]/g, replacer)
38458
+ }
38459
+
38460
+ function replacer($0) {
38461
+ return $0.charAt(1).toUpperCase()
38462
+ }
38463
+
38464
+
38270
38465
  /***/ }),
38271
38466
 
38272
38467
  /***/ 6388:
@@ -51602,6 +51797,14 @@ module.exports = JSON.parse('{"classId":"classID","dataType":"datatype","itemId"
51602
51797
 
51603
51798
  /***/ }),
51604
51799
 
51800
+ /***/ 2471:
51801
+ /***/ ((module) => {
51802
+
51803
+ "use strict";
51804
+ module.exports = JSON.parse('{"abandonedHeadElementChild":{"reason":"Unexpected metadata element after head","description":"Unexpected element after head. Expected the element before `</head>`","url":false},"abruptClosingOfEmptyComment":{"reason":"Unexpected abruptly closed empty comment","description":"Unexpected `>` or `->`. Expected `-->` to close comments"},"abruptDoctypePublicIdentifier":{"reason":"Unexpected abruptly closed public identifier","description":"Unexpected `>`. Expected a closing `\\"` or `\'` after the public identifier"},"abruptDoctypeSystemIdentifier":{"reason":"Unexpected abruptly closed system identifier","description":"Unexpected `>`. Expected a closing `\\"` or `\'` after the identifier identifier"},"absenceOfDigitsInNumericCharacterReference":{"reason":"Unexpected non-digit at start of numeric character reference","description":"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},"cdataInHtmlContent":{"reason":"Unexpected CDATA section in HTML","description":"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},"characterReferenceOutsideUnicodeRange":{"reason":"Unexpected too big numeric character reference","description":"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},"closingOfElementWithOpenChildElements":{"reason":"Unexpected closing tag with open child elements","description":"Unexpectedly closing tag. Expected other tags to be closed first","url":false},"controlCharacterInInputStream":{"reason":"Unexpected control character","description":"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},"controlCharacterReference":{"reason":"Unexpected control character reference","description":"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},"disallowedContentInNoscriptInHead":{"reason":"Disallowed content inside `<noscript>` in `<head>`","description":"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`","url":false},"duplicateAttribute":{"reason":"Unexpected duplicate attribute","description":"Unexpectedly double attribute. Expected attributes to occur only once"},"endTagWithAttributes":{"reason":"Unexpected attribute on closing tag","description":"Unexpected attribute. Expected `>` instead"},"endTagWithTrailingSolidus":{"reason":"Unexpected slash at end of closing tag","description":"Unexpected `%c-1`. Expected `>` instead"},"endTagWithoutMatchingOpenElement":{"reason":"Unexpected unopened end tag","description":"Unexpected end tag. Expected no end tag or another end tag","url":false},"eofBeforeTagName":{"reason":"Unexpected end of file","description":"Unexpected end of file. Expected tag name instead"},"eofInCdata":{"reason":"Unexpected end of file in CDATA","description":"Unexpected end of file. Expected `]]>` to close the CDATA"},"eofInComment":{"reason":"Unexpected end of file in comment","description":"Unexpected end of file. Expected `-->` to close the comment"},"eofInDoctype":{"reason":"Unexpected end of file in doctype","description":"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},"eofInElementThatCanContainOnlyText":{"reason":"Unexpected end of file in element that can only contain text","description":"Unexpected end of file. Expected text or a closing tag","url":false},"eofInScriptHtmlCommentLikeText":{"reason":"Unexpected end of file in comment inside script","description":"Unexpected end of file. Expected `-->` to close the comment"},"eofInTag":{"reason":"Unexpected end of file in tag","description":"Unexpected end of file. Expected `>` to close the tag"},"incorrectlyClosedComment":{"reason":"Incorrectly closed comment","description":"Unexpected `%c-1`. Expected `-->` to close the comment"},"incorrectlyOpenedComment":{"reason":"Incorrectly opened comment","description":"Unexpected `%c`. Expected `<!--` to open the comment"},"invalidCharacterSequenceAfterDoctypeName":{"reason":"Invalid sequence after doctype name","description":"Unexpected sequence at `%c`. Expected `public` or `system`"},"invalidFirstCharacterOfTagName":{"reason":"Invalid first character in tag name","description":"Unexpected `%c`. Expected an ASCII letter instead"},"misplacedDoctype":{"reason":"Misplaced doctype","description":"Unexpected doctype. Expected doctype before head","url":false},"misplacedStartTagForHeadElement":{"reason":"Misplaced `<head>` start tag","description":"Unexpected start tag `<head>`. Expected `<head>` directly after doctype","url":false},"missingAttributeValue":{"reason":"Missing attribute value","description":"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},"missingDoctype":{"reason":"Missing doctype before other content","description":"Expected a `<!doctype html>` before anything else","url":false},"missingDoctypeName":{"reason":"Missing doctype name","description":"Unexpected doctype end at `%c`. Expected `html` instead"},"missingDoctypePublicIdentifier":{"reason":"Missing public identifier in doctype","description":"Unexpected `%c`. Expected identifier for `public` instead"},"missingDoctypeSystemIdentifier":{"reason":"Missing system identifier in doctype","description":"Unexpected `%c`. Expected identifier for `system` instead (suggested: `\\"about:legacy-compat\\"`)"},"missingEndTagName":{"reason":"Missing name in end tag","description":"Unexpected `%c`. Expected an ASCII letter instead"},"missingQuoteBeforeDoctypePublicIdentifier":{"reason":"Missing quote before public identifier in doctype","description":"Unexpected `%c`. Expected `\\"` or `\'` instead"},"missingQuoteBeforeDoctypeSystemIdentifier":{"reason":"Missing quote before system identifier in doctype","description":"Unexpected `%c`. Expected `\\"` or `\'` instead"},"missingSemicolonAfterCharacterReference":{"reason":"Missing semicolon after character reference","description":"Unexpected `%c`. Expected `;` instead"},"missingWhitespaceAfterDoctypePublicKeyword":{"reason":"Missing whitespace after public identifier in doctype","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"missingWhitespaceAfterDoctypeSystemKeyword":{"reason":"Missing whitespace after system identifier in doctype","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"missingWhitespaceBeforeDoctypeName":{"reason":"Missing whitespace before doctype name","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"missingWhitespaceBetweenAttributes":{"reason":"Missing whitespace between attributes","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers":{"reason":"Missing whitespace between public and system identifiers in doctype","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"nestedComment":{"reason":"Unexpected nested comment","description":"Unexpected `<!--`. Expected `-->`"},"nestedNoscriptInHead":{"reason":"Unexpected nested `<noscript>` in `<head>`","description":"Unexpected `<noscript>`. Expected a closing tag or a meta element","url":false},"nonConformingDoctype":{"reason":"Unexpected non-conforming doctype declaration","description":"Expected `<!doctype html>` or `<!doctype html system \\"about:legacy-compat\\">`","url":false},"nonVoidHtmlElementStartTagWithTrailingSolidus":{"reason":"Unexpected trailing slash on start tag of non-void element","description":"Unexpected `/`. Expected `>` instead"},"noncharacterCharacterReference":{"reason":"Unexpected noncharacter code point referenced by character reference","description":"Unexpected code point. Do not use noncharacters in HTML"},"noncharacterInInputStream":{"reason":"Unexpected noncharacter character","description":"Unexpected code point `%x`. Do not use noncharacters in HTML"},"nullCharacterReference":{"reason":"Unexpected NULL character referenced by character reference","description":"Unexpected code point. Do not use NULL characters in HTML"},"openElementsLeftAfterEof":{"reason":"Unexpected end of file","description":"Unexpected end of file. Expected closing tag instead","url":false},"surrogateCharacterReference":{"reason":"Unexpected surrogate character referenced by character reference","description":"Unexpected code point. Do not use lone surrogate characters in HTML"},"surrogateInInputStream":{"reason":"Unexpected surrogate character","description":"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},"unexpectedCharacterAfterDoctypeSystemIdentifier":{"reason":"Invalid character after system identifier in doctype","description":"Unexpected character at `%c`. Expected `>`"},"unexpectedCharacterInAttributeName":{"reason":"Unexpected character in attribute name","description":"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},"unexpectedCharacterInUnquotedAttributeValue":{"reason":"Unexpected character in unquoted attribute value","description":"Unexpected `%c`. Quote the attribute value to include it"},"unexpectedEqualsSignBeforeAttributeName":{"reason":"Unexpected equals sign before attribute name ","description":"Unexpected `%c`. Add an attribute name before it"},"unexpectedNullCharacter":{"reason":"Unexpected NULL character","description":"Unexpected code point `%x`. Do not use NULL characters in HTML"},"unexpectedQuestionMarkInsteadOfTagName":{"reason":"Unexpected question mark instead of tag name","description":"Unexpected `%c`. Expected an ASCII letter instead"},"unexpectedSolidusInTag":{"reason":"Unexpected slash in tag","description":"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},"unknownNamedCharacterReference":{"reason":"Unexpected unknown named character reference","description":"Unexpected character reference. Expected known named character references"}}');
51805
+
51806
+ /***/ }),
51807
+
51605
51808
  /***/ 9052:
51606
51809
  /***/ ((module) => {
51607
51810
 
package/dist/main.node.js CHANGED
@@ -11649,6 +11649,16 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
11649
11649
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11650
11650
 
11651
11651
  /* eslint-disable consistent-return */
11652
+ var unified = __webpack_require__(8835);
11653
+
11654
+ var rehypeParse = __webpack_require__(3322);
11655
+
11656
+ var rehypeSanitize = __webpack_require__(1667);
11657
+
11658
+ var rehypeStringify = __webpack_require__(7532);
11659
+
11660
+ var globalSanitizeSchema = __webpack_require__(8229);
11661
+
11652
11662
  var RGXP = /^\[block:(.*)\]([^]+?)\[\/block\]/;
11653
11663
  var compatibilityMode;
11654
11664
 
@@ -11679,6 +11689,13 @@ var imgSizeByWidth = new Proxy(new Map(Array.from(imgSizeValues).reverse()), {
11679
11689
  return match ? match[1] : width in sizes ? sizes[width] : width;
11680
11690
  }
11681
11691
  });
11692
+ var processor = unified().use(rehypeParse, {
11693
+ fragment: true
11694
+ }).use(rehypeSanitize, globalSanitizeSchema).use(rehypeStringify);
11695
+
11696
+ var sanitize = function sanitize(html) {
11697
+ return processor.processSync(html).toString();
11698
+ };
11682
11699
 
11683
11700
  function tokenize(eat, value) {
11684
11701
  var _this = this;
@@ -11926,7 +11943,7 @@ function tokenize(eat, value) {
11926
11943
  data: {
11927
11944
  hName: 'html-block',
11928
11945
  hProperties: {
11929
- html: json.html,
11946
+ html: sanitize(json.html),
11930
11947
  runScripts: compatibilityMode
11931
11948
  }
11932
11949
  }
@@ -14141,54 +14158,134 @@ function ok() {
14141
14158
 
14142
14159
  /***/ }),
14143
14160
 
14144
- /***/ 8909:
14161
+ /***/ 3216:
14145
14162
  /***/ ((module) => {
14146
14163
 
14147
14164
  "use strict";
14148
14165
 
14149
14166
 
14150
- module.exports = isElement
14167
+ module.exports = convert
14151
14168
 
14152
- // Check if if `node` is an `element` and, if `tagNames` is given, `node`
14153
- // matches them `tagNames`.
14154
- function isElement(node, tagNames) {
14155
- var name
14169
+ function convert(test) {
14170
+ if (typeof test === 'string') {
14171
+ return tagNameFactory(test)
14172
+ }
14156
14173
 
14157
- if (
14158
- !(
14159
- tagNames === null ||
14160
- tagNames === undefined ||
14161
- typeof tagNames === 'string' ||
14162
- (typeof tagNames === 'object' && tagNames.length !== 0)
14163
- )
14164
- ) {
14165
- throw new Error(
14166
- 'Expected `string` or `Array.<string>` for `tagNames`, not `' +
14167
- tagNames +
14168
- '`'
14169
- )
14174
+ if (test === null || test === undefined) {
14175
+ return element
14176
+ }
14177
+
14178
+ if (typeof test === 'object') {
14179
+ return any(test)
14180
+ }
14181
+
14182
+ if (typeof test === 'function') {
14183
+ return callFactory(test)
14184
+ }
14185
+
14186
+ throw new Error('Expected function, string, or array as test')
14187
+ }
14188
+
14189
+ function convertAll(tests) {
14190
+ var length = tests.length
14191
+ var index = -1
14192
+ var results = []
14193
+
14194
+ while (++index < length) {
14195
+ results[index] = convert(tests[index])
14170
14196
  }
14171
14197
 
14198
+ return results
14199
+ }
14200
+
14201
+ function any(tests) {
14202
+ var checks = convertAll(tests)
14203
+ var length = checks.length
14204
+
14205
+ return matches
14206
+
14207
+ function matches() {
14208
+ var index = -1
14209
+
14210
+ while (++index < length) {
14211
+ if (checks[index].apply(this, arguments)) {
14212
+ return true
14213
+ }
14214
+ }
14215
+
14216
+ return false
14217
+ }
14218
+ }
14219
+
14220
+ // Utility to convert a string a tag name check.
14221
+ function tagNameFactory(test) {
14222
+ return tagName
14223
+
14224
+ function tagName(node) {
14225
+ return element(node) && node.tagName === test
14226
+ }
14227
+ }
14228
+
14229
+ // Utility to convert a function check.
14230
+ function callFactory(test) {
14231
+ return call
14232
+
14233
+ function call(node) {
14234
+ return element(node) && Boolean(test.apply(this, arguments))
14235
+ }
14236
+ }
14237
+
14238
+ // Utility to return true if this is an element.
14239
+ function element(node) {
14240
+ return (
14241
+ node &&
14242
+ typeof node === 'object' &&
14243
+ node.type === 'element' &&
14244
+ typeof node.tagName === 'string'
14245
+ )
14246
+ }
14247
+
14248
+
14249
+ /***/ }),
14250
+
14251
+ /***/ 8909:
14252
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14253
+
14254
+ "use strict";
14255
+
14256
+
14257
+ var convert = __webpack_require__(3216)
14258
+
14259
+ module.exports = isElement
14260
+
14261
+ isElement.convert = convert
14262
+
14263
+ // Check if if `node` is an `element` and whether it passes the given test.
14264
+ function isElement(node, test, index, parent, context) {
14265
+ var hasParent = parent !== null && parent !== undefined
14266
+ var hasIndex = index !== null && index !== undefined
14267
+ var check = convert(test)
14268
+
14172
14269
  if (
14173
- !node ||
14174
- typeof node !== 'object' ||
14175
- node.type !== 'element' ||
14176
- typeof node.tagName !== 'string'
14270
+ hasIndex &&
14271
+ (typeof index !== 'number' || index < 0 || index === Infinity)
14177
14272
  ) {
14178
- return false
14273
+ throw new Error('Expected positive finite index for child node')
14179
14274
  }
14180
14275
 
14181
- if (tagNames === null || tagNames === undefined) {
14182
- return true
14276
+ if (hasParent && (!parent.type || !parent.children)) {
14277
+ throw new Error('Expected parent node')
14183
14278
  }
14184
14279
 
14185
- name = node.tagName
14280
+ if (!node || !node.type || typeof node.type !== 'string') {
14281
+ return false
14282
+ }
14186
14283
 
14187
- if (typeof tagNames === 'string') {
14188
- return name === tagNames
14284
+ if (hasParent !== hasIndex) {
14285
+ throw new Error('Expected both parent and index')
14189
14286
  }
14190
14287
 
14191
- return tagNames.indexOf(name) !== -1
14288
+ return check.call(context, node, index, parent)
14192
14289
  }
14193
14290
 
14194
14291
 
@@ -21088,6 +21185,104 @@ var svg = __webpack_require__(5789)
21088
21185
  module.exports = merge([xml, xlink, xmlns, aria, svg])
21089
21186
 
21090
21187
 
21188
+ /***/ }),
21189
+
21190
+ /***/ 3322:
21191
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
21192
+
21193
+ "use strict";
21194
+
21195
+
21196
+ var fromParse5 = __webpack_require__(7721)
21197
+ var Parser5 = __webpack_require__(6425)
21198
+ var errors = __webpack_require__(2471)
21199
+
21200
+ var base = 'https://html.spec.whatwg.org/multipage/parsing.html#parse-error-'
21201
+
21202
+ var fatalities = {2: true, 1: false, 0: null}
21203
+
21204
+ module.exports = parse
21205
+
21206
+ function parse(options) {
21207
+ var settings = Object.assign({}, options, this.data('settings'))
21208
+ var position = settings.position
21209
+
21210
+ position = typeof position === 'boolean' ? position : true
21211
+
21212
+ this.Parser = parser
21213
+
21214
+ function parser(doc, file) {
21215
+ var fn = settings.fragment ? 'parseFragment' : 'parse'
21216
+ var onParseError = settings.emitParseErrors ? onerror : null
21217
+ var parse5 = new Parser5({
21218
+ sourceCodeLocationInfo: position,
21219
+ onParseError: onParseError,
21220
+ scriptingEnabled: false
21221
+ })
21222
+
21223
+ return fromParse5(parse5[fn](doc), {
21224
+ space: settings.space,
21225
+ file: file,
21226
+ verbose: settings.verbose
21227
+ })
21228
+
21229
+ function onerror(err) {
21230
+ var code = err.code
21231
+ var name = camelcase(code)
21232
+ var setting = settings[name]
21233
+ var config = setting === undefined || setting === null ? true : setting
21234
+ var level = typeof config === 'number' ? config : config ? 1 : 0
21235
+ var start = {
21236
+ line: err.startLine,
21237
+ column: err.startCol,
21238
+ offset: err.startOffset
21239
+ }
21240
+ var end = {line: err.endLine, column: err.endCol, offset: err.endOffset}
21241
+ var info
21242
+ var message
21243
+
21244
+ if (level) {
21245
+ info = errors[name] || /* istanbul ignore next */ {
21246
+ reason: '',
21247
+ description: ''
21248
+ }
21249
+
21250
+ message = file.message(format(info.reason), {start: start, end: end})
21251
+ message.source = 'parse-error'
21252
+ message.ruleId = code
21253
+ message.fatal = fatalities[level]
21254
+ message.note = format(info.description)
21255
+ message.url = info.url === false ? null : base + code
21256
+ }
21257
+
21258
+ function format(value) {
21259
+ return value.replace(/%c(?:-(\d+))?/g, char).replace(/%x/g, encodedChar)
21260
+ }
21261
+
21262
+ function char($0, $1) {
21263
+ var offset = $1 ? -parseInt($1, 10) : 0
21264
+ var char = doc.charAt(err.startOffset + offset)
21265
+ return char === '`' ? '` ` `' : char
21266
+ }
21267
+
21268
+ function encodedChar() {
21269
+ var char = doc.charCodeAt(err.startOffset).toString(16).toUpperCase()
21270
+
21271
+ return '0x' + char
21272
+ }
21273
+ }
21274
+ }
21275
+ }
21276
+
21277
+ function camelcase(value) {
21278
+ return value.replace(/-[a-z]/g, replacer)
21279
+ }
21280
+
21281
+ function replacer($0) {
21282
+ return $0.charAt(1).toUpperCase()
21283
+ }
21284
+
21285
+
21091
21286
  /***/ }),
21092
21287
 
21093
21288
  /***/ 6388:
@@ -34028,6 +34223,14 @@ module.exports = JSON.parse('{"classId":"classID","dataType":"datatype","itemId"
34028
34223
 
34029
34224
  /***/ }),
34030
34225
 
34226
+ /***/ 2471:
34227
+ /***/ ((module) => {
34228
+
34229
+ "use strict";
34230
+ module.exports = JSON.parse('{"abandonedHeadElementChild":{"reason":"Unexpected metadata element after head","description":"Unexpected element after head. Expected the element before `</head>`","url":false},"abruptClosingOfEmptyComment":{"reason":"Unexpected abruptly closed empty comment","description":"Unexpected `>` or `->`. Expected `-->` to close comments"},"abruptDoctypePublicIdentifier":{"reason":"Unexpected abruptly closed public identifier","description":"Unexpected `>`. Expected a closing `\\"` or `\'` after the public identifier"},"abruptDoctypeSystemIdentifier":{"reason":"Unexpected abruptly closed system identifier","description":"Unexpected `>`. Expected a closing `\\"` or `\'` after the identifier identifier"},"absenceOfDigitsInNumericCharacterReference":{"reason":"Unexpected non-digit at start of numeric character reference","description":"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},"cdataInHtmlContent":{"reason":"Unexpected CDATA section in HTML","description":"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},"characterReferenceOutsideUnicodeRange":{"reason":"Unexpected too big numeric character reference","description":"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},"closingOfElementWithOpenChildElements":{"reason":"Unexpected closing tag with open child elements","description":"Unexpectedly closing tag. Expected other tags to be closed first","url":false},"controlCharacterInInputStream":{"reason":"Unexpected control character","description":"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},"controlCharacterReference":{"reason":"Unexpected control character reference","description":"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},"disallowedContentInNoscriptInHead":{"reason":"Disallowed content inside `<noscript>` in `<head>`","description":"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`","url":false},"duplicateAttribute":{"reason":"Unexpected duplicate attribute","description":"Unexpectedly double attribute. Expected attributes to occur only once"},"endTagWithAttributes":{"reason":"Unexpected attribute on closing tag","description":"Unexpected attribute. Expected `>` instead"},"endTagWithTrailingSolidus":{"reason":"Unexpected slash at end of closing tag","description":"Unexpected `%c-1`. Expected `>` instead"},"endTagWithoutMatchingOpenElement":{"reason":"Unexpected unopened end tag","description":"Unexpected end tag. Expected no end tag or another end tag","url":false},"eofBeforeTagName":{"reason":"Unexpected end of file","description":"Unexpected end of file. Expected tag name instead"},"eofInCdata":{"reason":"Unexpected end of file in CDATA","description":"Unexpected end of file. Expected `]]>` to close the CDATA"},"eofInComment":{"reason":"Unexpected end of file in comment","description":"Unexpected end of file. Expected `-->` to close the comment"},"eofInDoctype":{"reason":"Unexpected end of file in doctype","description":"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},"eofInElementThatCanContainOnlyText":{"reason":"Unexpected end of file in element that can only contain text","description":"Unexpected end of file. Expected text or a closing tag","url":false},"eofInScriptHtmlCommentLikeText":{"reason":"Unexpected end of file in comment inside script","description":"Unexpected end of file. Expected `-->` to close the comment"},"eofInTag":{"reason":"Unexpected end of file in tag","description":"Unexpected end of file. Expected `>` to close the tag"},"incorrectlyClosedComment":{"reason":"Incorrectly closed comment","description":"Unexpected `%c-1`. Expected `-->` to close the comment"},"incorrectlyOpenedComment":{"reason":"Incorrectly opened comment","description":"Unexpected `%c`. Expected `<!--` to open the comment"},"invalidCharacterSequenceAfterDoctypeName":{"reason":"Invalid sequence after doctype name","description":"Unexpected sequence at `%c`. Expected `public` or `system`"},"invalidFirstCharacterOfTagName":{"reason":"Invalid first character in tag name","description":"Unexpected `%c`. Expected an ASCII letter instead"},"misplacedDoctype":{"reason":"Misplaced doctype","description":"Unexpected doctype. Expected doctype before head","url":false},"misplacedStartTagForHeadElement":{"reason":"Misplaced `<head>` start tag","description":"Unexpected start tag `<head>`. Expected `<head>` directly after doctype","url":false},"missingAttributeValue":{"reason":"Missing attribute value","description":"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},"missingDoctype":{"reason":"Missing doctype before other content","description":"Expected a `<!doctype html>` before anything else","url":false},"missingDoctypeName":{"reason":"Missing doctype name","description":"Unexpected doctype end at `%c`. Expected `html` instead"},"missingDoctypePublicIdentifier":{"reason":"Missing public identifier in doctype","description":"Unexpected `%c`. Expected identifier for `public` instead"},"missingDoctypeSystemIdentifier":{"reason":"Missing system identifier in doctype","description":"Unexpected `%c`. Expected identifier for `system` instead (suggested: `\\"about:legacy-compat\\"`)"},"missingEndTagName":{"reason":"Missing name in end tag","description":"Unexpected `%c`. Expected an ASCII letter instead"},"missingQuoteBeforeDoctypePublicIdentifier":{"reason":"Missing quote before public identifier in doctype","description":"Unexpected `%c`. Expected `\\"` or `\'` instead"},"missingQuoteBeforeDoctypeSystemIdentifier":{"reason":"Missing quote before system identifier in doctype","description":"Unexpected `%c`. Expected `\\"` or `\'` instead"},"missingSemicolonAfterCharacterReference":{"reason":"Missing semicolon after character reference","description":"Unexpected `%c`. Expected `;` instead"},"missingWhitespaceAfterDoctypePublicKeyword":{"reason":"Missing whitespace after public identifier in doctype","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"missingWhitespaceAfterDoctypeSystemKeyword":{"reason":"Missing whitespace after system identifier in doctype","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"missingWhitespaceBeforeDoctypeName":{"reason":"Missing whitespace before doctype name","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"missingWhitespaceBetweenAttributes":{"reason":"Missing whitespace between attributes","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers":{"reason":"Missing whitespace between public and system identifiers in doctype","description":"Unexpected `%c`. Expected ASCII whitespace instead"},"nestedComment":{"reason":"Unexpected nested comment","description":"Unexpected `<!--`. Expected `-->`"},"nestedNoscriptInHead":{"reason":"Unexpected nested `<noscript>` in `<head>`","description":"Unexpected `<noscript>`. Expected a closing tag or a meta element","url":false},"nonConformingDoctype":{"reason":"Unexpected non-conforming doctype declaration","description":"Expected `<!doctype html>` or `<!doctype html system \\"about:legacy-compat\\">`","url":false},"nonVoidHtmlElementStartTagWithTrailingSolidus":{"reason":"Unexpected trailing slash on start tag of non-void element","description":"Unexpected `/`. Expected `>` instead"},"noncharacterCharacterReference":{"reason":"Unexpected noncharacter code point referenced by character reference","description":"Unexpected code point. Do not use noncharacters in HTML"},"noncharacterInInputStream":{"reason":"Unexpected noncharacter character","description":"Unexpected code point `%x`. Do not use noncharacters in HTML"},"nullCharacterReference":{"reason":"Unexpected NULL character referenced by character reference","description":"Unexpected code point. Do not use NULL characters in HTML"},"openElementsLeftAfterEof":{"reason":"Unexpected end of file","description":"Unexpected end of file. Expected closing tag instead","url":false},"surrogateCharacterReference":{"reason":"Unexpected surrogate character referenced by character reference","description":"Unexpected code point. Do not use lone surrogate characters in HTML"},"surrogateInInputStream":{"reason":"Unexpected surrogate character","description":"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},"unexpectedCharacterAfterDoctypeSystemIdentifier":{"reason":"Invalid character after system identifier in doctype","description":"Unexpected character at `%c`. Expected `>`"},"unexpectedCharacterInAttributeName":{"reason":"Unexpected character in attribute name","description":"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},"unexpectedCharacterInUnquotedAttributeValue":{"reason":"Unexpected character in unquoted attribute value","description":"Unexpected `%c`. Quote the attribute value to include it"},"unexpectedEqualsSignBeforeAttributeName":{"reason":"Unexpected equals sign before attribute name ","description":"Unexpected `%c`. Add an attribute name before it"},"unexpectedNullCharacter":{"reason":"Unexpected NULL character","description":"Unexpected code point `%x`. Do not use NULL characters in HTML"},"unexpectedQuestionMarkInsteadOfTagName":{"reason":"Unexpected question mark instead of tag name","description":"Unexpected `%c`. Expected an ASCII letter instead"},"unexpectedSolidusInTag":{"reason":"Unexpected slash in tag","description":"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},"unknownNamedCharacterReference":{"reason":"Unexpected unknown named character reference","description":"Unexpected character reference. Expected known named character references"}}');
34231
+
34232
+ /***/ }),
34233
+
34031
34234
  /***/ 9052:
34032
34235
  /***/ ((module) => {
34033
34236
 
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.41.0",
5
+ "version": "6.41.1",
6
6
  "main": "dist/main.node.js",
7
7
  "browser": "dist/main.js",
8
8
  "files": [
@@ -37,8 +37,10 @@
37
37
  "path-browserify": "^1.0.1",
38
38
  "process": "^0.11.10",
39
39
  "prop-types": "^15.8.1",
40
+ "rehype-parse": "^7.0.1",
40
41
  "rehype-raw": "^5.1.0",
41
42
  "rehype-react": "^6.2.1",
43
+ "rehype-remark": "^7.0.0",
42
44
  "rehype-sanitize": "^4.0.0",
43
45
  "rehype-stringify": "^6.0.0",
44
46
  "remark-breaks": "^1.0.0",