@khanacademy/pure-markdown 0.3.13 → 0.3.15
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/es/index.js +15 -7
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +28 -29
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/es/index.js
CHANGED
|
@@ -2,18 +2,26 @@ import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
|
|
|
2
2
|
import SimpleMarkdown from '@khanacademy/simple-markdown';
|
|
3
3
|
|
|
4
4
|
function _extends() {
|
|
5
|
-
|
|
6
|
-
for (var
|
|
7
|
-
var
|
|
8
|
-
|
|
5
|
+
_extends = Object.assign || function (target) {
|
|
6
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7
|
+
var source = arguments[i];
|
|
8
|
+
|
|
9
|
+
for (var key in source) {
|
|
10
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
11
|
+
target[key] = source[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
9
14
|
}
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return _extends.apply(this, arguments);
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
15
23
|
const libName = "@khanacademy/pure-markdown";
|
|
16
|
-
const libVersion = "0.3.
|
|
24
|
+
const libVersion = "0.3.15";
|
|
17
25
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
18
26
|
|
|
19
27
|
const rWidgetRule = /^\[\[\u2603 (([a-z-]+) ([0-9]+))\]\]/;
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../node_modules/@babel/runtime/helpers/esm/extends.js","../../src/version.ts","../../src/index.ts"],"sourcesContent":["function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","// This file is processed by a Rollup plugin (replace) to inject the production\n// version number during the release build.\n// In dev, you'll never see the version number.\n\nimport {addLibraryVersionToPerseusDebug} from \"@khanacademy/perseus-core\";\n\nconst libName = \"@khanacademy/pure-markdown\";\nexport const libVersion = \"__lib_version__\";\n\naddLibraryVersionToPerseusDebug(libName, libVersion);\n","/**\n * Contains markdown related functions in pure javascript,\n * extracted from perseus-markdown.jsx\n * Note that this file may be used in stand alone nodejs, thus\n * do not import anything from Perseus\n */\nexport {libVersion} from \"./version\";\n\nimport SimpleMarkdown from \"@khanacademy/simple-markdown\";\n\nconst rWidgetRule = /^\\[\\[\\u2603 (([a-z-]+) ([0-9]+))\\]\\]/;\n\n/**\n * This match function matches math in `$`s, such as:\n *\n * $y = x + 1$\n *\n * It functions roughly like the following regex:\n * /\\$([^\\$]*)\\$/\n *\n * Unfortunately, math may have other `$`s inside it, as\n * long as they are inside `{` braces `}`, mostly for\n * `\\text{ $math$ }`.\n *\n * To parse this, we can't use a regex, since we\n * should support arbitrary nesting (even though\n * MathJax actually only supports two levels of nesting\n * here, which we *could* parse with a regex).\n *\n * Non-regex matchers like this are now a first-class\n * concept in simple-markdown. Yay!\n *\n * This can also match block-math, which is math alone in a paragraph.\n */\nconst mathMatcher = (source: any, state: any, isBlock: boolean) => {\n const length = source.length;\n let index = 0;\n\n // When looking for blocks, skip over leading spaces\n if (isBlock) {\n if (state.inline) {\n return null;\n }\n while (index < length && source[index] === \" \") {\n index++;\n }\n }\n\n // Our source must start with a \"$\"\n if (!(index < length && source[index] === \"$\")) {\n return null;\n }\n\n index++;\n const startIndex = index;\n let braceLevel = 0;\n\n // Loop through the source, looking for a closing '$'\n // closing '$'s only count if they are not escaped with\n // a `\\`, and we are not in nested `{}` braces.\n while (index < length) {\n const character = source[index];\n\n if (character === \"\\\\\") {\n // Consume both the `\\` and the escaped char as a single\n // token.\n // This is so that the second `$` in `$\\\\$` closes\n // the math expression, since the first `\\` is escaping\n // the second `\\`, but the second `\\` is not escaping\n // the second `$`.\n // This also handles the case of escaping `$`s or\n // braces `\\{`\n index++;\n } else if (braceLevel <= 0 && character === \"$\") {\n let endIndex = index + 1;\n if (isBlock) {\n // Look for two trailing newlines after the closing `$`\n const match = /^(?: *\\n){2,}/.exec(source.slice(endIndex));\n // @ts-expect-error - TS2322 - Type 'number | null' is not assignable to type 'number'.\n endIndex = match ? endIndex + match[0].length : null;\n }\n\n // Return an array that looks like the results of a\n // regex's .exec function:\n // capture[0] is the whole string\n // capture[1] is the first \"paren\" match, which is the\n // content of the math here, as if we wrote the regex\n // /\\$([^\\$]*)\\$/\n if (endIndex) {\n return [\n source.substring(0, endIndex),\n source.substring(startIndex, index),\n ];\n }\n return null;\n } else if (character === \"{\") {\n braceLevel++;\n } else if (character === \"}\") {\n braceLevel--;\n } else if (character === \"\\n\" && source[index - 1] === \"\\n\") {\n // This is a weird case we supported in the old\n // math implementation--double newlines break\n // math. I'm preserving it for now because content\n // creators might have questions with single '$'s\n // in paragraphs...\n return null;\n }\n\n index++;\n }\n\n // we didn't find a closing `$`\n return null;\n};\nconst mathMatch = (source: any, state: any): any =>\n mathMatcher(source, state, false);\nconst blockMathMatch = (source: any, state: any): any =>\n mathMatcher(source, state, true);\n\nconst TITLED_TABLE_REGEX = new RegExp(\n \"^\\\\|\\\\| +(.*) +\\\\|\\\\| *\\\\n\" +\n \"(\" +\n // The simple-markdown nptable regex, without\n // the leading `^`\n // @ts-expect-error - TS2532 - Object is possibly 'undefined'.\n SimpleMarkdown.defaultRules.nptable.match.regex.source.substring(1) +\n \")\",\n);\n\nconst crowdinJiptMatcher = SimpleMarkdown.blockRegex(/^(crwdns.*)\\n\\s*\\n/);\n\nexport const pureMarkdownRules = {\n ...SimpleMarkdown.defaultRules,\n\n // NOTE: basically ignored by JIPT. wraps everything at the outer layer\n columns: {\n order: -2,\n match: SimpleMarkdown.blockRegex(\n /^([\\s\\S]*\\n\\n)={5,}\\n\\n([\\s\\S]*)/,\n ) as any,\n parse: (capture: any, parse: any, state: any): any => {\n return {\n col1: parse(capture[1], state),\n col2: parse(capture[2], state),\n };\n },\n },\n crowdinId: {\n order: -1,\n match: (source: any, state: any, prevCapture: any): any => {\n // Only match on the just-in-place translation site\n if (state.isJipt) {\n return crowdinJiptMatcher(source, state, prevCapture);\n }\n return null;\n },\n parse: (capture: any, parse: any, state: any): any => ({\n id: capture[1],\n }),\n },\n // This is pretty much horrible, but we have a regex here to capture an\n // entire table + a title. capture[1] is the title. capture[2] of the\n // regex is a copy of the simple-markdown nptable regex. Then we turn\n // our capture[2] into tableCapture[0], and any further captures in\n // our table regex into tableCapture[1..], and we pass tableCapture to\n // our nptable regex\n titledTable: {\n // process immediately before nptables\n order: SimpleMarkdown.defaultRules.nptable.order - 0.5,\n match: SimpleMarkdown.blockRegex(TITLED_TABLE_REGEX) as any,\n parse: (capture: any, parse: any, state: any): any => {\n const title = SimpleMarkdown.parseInline(parse, capture[1], state);\n\n // Remove our [0] and [1] captures, and pass the rest to\n // the nptable parser\n const tableCapture = capture.slice(2);\n const table = SimpleMarkdown.defaultRules.nptable.parse(\n tableCapture,\n parse,\n state,\n );\n return {\n title: title,\n table: table,\n };\n },\n },\n widget: {\n order: SimpleMarkdown.defaultRules.link.order - 0.75,\n match: SimpleMarkdown.inlineRegex(rWidgetRule) as any,\n parse: (capture: any, parse: any, state: any): any => {\n return {\n id: capture[1],\n widgetType: capture[2],\n };\n },\n },\n blockMath: {\n order: (SimpleMarkdown.defaultRules.codeBlock.order + 0.5) as any,\n match: blockMathMatch,\n parse: (capture: any, parse: any, state: any): any => {\n return {\n content: capture[1],\n };\n },\n },\n math: {\n order: SimpleMarkdown.defaultRules.link.order - 0.25,\n match: mathMatch,\n parse: (capture: any, parse: any, state: any): any => {\n return {\n content: capture[1],\n };\n },\n },\n unescapedDollar: {\n order: SimpleMarkdown.defaultRules.link.order - 0.24,\n match: SimpleMarkdown.inlineRegex(/^(?!\\\\)\\$/) as any,\n parse: (capture: any, parse: any, state: any): any => {\n return {};\n },\n },\n fence: {\n ...SimpleMarkdown.defaultRules.fence,\n parse: (capture: any, parse: any, state: any): any => {\n const node = SimpleMarkdown.defaultRules.fence.parse(\n capture,\n parse,\n state,\n );\n\n // support screenreader-only text with ```alt\n if (node.lang === \"alt\") {\n return {\n type: \"codeBlock\",\n lang: \"alt\",\n // default codeBlock parsing doesn't parse the contents.\n // We need to parse the contents for things like table\n // support :).\n // The \\n\\n is because the inside of the codeblock might\n // not end in double newlines for block rules, because\n // ordinarily we don't parse this :).\n content: parse(node.content + \"\\n\\n\", state),\n };\n }\n return node;\n },\n },\n blockQuote: {\n ...SimpleMarkdown.defaultRules.blockQuote,\n // Replace the less restrictive blockquote regex from SimpleMarkdown\n // with a more restrictive one. The only difference should be that\n //\n // > A blockquote\n //\n // > Another blockquote\n //\n // will now match as two different blockQuotes instead of a single\n // blockquote with some paragraph breaks in it.\n //\n // The main motivation for doing this is to provide better support for\n // translators translating blockquotes with multiple paragraphs in\n // them. When translating articles, we split up paragraphs, translate\n // them separately, and then recombine them. We do this so that\n // translators don't have to translate an entire article at a time,\n // they can instead translate paragraph-by-paragraph.That system\n // doesn't understand blockquotes, so it will split up blockquotes into\n // more than one paragraph. A way to solve this would be to make that\n // system understand blockquotes, but then translators would have to\n // translate an entire, multi-paragraph blockquote at a time. Instead,\n // we choose to modify our blockquote matching to split up\n // multi-paragraph blockquotes into multiple blockquotes.\n //\n // There is also precedence for doing this splitting up in other\n // libraries, for instance CommonMark also splits up blockquotes with\n // empty lines into multiple blockquotes:\n // https://spec.commonmark.org/0.28/#example-205\n match: SimpleMarkdown.blockRegex(\n /^ *>[^\\n]+(\\n( *>)?[^\\n]+)*\\n{2,}/,\n ) as any,\n },\n // The lint rule never actually matches anything.\n // We check for lint after parsing, and, if we find any, we\n // transform the tree to add lint nodes. This rule is here\n // just for the react() function\n lint: {\n order: 1000,\n match: (s: any): any => null,\n parse: (capture: any, parse: any, state: any): any => ({}),\n },\n} as const;\n\n// @ts-expect-error - TS2345 - Argument of type '{ readonly columns: { readonly order: -2; readonly match: any; readonly parse: (capture: any, parse: any, state: any) => any; }; readonly crowdinId: { readonly order: -1; readonly match: (source: any, state: any, prevCapture: any) => any; readonly parse: (capture: any, parse: any, state: any) => any; }; ... 34 more ...' is not assignable to parameter of type 'ParserRules'.\nconst builtParser = SimpleMarkdown.parserFor(pureMarkdownRules);\n\nexport const parse = (source: string, state?: any): any => {\n const paragraphedSource = source + \"\\n\\n\";\n\n return builtParser(paragraphedSource, {\n ...state,\n inline: false,\n });\n};\n"],"names":["libName","libVersion","addLibraryVersionToPerseusDebug","rWidgetRule","mathMatcher","source","state","isBlock","length","index","inline","startIndex","braceLevel","character","endIndex","match","exec","slice","substring","mathMatch","blockMathMatch","TITLED_TABLE_REGEX","RegExp","SimpleMarkdown","defaultRules","nptable","regex","crowdinJiptMatcher","blockRegex","pureMarkdownRules","_extends","columns","order","parse","capture","col1","col2","crowdinId","prevCapture","isJipt","id","titledTable","title","parseInline","tableCapture","table","widget","link","inlineRegex","widgetType","blockMath","codeBlock","content","math","unescapedDollar","fence","node","lang","type","blockQuote","lint","s","builtParser","parserFor","paragraphedSource"],"mappings":";;;AAAA,SAAS,QAAQ,GAAG;AACpB,EAAE,OAAO,QAAQ,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,EAAE;AACxE,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC/C,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,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|
+
{"version":3,"file":"index.js","sources":["../../../../node_modules/@babel/runtime/helpers/esm/extends.js","../../src/version.ts","../../src/index.ts"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","// This file is processed by a Rollup plugin (replace) to inject the production\n// version number during the release build.\n// In dev, you'll never see the version number.\n\nimport {addLibraryVersionToPerseusDebug} from \"@khanacademy/perseus-core\";\n\nconst libName = \"@khanacademy/pure-markdown\";\nexport const libVersion = \"__lib_version__\";\n\naddLibraryVersionToPerseusDebug(libName, libVersion);\n","/**\n * Contains markdown related functions in pure javascript,\n * extracted from perseus-markdown.jsx\n * Note that this file may be used in stand alone nodejs, thus\n * do not import anything from Perseus\n */\nexport {libVersion} from \"./version\";\n\nimport SimpleMarkdown from \"@khanacademy/simple-markdown\";\n\nconst rWidgetRule = /^\\[\\[\\u2603 (([a-z-]+) ([0-9]+))\\]\\]/;\n\n/**\n * This match function matches math in `$`s, such as:\n *\n * $y = x + 1$\n *\n * It functions roughly like the following regex:\n * /\\$([^\\$]*)\\$/\n *\n * Unfortunately, math may have other `$`s inside it, as\n * long as they are inside `{` braces `}`, mostly for\n * `\\text{ $math$ }`.\n *\n * To parse this, we can't use a regex, since we\n * should support arbitrary nesting (even though\n * MathJax actually only supports two levels of nesting\n * here, which we *could* parse with a regex).\n *\n * Non-regex matchers like this are now a first-class\n * concept in simple-markdown. Yay!\n *\n * This can also match block-math, which is math alone in a paragraph.\n */\nconst mathMatcher = (source: any, state: any, isBlock: boolean) => {\n const length = source.length;\n let index = 0;\n\n // When looking for blocks, skip over leading spaces\n if (isBlock) {\n if (state.inline) {\n return null;\n }\n while (index < length && source[index] === \" \") {\n index++;\n }\n }\n\n // Our source must start with a \"$\"\n if (!(index < length && source[index] === \"$\")) {\n return null;\n }\n\n index++;\n const startIndex = index;\n let braceLevel = 0;\n\n // Loop through the source, looking for a closing '$'\n // closing '$'s only count if they are not escaped with\n // a `\\`, and we are not in nested `{}` braces.\n while (index < length) {\n const character = source[index];\n\n if (character === \"\\\\\") {\n // Consume both the `\\` and the escaped char as a single\n // token.\n // This is so that the second `$` in `$\\\\$` closes\n // the math expression, since the first `\\` is escaping\n // the second `\\`, but the second `\\` is not escaping\n // the second `$`.\n // This also handles the case of escaping `$`s or\n // braces `\\{`\n index++;\n } else if (braceLevel <= 0 && character === \"$\") {\n let endIndex = index + 1;\n if (isBlock) {\n // Look for two trailing newlines after the closing `$`\n const match = /^(?: *\\n){2,}/.exec(source.slice(endIndex));\n // @ts-expect-error - TS2322 - Type 'number | null' is not assignable to type 'number'.\n endIndex = match ? endIndex + match[0].length : null;\n }\n\n // Return an array that looks like the results of a\n // regex's .exec function:\n // capture[0] is the whole string\n // capture[1] is the first \"paren\" match, which is the\n // content of the math here, as if we wrote the regex\n // /\\$([^\\$]*)\\$/\n if (endIndex) {\n return [\n source.substring(0, endIndex),\n source.substring(startIndex, index),\n ];\n }\n return null;\n } else if (character === \"{\") {\n braceLevel++;\n } else if (character === \"}\") {\n braceLevel--;\n } else if (character === \"\\n\" && source[index - 1] === \"\\n\") {\n // This is a weird case we supported in the old\n // math implementation--double newlines break\n // math. I'm preserving it for now because content\n // creators might have questions with single '$'s\n // in paragraphs...\n return null;\n }\n\n index++;\n }\n\n // we didn't find a closing `$`\n return null;\n};\nconst mathMatch = (source: any, state: any): any =>\n mathMatcher(source, state, false);\nconst blockMathMatch = (source: any, state: any): any =>\n mathMatcher(source, state, true);\n\nconst TITLED_TABLE_REGEX = new RegExp(\n \"^\\\\|\\\\| +(.*) +\\\\|\\\\| *\\\\n\" +\n \"(\" +\n // The simple-markdown nptable regex, without\n // the leading `^`\n // @ts-expect-error - TS2532 - Object is possibly 'undefined'.\n SimpleMarkdown.defaultRules.nptable.match.regex.source.substring(1) +\n \")\",\n);\n\nconst crowdinJiptMatcher = SimpleMarkdown.blockRegex(/^(crwdns.*)\\n\\s*\\n/);\n\nexport const pureMarkdownRules = {\n ...SimpleMarkdown.defaultRules,\n\n // NOTE: basically ignored by JIPT. wraps everything at the outer layer\n columns: {\n order: -2,\n match: SimpleMarkdown.blockRegex(\n /^([\\s\\S]*\\n\\n)={5,}\\n\\n([\\s\\S]*)/,\n ) as any,\n parse: (capture: any, parse: any, state: any): any => {\n return {\n col1: parse(capture[1], state),\n col2: parse(capture[2], state),\n };\n },\n },\n crowdinId: {\n order: -1,\n match: (source: any, state: any, prevCapture: any): any => {\n // Only match on the just-in-place translation site\n if (state.isJipt) {\n return crowdinJiptMatcher(source, state, prevCapture);\n }\n return null;\n },\n parse: (capture: any, parse: any, state: any): any => ({\n id: capture[1],\n }),\n },\n // This is pretty much horrible, but we have a regex here to capture an\n // entire table + a title. capture[1] is the title. capture[2] of the\n // regex is a copy of the simple-markdown nptable regex. Then we turn\n // our capture[2] into tableCapture[0], and any further captures in\n // our table regex into tableCapture[1..], and we pass tableCapture to\n // our nptable regex\n titledTable: {\n // process immediately before nptables\n order: SimpleMarkdown.defaultRules.nptable.order - 0.5,\n match: SimpleMarkdown.blockRegex(TITLED_TABLE_REGEX) as any,\n parse: (capture: any, parse: any, state: any): any => {\n const title = SimpleMarkdown.parseInline(parse, capture[1], state);\n\n // Remove our [0] and [1] captures, and pass the rest to\n // the nptable parser\n const tableCapture = capture.slice(2);\n const table = SimpleMarkdown.defaultRules.nptable.parse(\n tableCapture,\n parse,\n state,\n );\n return {\n title: title,\n table: table,\n };\n },\n },\n widget: {\n order: SimpleMarkdown.defaultRules.link.order - 0.75,\n match: SimpleMarkdown.inlineRegex(rWidgetRule) as any,\n parse: (capture: any, parse: any, state: any): any => {\n return {\n id: capture[1],\n widgetType: capture[2],\n };\n },\n },\n blockMath: {\n order: (SimpleMarkdown.defaultRules.codeBlock.order + 0.5) as any,\n match: blockMathMatch,\n parse: (capture: any, parse: any, state: any): any => {\n return {\n content: capture[1],\n };\n },\n },\n math: {\n order: SimpleMarkdown.defaultRules.link.order - 0.25,\n match: mathMatch,\n parse: (capture: any, parse: any, state: any): any => {\n return {\n content: capture[1],\n };\n },\n },\n unescapedDollar: {\n order: SimpleMarkdown.defaultRules.link.order - 0.24,\n match: SimpleMarkdown.inlineRegex(/^(?!\\\\)\\$/) as any,\n parse: (capture: any, parse: any, state: any): any => {\n return {};\n },\n },\n fence: {\n ...SimpleMarkdown.defaultRules.fence,\n parse: (capture: any, parse: any, state: any): any => {\n const node = SimpleMarkdown.defaultRules.fence.parse(\n capture,\n parse,\n state,\n );\n\n // support screenreader-only text with ```alt\n if (node.lang === \"alt\") {\n return {\n type: \"codeBlock\",\n lang: \"alt\",\n // default codeBlock parsing doesn't parse the contents.\n // We need to parse the contents for things like table\n // support :).\n // The \\n\\n is because the inside of the codeblock might\n // not end in double newlines for block rules, because\n // ordinarily we don't parse this :).\n content: parse(node.content + \"\\n\\n\", state),\n };\n }\n return node;\n },\n },\n blockQuote: {\n ...SimpleMarkdown.defaultRules.blockQuote,\n // Replace the less restrictive blockquote regex from SimpleMarkdown\n // with a more restrictive one. The only difference should be that\n //\n // > A blockquote\n //\n // > Another blockquote\n //\n // will now match as two different blockQuotes instead of a single\n // blockquote with some paragraph breaks in it.\n //\n // The main motivation for doing this is to provide better support for\n // translators translating blockquotes with multiple paragraphs in\n // them. When translating articles, we split up paragraphs, translate\n // them separately, and then recombine them. We do this so that\n // translators don't have to translate an entire article at a time,\n // they can instead translate paragraph-by-paragraph.That system\n // doesn't understand blockquotes, so it will split up blockquotes into\n // more than one paragraph. A way to solve this would be to make that\n // system understand blockquotes, but then translators would have to\n // translate an entire, multi-paragraph blockquote at a time. Instead,\n // we choose to modify our blockquote matching to split up\n // multi-paragraph blockquotes into multiple blockquotes.\n //\n // There is also precedence for doing this splitting up in other\n // libraries, for instance CommonMark also splits up blockquotes with\n // empty lines into multiple blockquotes:\n // https://spec.commonmark.org/0.28/#example-205\n match: SimpleMarkdown.blockRegex(\n /^ *>[^\\n]+(\\n( *>)?[^\\n]+)*\\n{2,}/,\n ) as any,\n },\n // The lint rule never actually matches anything.\n // We check for lint after parsing, and, if we find any, we\n // transform the tree to add lint nodes. This rule is here\n // just for the react() function\n lint: {\n order: 1000,\n match: (s: any): any => null,\n parse: (capture: any, parse: any, state: any): any => ({}),\n },\n} as const;\n\n// @ts-expect-error - TS2345 - Argument of type '{ readonly columns: { readonly order: -2; readonly match: any; readonly parse: (capture: any, parse: any, state: any) => any; }; readonly crowdinId: { readonly order: -1; readonly match: (source: any, state: any, prevCapture: any) => any; readonly parse: (capture: any, parse: any, state: any) => any; }; ... 34 more ...' is not assignable to parameter of type 'ParserRules'.\nconst builtParser = SimpleMarkdown.parserFor(pureMarkdownRules);\n\nexport const parse = (source: string, state?: any): any => {\n const paragraphedSource = source + \"\\n\\n\";\n\n return builtParser(paragraphedSource, {\n ...state,\n inline: false,\n });\n};\n"],"names":["libName","libVersion","addLibraryVersionToPerseusDebug","rWidgetRule","mathMatcher","source","state","isBlock","length","index","inline","startIndex","braceLevel","character","endIndex","match","exec","slice","substring","mathMatch","blockMathMatch","TITLED_TABLE_REGEX","RegExp","SimpleMarkdown","defaultRules","nptable","regex","crowdinJiptMatcher","blockRegex","pureMarkdownRules","_extends","columns","order","parse","capture","col1","col2","crowdinId","prevCapture","isJipt","id","titledTable","title","parseInline","tableCapture","table","widget","link","inlineRegex","widgetType","blockMath","codeBlock","content","math","unescapedDollar","fence","node","lang","type","blockQuote","lint","s","builtParser","parserFor","paragraphedSource"],"mappings":";;;AAAe,SAAS,QAAQ,GAAG;AACnC,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,UAAU,MAAM,EAAE;AAChD,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC/C,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC,CAAC,C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;AAEzC,EAAA,OAAOyD,WAAW,CAACE,iBAAiB,EAAAlC,QAAA,KAC7BxB,KAAK,EAAA;AACRI,IAAAA,MAAM,EAAE,KAAA;AAAK,GAAA,CAChB,CAAC,CAAA;AACN;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
/**
|
|
3
2
|
* Contains markdown related functions in pure javascript,
|
|
4
3
|
* extracted from perseus-markdown.jsx
|
|
@@ -46,14 +45,14 @@ export declare const pureMarkdownRules: {
|
|
|
46
45
|
readonly parse: (capture: any, parse: any, state: any) => any;
|
|
47
46
|
readonly order: number;
|
|
48
47
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
49
|
-
readonly quality?: (
|
|
48
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
50
49
|
readonly react: import("@khanacademy/simple-markdown").ReactNodeOutput | null;
|
|
51
50
|
readonly html: ((node: import("@khanacademy/simple-markdown").SingleASTNode, nestedOutput: import("@khanacademy/simple-markdown").Output<string>, state: import("@khanacademy/simple-markdown").State) => string) | null;
|
|
52
51
|
};
|
|
53
52
|
readonly blockQuote: {
|
|
54
53
|
readonly match: any;
|
|
55
54
|
readonly order: number;
|
|
56
|
-
readonly quality?: (
|
|
55
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
57
56
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
58
57
|
[key: string]: any;
|
|
59
58
|
};
|
|
@@ -72,7 +71,7 @@ export declare const pureMarkdownRules: {
|
|
|
72
71
|
readonly heading: {
|
|
73
72
|
readonly order: number;
|
|
74
73
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
75
|
-
readonly quality?: (
|
|
74
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
76
75
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
77
76
|
[key: string]: any;
|
|
78
77
|
};
|
|
@@ -84,7 +83,7 @@ export declare const pureMarkdownRules: {
|
|
|
84
83
|
readonly nptable: {
|
|
85
84
|
readonly order: number;
|
|
86
85
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
87
|
-
readonly quality?: (
|
|
86
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
88
87
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
89
88
|
[key: string]: any;
|
|
90
89
|
};
|
|
@@ -92,7 +91,7 @@ export declare const pureMarkdownRules: {
|
|
|
92
91
|
readonly lheading: {
|
|
93
92
|
readonly order: number;
|
|
94
93
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
95
|
-
readonly quality?: (
|
|
94
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
96
95
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
97
96
|
[key: string]: any;
|
|
98
97
|
};
|
|
@@ -100,7 +99,7 @@ export declare const pureMarkdownRules: {
|
|
|
100
99
|
readonly hr: {
|
|
101
100
|
readonly order: number;
|
|
102
101
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
103
|
-
readonly quality?: (
|
|
102
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
104
103
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
105
104
|
[key: string]: any;
|
|
106
105
|
};
|
|
@@ -112,7 +111,7 @@ export declare const pureMarkdownRules: {
|
|
|
112
111
|
readonly codeBlock: {
|
|
113
112
|
readonly order: number;
|
|
114
113
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
115
|
-
readonly quality?: (
|
|
114
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
116
115
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
117
116
|
[key: string]: any;
|
|
118
117
|
};
|
|
@@ -124,7 +123,7 @@ export declare const pureMarkdownRules: {
|
|
|
124
123
|
readonly list: {
|
|
125
124
|
readonly order: number;
|
|
126
125
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
127
|
-
readonly quality?: (
|
|
126
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
128
127
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
129
128
|
[key: string]: any;
|
|
130
129
|
};
|
|
@@ -136,7 +135,7 @@ export declare const pureMarkdownRules: {
|
|
|
136
135
|
readonly def: {
|
|
137
136
|
readonly order: number;
|
|
138
137
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
139
|
-
readonly quality?: (
|
|
138
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
140
139
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
141
140
|
[key: string]: any;
|
|
142
141
|
};
|
|
@@ -148,7 +147,7 @@ export declare const pureMarkdownRules: {
|
|
|
148
147
|
readonly table: {
|
|
149
148
|
readonly order: number;
|
|
150
149
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
151
|
-
readonly quality?: (
|
|
150
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
152
151
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
153
152
|
[key: string]: any;
|
|
154
153
|
};
|
|
@@ -160,7 +159,7 @@ export declare const pureMarkdownRules: {
|
|
|
160
159
|
readonly tableSeparator: {
|
|
161
160
|
readonly order: number;
|
|
162
161
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
163
|
-
readonly quality?: (
|
|
162
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
164
163
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
165
164
|
[key: string]: any;
|
|
166
165
|
};
|
|
@@ -168,7 +167,7 @@ export declare const pureMarkdownRules: {
|
|
|
168
167
|
readonly newline: {
|
|
169
168
|
readonly order: number;
|
|
170
169
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
171
|
-
readonly quality?: (
|
|
170
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
172
171
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
173
172
|
[key: string]: any;
|
|
174
173
|
};
|
|
@@ -180,7 +179,7 @@ export declare const pureMarkdownRules: {
|
|
|
180
179
|
readonly paragraph: {
|
|
181
180
|
readonly order: number;
|
|
182
181
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
183
|
-
readonly quality?: (
|
|
182
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
184
183
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
185
184
|
[key: string]: any;
|
|
186
185
|
};
|
|
@@ -192,7 +191,7 @@ export declare const pureMarkdownRules: {
|
|
|
192
191
|
readonly escape: {
|
|
193
192
|
readonly order: number;
|
|
194
193
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
195
|
-
readonly quality?: (
|
|
194
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
196
195
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
197
196
|
[key: string]: any;
|
|
198
197
|
};
|
|
@@ -200,7 +199,7 @@ export declare const pureMarkdownRules: {
|
|
|
200
199
|
readonly autolink: {
|
|
201
200
|
readonly order: number;
|
|
202
201
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
203
|
-
readonly quality?: (
|
|
202
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
204
203
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
205
204
|
[key: string]: any;
|
|
206
205
|
};
|
|
@@ -208,7 +207,7 @@ export declare const pureMarkdownRules: {
|
|
|
208
207
|
readonly mailto: {
|
|
209
208
|
readonly order: number;
|
|
210
209
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
211
|
-
readonly quality?: (
|
|
210
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
212
211
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
213
212
|
[key: string]: any;
|
|
214
213
|
};
|
|
@@ -216,7 +215,7 @@ export declare const pureMarkdownRules: {
|
|
|
216
215
|
readonly url: {
|
|
217
216
|
readonly order: number;
|
|
218
217
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
219
|
-
readonly quality?: (
|
|
218
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
220
219
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
221
220
|
[key: string]: any;
|
|
222
221
|
};
|
|
@@ -224,7 +223,7 @@ export declare const pureMarkdownRules: {
|
|
|
224
223
|
readonly link: {
|
|
225
224
|
readonly order: number;
|
|
226
225
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
227
|
-
readonly quality?: (
|
|
226
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
228
227
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
229
228
|
[key: string]: any;
|
|
230
229
|
};
|
|
@@ -236,7 +235,7 @@ export declare const pureMarkdownRules: {
|
|
|
236
235
|
readonly image: {
|
|
237
236
|
readonly order: number;
|
|
238
237
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
239
|
-
readonly quality?: (
|
|
238
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
240
239
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
241
240
|
[key: string]: any;
|
|
242
241
|
};
|
|
@@ -248,7 +247,7 @@ export declare const pureMarkdownRules: {
|
|
|
248
247
|
readonly reflink: {
|
|
249
248
|
readonly order: number;
|
|
250
249
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
251
|
-
readonly quality?: (
|
|
250
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
252
251
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
253
252
|
[key: string]: any;
|
|
254
253
|
};
|
|
@@ -256,7 +255,7 @@ export declare const pureMarkdownRules: {
|
|
|
256
255
|
readonly refimage: {
|
|
257
256
|
readonly order: number;
|
|
258
257
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
259
|
-
readonly quality?: (
|
|
258
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
260
259
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
261
260
|
[key: string]: any;
|
|
262
261
|
};
|
|
@@ -264,7 +263,7 @@ export declare const pureMarkdownRules: {
|
|
|
264
263
|
readonly em: {
|
|
265
264
|
readonly order: number;
|
|
266
265
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
267
|
-
readonly quality?: (
|
|
266
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
268
267
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
269
268
|
[key: string]: any;
|
|
270
269
|
};
|
|
@@ -276,7 +275,7 @@ export declare const pureMarkdownRules: {
|
|
|
276
275
|
readonly strong: {
|
|
277
276
|
readonly order: number;
|
|
278
277
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
279
|
-
readonly quality?: (
|
|
278
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
280
279
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
281
280
|
[key: string]: any;
|
|
282
281
|
};
|
|
@@ -288,7 +287,7 @@ export declare const pureMarkdownRules: {
|
|
|
288
287
|
readonly u: {
|
|
289
288
|
readonly order: number;
|
|
290
289
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
291
|
-
readonly quality?: (
|
|
290
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
292
291
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
293
292
|
[key: string]: any;
|
|
294
293
|
};
|
|
@@ -300,7 +299,7 @@ export declare const pureMarkdownRules: {
|
|
|
300
299
|
readonly del: {
|
|
301
300
|
readonly order: number;
|
|
302
301
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
303
|
-
readonly quality?: (
|
|
302
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
304
303
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
305
304
|
[key: string]: any;
|
|
306
305
|
};
|
|
@@ -312,7 +311,7 @@ export declare const pureMarkdownRules: {
|
|
|
312
311
|
readonly inlineCode: {
|
|
313
312
|
readonly order: number;
|
|
314
313
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
315
|
-
readonly quality?: (
|
|
314
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
316
315
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
317
316
|
[key: string]: any;
|
|
318
317
|
};
|
|
@@ -324,7 +323,7 @@ export declare const pureMarkdownRules: {
|
|
|
324
323
|
readonly br: {
|
|
325
324
|
readonly order: number;
|
|
326
325
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
327
|
-
readonly quality?: (
|
|
326
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
328
327
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
329
328
|
[key: string]: any;
|
|
330
329
|
};
|
|
@@ -336,7 +335,7 @@ export declare const pureMarkdownRules: {
|
|
|
336
335
|
readonly text: {
|
|
337
336
|
readonly order: number;
|
|
338
337
|
readonly match: import("@khanacademy/simple-markdown").MatchFunction;
|
|
339
|
-
readonly quality?: (
|
|
338
|
+
readonly quality?: (capture: import("@khanacademy/simple-markdown").Capture, state: import("@khanacademy/simple-markdown").State, prevCapture: string) => number;
|
|
340
339
|
readonly parse: (capture: import("@khanacademy/simple-markdown").Capture, nestedParse: import("@khanacademy/simple-markdown").Parser, state: import("@khanacademy/simple-markdown").State) => {
|
|
341
340
|
[key: string]: any;
|
|
342
341
|
};
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var SimpleMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(SimpleMarkdown)
|
|
|
11
11
|
|
|
12
12
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
13
13
|
const libName = "@khanacademy/pure-markdown";
|
|
14
|
-
const libVersion = "0.3.
|
|
14
|
+
const libVersion = "0.3.15";
|
|
15
15
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
16
16
|
|
|
17
17
|
/**
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "SimpleMarkdown instance with non-react Perseus rules",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.15",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@khanacademy/perseus-core": "
|
|
29
|
-
"@khanacademy/simple-markdown": "^0.13.
|
|
28
|
+
"@khanacademy/perseus-core": "3.0.0",
|
|
29
|
+
"@khanacademy/simple-markdown": "^0.13.8"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {},
|
|
32
32
|
"peerDependencies": {},
|