@khanacademy/simple-markdown
Advanced tools
Comparing version 0.0.0-PR449-20230329211247 to 0.0.0-PR451-20230330174928
# @khanacademy/simple-markdown | ||
## 0.0.0-PR449-20230329211247 | ||
## 0.0.0-PR451-20230330174928 | ||
### Patch Changes | ||
- 1f062e98: Bump all package versions since the build settings have been updated | ||
## 0.9.0 | ||
### Minor Changes | ||
@@ -6,0 +12,0 @@ |
@@ -185,3 +185,3 @@ /* eslint-disable prefer-spread, no-regex-spaces, @typescript-eslint/no-unused-vars, guard-for-in, no-console, no-var */ | ||
if (parsed == null || typeof parsed !== "object") { | ||
throw new Error("parse() function returned invalid parse result: '".concat(parsed, "'")); | ||
throw new Error(`parse() function returned invalid parse result: '${parsed}'`); | ||
} | ||
@@ -516,3 +516,3 @@ | ||
Array: { | ||
react: function react(arr, output, state) { | ||
react: function (arr, output, state) { | ||
var oldKey = state.key; | ||
@@ -543,3 +543,3 @@ var result = []; | ||
}, | ||
html: function html(arr, output, state) { | ||
html: function (arr, output, state) { | ||
var result = ""; | ||
@@ -568,11 +568,3 @@ | ||
match: blockRegex(/^ *(#{1,6})([^\n]+?)#* *(?:\n *)+\n/), | ||
parse: function (_parse) { | ||
function parse(_x, _x2, _x3) { | ||
return _parse.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return { | ||
@@ -582,4 +574,4 @@ level: capture[1].length, | ||
}; | ||
}), | ||
react: function react(node, output, state) { | ||
}, | ||
react: function (node, output, state) { | ||
return reactElement("h" + node.level, state.key, { | ||
@@ -589,3 +581,3 @@ children: output(node.content, state) | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return htmlTag("h" + node.level, output(node.content, state)); | ||
@@ -604,11 +596,3 @@ } | ||
match: blockRegex(/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/), | ||
parse: function (_parse2) { | ||
function parse(_x4, _x5, _x6) { | ||
return _parse2.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse2.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return { | ||
@@ -619,3 +603,3 @@ type: "heading", | ||
}; | ||
}), | ||
}, | ||
react: null, | ||
@@ -628,6 +612,6 @@ html: null | ||
parse: ignoreCapture, | ||
react: function react(node, output, state) { | ||
react: function (node, output, state) { | ||
return reactElement("hr", state.key, EMPTY_PROPS); | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return "<hr>"; | ||
@@ -639,11 +623,3 @@ } | ||
match: blockRegex(/^(?: [^\n]+\n*)+(?:\n *)+\n/), | ||
parse: function (_parse3) { | ||
function parse(_x7, _x8, _x9) { | ||
return _parse3.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse3.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
var content = capture[0].replace(/^ /gm, "").replace(/\n+$/, ""); | ||
@@ -654,4 +630,4 @@ return { | ||
}; | ||
}), | ||
react: function react(node, output, state) { | ||
}, | ||
react: function (node, output, state) { | ||
var className = node.lang ? "markdown-code-" + node.lang : undefined; | ||
@@ -665,3 +641,3 @@ return reactElement("pre", state.key, { | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
var className = node.lang ? "markdown-code-" + node.lang : undefined; | ||
@@ -677,11 +653,3 @@ var codeBlock = htmlTag("code", sanitizeText(node.content), { | ||
match: blockRegex(/^ *(`{3,}|~{3,}) *(?:(\S+) *)?\n([\s\S]+?)\n?\1 *(?:\n *)+\n/), | ||
parse: function (_parse4) { | ||
function parse(_x10, _x11, _x12) { | ||
return _parse4.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse4.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return { | ||
@@ -692,3 +660,3 @@ type: "codeBlock", | ||
}; | ||
}), | ||
}, | ||
react: null, | ||
@@ -700,11 +668,3 @@ html: null | ||
match: blockRegex(/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/), | ||
parse: function (_parse5) { | ||
function parse(_x13, _x14, _x15) { | ||
return _parse5.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse5.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
var content = capture[0].replace(/^ *> ?/gm, ""); | ||
@@ -714,4 +674,4 @@ return { | ||
}; | ||
}), | ||
react: function react(node, output, state) { | ||
}, | ||
react: function (node, output, state) { | ||
return reactElement("blockquote", state.key, { | ||
@@ -721,3 +681,3 @@ children: output(node.content, state) | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return htmlTag("blockquote", output(node.content, state)); | ||
@@ -729,3 +689,3 @@ } | ||
// $FlowFixMe | ||
match: function match(source, state) { | ||
match: function (source, state) { | ||
// We only want to break into a list if we are at the start of a | ||
@@ -749,11 +709,3 @@ // line. This is to avoid parsing "hi * there" with "* there" | ||
}, | ||
parse: function (_parse6) { | ||
function parse(_x16, _x17, _x18) { | ||
return _parse6.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse6.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
var bullet = capture[2]; | ||
@@ -834,4 +786,4 @@ var ordered = bullet.length > 1; | ||
}; | ||
}), | ||
react: function react(node, output, state) { | ||
}, | ||
react: function (node, output, state) { | ||
var ListWrapper = node.ordered ? "ol" : "ul"; | ||
@@ -847,3 +799,3 @@ return reactElement(ListWrapper, state.key, { | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
var listItems = node.items.map(function (item) { | ||
@@ -865,11 +817,3 @@ return htmlTag("li", output(item, state)); | ||
match: blockRegex(/^ *\[([^\]]+)\]: *<?([^\s>]*)>?(?: +["(]([^\n]+)[")])? *\n(?: *\n)*/), | ||
parse: function (_parse7) { | ||
function parse(_x19, _x20, _x21) { | ||
return _parse7.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse7.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
var def = capture[1].replace(/\s+/g, " ").toLowerCase(); | ||
@@ -912,7 +856,7 @@ var target = capture[2]; | ||
}; | ||
}), | ||
react: function react() { | ||
}, | ||
react: function () { | ||
return null; | ||
}, | ||
html: function html() { | ||
html: function () { | ||
return ""; | ||
@@ -925,3 +869,3 @@ } | ||
parse: TABLES.parseTable, | ||
react: function react(node, output, state) { | ||
react: function (node, output, state) { | ||
var getStyle = function getStyle(colIndex) { | ||
@@ -959,3 +903,3 @@ return node.align[colIndex] == null ? {} : { | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
var getStyle = function getStyle(colIndex) { | ||
@@ -987,6 +931,6 @@ return node.align[colIndex] == null ? "" : "text-align:" + node.align[colIndex] + ";"; | ||
parse: ignoreCapture, | ||
react: function react(node, output, state) { | ||
react: function (node, output, state) { | ||
return "\n"; | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return "\n"; | ||
@@ -999,3 +943,3 @@ } | ||
parse: parseCaptureInline, | ||
react: function react(node, output, state) { | ||
react: function (node, output, state) { | ||
return reactElement("div", state.key, { | ||
@@ -1006,3 +950,3 @@ className: "paragraph", | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
var attributes = { | ||
@@ -1021,11 +965,3 @@ class: "paragraph" | ||
match: inlineRegex(/^\\([^0-9A-Za-z\s])/), | ||
parse: function (_parse8) { | ||
function parse(_x22, _x23, _x24) { | ||
return _parse8.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse8.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return { | ||
@@ -1035,3 +971,3 @@ type: "text", | ||
}; | ||
}), | ||
}, | ||
react: null, | ||
@@ -1043,3 +979,3 @@ html: null | ||
// $FlowFixMe | ||
match: function match(source, state) { | ||
match: function (source, state) { | ||
if (!state.inTable) { | ||
@@ -1050,3 +986,3 @@ return null; | ||
}, | ||
parse: function parse() { | ||
parse: function () { | ||
return { | ||
@@ -1057,6 +993,6 @@ type: "tableSeparator" | ||
// These shouldn't be reached, but in case they are, be reasonable: | ||
react: function react() { | ||
react: function () { | ||
return " | "; | ||
}, | ||
html: function html() { | ||
html: function () { | ||
return " | "; | ||
@@ -1068,11 +1004,3 @@ } | ||
match: inlineRegex(/^<([^: >]+:\/[^ >]+)>/), | ||
parse: function (_parse9) { | ||
function parse(_x25, _x26, _x27) { | ||
return _parse9.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse9.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return { | ||
@@ -1086,3 +1014,3 @@ type: "link", | ||
}; | ||
}), | ||
}, | ||
react: null, | ||
@@ -1094,11 +1022,3 @@ html: null | ||
match: inlineRegex(/^<([^ >]+@[^ >]+)>/), | ||
parse: function (_parse10) { | ||
function parse(_x28, _x29, _x30) { | ||
return _parse10.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse10.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
var address = capture[1]; | ||
@@ -1119,3 +1039,3 @@ var target = capture[1]; | ||
}; | ||
}), | ||
}, | ||
react: null, | ||
@@ -1127,11 +1047,3 @@ html: null | ||
match: inlineRegex(/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/), | ||
parse: function (_parse11) { | ||
function parse(_x31, _x32, _x33) { | ||
return _parse11.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse11.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return { | ||
@@ -1146,3 +1058,3 @@ type: "link", | ||
}; | ||
}), | ||
}, | ||
react: null, | ||
@@ -1154,11 +1066,3 @@ html: null | ||
match: inlineRegex(new RegExp("^\\[(" + LINK_INSIDE + ")\\]\\(" + LINK_HREF_AND_TITLE + "\\)")), | ||
parse: function (_parse12) { | ||
function parse(_x34, _x35, _x36) { | ||
return _parse12.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse12.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
var link = { | ||
@@ -1170,4 +1074,4 @@ content: parse(capture[1], state), | ||
return link; | ||
}), | ||
react: function react(node, output, state) { | ||
}, | ||
react: function (node, output, state) { | ||
return reactElement("a", state.key, { | ||
@@ -1179,3 +1083,3 @@ href: sanitizeUrl(node.target), | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
var attributes = { | ||
@@ -1191,11 +1095,3 @@ href: sanitizeUrl(node.target), | ||
match: inlineRegex(new RegExp("^!\\[(" + LINK_INSIDE + ")\\]\\(" + LINK_HREF_AND_TITLE + "\\)")), | ||
parse: function (_parse13) { | ||
function parse(_x37, _x38, _x39) { | ||
return _parse13.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse13.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
var image = { | ||
@@ -1207,4 +1103,4 @@ alt: capture[1], | ||
return image; | ||
}), | ||
react: function react(node, output, state) { | ||
}, | ||
react: function (node, output, state) { | ||
return reactElement("img", state.key, { | ||
@@ -1216,3 +1112,3 @@ src: sanitizeUrl(node.target), | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
var attributes = { | ||
@@ -1233,11 +1129,3 @@ src: sanitizeUrl(node.target), | ||
"\\s*\\[([^\\]]*)\\]")), | ||
parse: function (_parse14) { | ||
function parse(_x40, _x41, _x42) { | ||
return _parse14.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse14.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return parseRef(capture, state, { | ||
@@ -1247,3 +1135,3 @@ type: "link", | ||
}); | ||
}), | ||
}, | ||
react: null, | ||
@@ -1259,11 +1147,3 @@ html: null | ||
"\\s*\\[([^\\]]*)\\]")), | ||
parse: function (_parse15) { | ||
function parse(_x43, _x44, _x45) { | ||
return _parse15.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse15.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return parseRef(capture, state, { | ||
@@ -1273,3 +1153,3 @@ type: "image", | ||
}); | ||
}), | ||
}, | ||
react: null, | ||
@@ -1302,20 +1182,12 @@ html: null | ||
")\\*(?!\\*)")), | ||
quality: function quality(capture) { | ||
quality: function (capture) { | ||
// precedence by length, `em` wins ties: | ||
return capture[0].length + 0.2; | ||
}, | ||
parse: function (_parse16) { | ||
function parse(_x46, _x47, _x48) { | ||
return _parse16.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse16.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return { | ||
content: parse(capture[2] || capture[1], state) | ||
}; | ||
}), | ||
react: function react(node, output, state) { | ||
}, | ||
react: function (node, output, state) { | ||
return reactElement("em", state.key, { | ||
@@ -1325,3 +1197,3 @@ children: output(node.content, state) | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return htmlTag("em", output(node.content, state)); | ||
@@ -1333,3 +1205,3 @@ } | ||
match: inlineRegex(/^\*\*((?:\\[\s\S]|[^\\])+?)\*\*(?!\*)/), | ||
quality: function quality(capture) { | ||
quality: function (capture) { | ||
// precedence by length, wins ties vs `u`: | ||
@@ -1339,3 +1211,3 @@ return capture[0].length + 0.1; | ||
parse: parseCaptureInline, | ||
react: function react(node, output, state) { | ||
react: function (node, output, state) { | ||
return reactElement("strong", state.key, { | ||
@@ -1345,3 +1217,3 @@ children: output(node.content, state) | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return htmlTag("strong", output(node.content, state)); | ||
@@ -1353,3 +1225,3 @@ } | ||
match: inlineRegex(/^__((?:\\[\s\S]|[^\\])+?)__(?!_)/), | ||
quality: function quality(capture) { | ||
quality: function (capture) { | ||
// precedence by length, loses all ties | ||
@@ -1359,3 +1231,3 @@ return capture[0].length; | ||
parse: parseCaptureInline, | ||
react: function react(node, output, state) { | ||
react: function (node, output, state) { | ||
return reactElement("u", state.key, { | ||
@@ -1365,3 +1237,3 @@ children: output(node.content, state) | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return htmlTag("u", output(node.content, state)); | ||
@@ -1374,3 +1246,3 @@ } | ||
parse: parseCaptureInline, | ||
react: function react(node, output, state) { | ||
react: function (node, output, state) { | ||
return reactElement("del", state.key, { | ||
@@ -1380,3 +1252,3 @@ children: output(node.content, state) | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return htmlTag("del", output(node.content, state)); | ||
@@ -1388,16 +1260,8 @@ } | ||
match: inlineRegex(/^(`+)([\s\S]*?[^`])\1(?!`)/), | ||
parse: function (_parse17) { | ||
function parse(_x49, _x50, _x51) { | ||
return _parse17.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse17.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return { | ||
content: capture[2].replace(INLINE_CODE_ESCAPE_BACKTICKS_R, "$1") | ||
}; | ||
}), | ||
react: function react(node, output, state) { | ||
}, | ||
react: function (node, output, state) { | ||
return reactElement("code", state.key, { | ||
@@ -1407,3 +1271,3 @@ children: node.content | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return htmlTag("code", sanitizeText(node.content)); | ||
@@ -1416,6 +1280,6 @@ } | ||
parse: ignoreCapture, | ||
react: function react(node, output, state) { | ||
react: function (node, output, state) { | ||
return reactElement("br", state.key, EMPTY_PROPS); | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return "<br>"; | ||
@@ -1431,19 +1295,11 @@ } | ||
match: anyScopeRegex(/^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]|\n\n| {2,}\n|\w+:\S|$)/), | ||
parse: function (_parse18) { | ||
function parse(_x52, _x53, _x54) { | ||
return _parse18.apply(this, arguments); | ||
} | ||
parse.toString = function () { | ||
return _parse18.toString(); | ||
}; | ||
return parse; | ||
}(function (capture, parse, state) { | ||
parse: function (capture, parse, state) { | ||
return { | ||
content: capture[0] | ||
}; | ||
}), | ||
react: function react(node, output, state) { | ||
}, | ||
react: function (node, output, state) { | ||
return node.content; | ||
}, | ||
html: function html(node, output, state) { | ||
html: function (node, output, state) { | ||
return sanitizeText(node.content); | ||
@@ -1518,4 +1374,3 @@ } | ||
}; | ||
var outputFor = function outputFor(rules, property) { | ||
var defaultState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var outputFor = function outputFor(rules, property, defaultState = {}) { | ||
if (!property) { | ||
@@ -1625,18 +1480,12 @@ throw new Error("simple-markdown: outputFor: `property` must be " + "defined. " + "if you just upgraded, you probably need to replace `outputFor` " + "with `reactFor`"); | ||
htmlFor: htmlFor, | ||
defaultParse: function defaultParse() { | ||
defaultParse: function (...args) { | ||
if (typeof console !== "undefined") { | ||
console.warn("defaultParse is deprecated, please use `defaultImplicitParse`"); | ||
} | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return defaultImplicitParse.apply(null, args); | ||
}, | ||
defaultOutput: function defaultOutput() { | ||
defaultOutput: function (...args) { | ||
if (typeof console !== "undefined") { | ||
console.warn("defaultOutput is deprecated, please use `defaultReactOutput`"); | ||
} | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return defaultReactOutput.apply(null, args); | ||
@@ -1643,0 +1492,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.0-PR449-20230329211247", | ||
"version": "0.0.0-PR451-20230330174928", | ||
"publishConfig": { | ||
@@ -29,3 +29,3 @@ "access": "public" | ||
"@types/react-dom": ">=16.0.0", | ||
"perseus-build-settings": "^0.0.5", | ||
"perseus-build-settings": "^0.0.0-PR451-20230330174928", | ||
"size-limit": "^0.21.1", | ||
@@ -32,0 +32,0 @@ "typescript": "^3.6.4", |
Sorry, the diff of this file is not supported yet
660554
9545