@khanacademy/simple-markdown
Advanced tools
Comparing version 0.0.0-PR684-20230821213119 to 0.0.0-PR745-20230928001000
# @khanacademy/simple-markdown | ||
## 0.0.0-PR684-20230821213119 | ||
## 0.0.0-PR745-20230928001000 | ||
### Patch Changes | ||
- dc6c6973: Print package name and version when loaded in the page | ||
## 0.10.0 | ||
### Minor Changes | ||
- 0993a46b: Don't generate Flow types | ||
### Patch Changes | ||
- afb14cff: Add eslint rule to make type imports consistent | ||
- ce5e6297: Upgrade wonder-blocks deps to package versions without Flow types | ||
@@ -9,0 +20,0 @@ ## 0.9.3 |
@@ -1,28 +0,22 @@ | ||
/* eslint-disable prefer-spread, no-regex-spaces, @typescript-eslint/no-unused-vars, guard-for-in, no-console, no-var */ | ||
// This file is processed by a Rollup plugin (replace) to inject the production | ||
// version number during the release build. | ||
// In dev, you'll never see the version number. | ||
const libName = "@khanacademy/simple-markdown"; | ||
const libVersion = "0.10.0"; // Injected by the build in rollup.config.js; | ||
/** | ||
* Simple-Markdown | ||
* =============== | ||
* | ||
* Simple-Markdown's primary goal is to be easy to adapt. It aims | ||
* to be compliant with John Gruber's [Markdown Syntax page][1], | ||
* but compatiblity with other markdown implementations' edge-cases | ||
* will be sacrificed where it conflicts with simplicity or | ||
* extensibility. | ||
* | ||
* If your goal is to simply embed a standard markdown implementation | ||
* in your website, simple-markdown is probably not the best library | ||
* for you (although it should work). But if you have struggled to | ||
* customize an existing library to meet your needs, simple-markdown | ||
* might be able to help. | ||
* | ||
* Many of the regexes and original logic has been adapted from | ||
* the wonderful [marked.js](https://github.com/chjj/marked) | ||
* Log library version to the console. | ||
*/ | ||
if (globalThis && !globalThis.PERSEUS_SILENCE_LOGGING) { | ||
let prefix = "v"; | ||
const printString = ` * ${libName} ${prefix}${libVersion} * `; | ||
// eslint-disable-next-line no-console | ||
console.log(`%c${printString}`, "background: #000; color: #fff"); | ||
} | ||
/* eslint-disable prefer-spread, no-regex-spaces, @typescript-eslint/no-unused-vars, guard-for-in, no-console, no-var */ | ||
// Type Definitions: | ||
// We want to clarify our defaultRules types a little bit more so clients can | ||
// reuse defaultRules built-ins. So we make some stronger guarantess when | ||
// we can: | ||
// End TypeScript Definitions | ||
@@ -137,7 +131,7 @@ | ||
if (!(currQuality <= quality)) { | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'null'. | ||
ruleType = currRuleType; | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'ParserRule' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'ParserRule' is not assignable to type 'null'. | ||
rule = currRule; | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Capture' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'Capture' is not assignable to type 'null'. | ||
capture = currCapture; | ||
@@ -170,3 +164,3 @@ quality = currQuality; | ||
} | ||
// @ts-expect-error [FEI-5003] - TS2339 - Property 'index' does not exist on type 'never'. | ||
// @ts-expect-error - TS2339 - Property 'index' does not exist on type 'never'. | ||
if (capture.index) { | ||
@@ -177,3 +171,3 @@ // If present and non-zero, i.e. a non-^ regexp result: | ||
// @ts-expect-error [FEI-5003] - TS2339 - Property 'parse' does not exist on type 'never'. | ||
// @ts-expect-error - TS2339 - Property 'parse' does not exist on type 'never'. | ||
var parsed = rule.parse(capture, nestedParse, state); | ||
@@ -230,3 +224,3 @@ // We maintain the same object here so that rules can | ||
}; | ||
// @ts-expect-error [FEI-5003] - TS2339 - Property 'regex' does not exist on type '(source: string, state: State, prevCapture: string) => Capture | null | undefined'. | ||
// @ts-expect-error - TS2339 - Property 'regex' does not exist on type '(source: string, state: State, prevCapture: string) => Capture | null | undefined'. | ||
match.regex = regex; | ||
@@ -437,3 +431,3 @@ return match; | ||
} | ||
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'SingleASTNode' is not assignable to parameter of type 'never'. | ||
// @ts-expect-error - TS2345 - Argument of type 'SingleASTNode' is not assignable to parameter of type 'never'. | ||
cells[cells.length - 1].push(node); | ||
@@ -697,3 +691,3 @@ } | ||
var start = ordered ? +bullet : undefined; | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'RegExpMatchArray | null' is not assignable to type 'string[]'. | ||
// @ts-expect-error - TS2322 - Type 'RegExpMatchArray | null' is not assignable to type 'string[]'. | ||
var items = capture[0].replace(LIST_BLOCK_END_R, "\n").match(LIST_ITEM_R); | ||
@@ -1255,3 +1249,3 @@ | ||
var nestedRuleOutput = function nestedRuleOutput(ast, outputFunc, state) { | ||
// @ts-expect-error [FEI-5003] - TS2349 - This expression is not callable. | ||
// @ts-expect-error - TS2349 - This expression is not callable. | ||
// Type 'unknown' has no call signatures. | ||
@@ -1279,3 +1273,3 @@ return rules[ast.type][property](ast, outputFunc, state); | ||
if (typeof nodeOut === "string" && typeof lastResult === "string") { | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'null'. | ||
lastResult = lastResult + nodeOut; | ||
@@ -1285,3 +1279,3 @@ result[result.length - 1] = lastResult; | ||
result.push(nodeOut); | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'ReactNode' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'ReactNode' is not assignable to type 'null'. | ||
lastResult = nodeOut; | ||
@@ -1322,7 +1316,7 @@ } | ||
// Tricks to convince tsc that this var is not null: | ||
// @ts-expect-error [FEI-5003] - TS2538 - Type 'symbol' cannot be used as an index type. | ||
// @ts-expect-error - TS2538 - Type 'symbol' cannot be used as an index type. | ||
var arrayRuleCheck = arrayRule[property]; | ||
if (!arrayRuleCheck) { | ||
throw new Error("simple-markdown: outputFor: to join nodes of type `" + | ||
// @ts-expect-error [FEI-5003] - TS2469 - The '+' operator cannot be applied to type 'symbol'. | ||
// @ts-expect-error - TS2469 - The '+' operator cannot be applied to type 'symbol'. | ||
property + "` you must provide an `Array:` joiner rule with that type, " + "Please see the docs for details on specifying an Array rule."); | ||
@@ -1337,3 +1331,3 @@ } | ||
} else { | ||
// @ts-expect-error [FEI-5003] - TS2349 - This expression is not callable. | ||
// @ts-expect-error - TS2349 - This expression is not callable. | ||
// Type 'unknown' has no call signatures. | ||
@@ -1350,3 +1344,3 @@ return rules[ast.type][property](ast, nestedOutput, state); | ||
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'DefaultRules' is not assignable to parameter of type 'ParserRules'. | ||
// @ts-expect-error - TS2345 - Argument of type 'DefaultRules' is not assignable to parameter of type 'ParserRules'. | ||
var defaultRawParse = parserFor(defaultRules); | ||
@@ -1433,3 +1427,3 @@ var defaultBlockParse = function defaultBlockParse(source, state) { | ||
export { SimpleMarkdown as default }; | ||
export { SimpleMarkdown as default, libVersion }; | ||
//# sourceMappingURL=index.js.map |
@@ -22,2 +22,3 @@ /** | ||
import type * as React from "react"; | ||
export { default as libVersion } from "./version"; | ||
type Attr = string | number | boolean | null | undefined; | ||
@@ -24,0 +25,0 @@ type SingleASTNode = { |
'use strict'; | ||
/* eslint-disable prefer-spread, no-regex-spaces, @typescript-eslint/no-unused-vars, guard-for-in, no-console, no-var */ | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
// This file is processed by a Rollup plugin (replace) to inject the production | ||
// version number during the release build. | ||
// In dev, you'll never see the version number. | ||
const libName = "@khanacademy/simple-markdown"; | ||
const libVersion = "0.10.0"; // Injected by the build in rollup.config.js; | ||
/** | ||
* Simple-Markdown | ||
* =============== | ||
* | ||
* Simple-Markdown's primary goal is to be easy to adapt. It aims | ||
* to be compliant with John Gruber's [Markdown Syntax page][1], | ||
* but compatiblity with other markdown implementations' edge-cases | ||
* will be sacrificed where it conflicts with simplicity or | ||
* extensibility. | ||
* | ||
* If your goal is to simply embed a standard markdown implementation | ||
* in your website, simple-markdown is probably not the best library | ||
* for you (although it should work). But if you have struggled to | ||
* customize an existing library to meet your needs, simple-markdown | ||
* might be able to help. | ||
* | ||
* Many of the regexes and original logic has been adapted from | ||
* the wonderful [marked.js](https://github.com/chjj/marked) | ||
* Log library version to the console. | ||
*/ | ||
if (globalThis && !globalThis.PERSEUS_SILENCE_LOGGING) { | ||
let prefix = "v"; | ||
const printString = " * ".concat(libName, " ").concat(prefix).concat(libVersion, " * "); | ||
// eslint-disable-next-line no-console | ||
console.log("%c".concat(printString), "background: #000; color: #fff"); | ||
} | ||
/* eslint-disable prefer-spread, no-regex-spaces, @typescript-eslint/no-unused-vars, guard-for-in, no-console, no-var */ | ||
// Type Definitions: | ||
// We want to clarify our defaultRules types a little bit more so clients can | ||
// reuse defaultRules built-ins. So we make some stronger guarantess when | ||
// we can: | ||
// End TypeScript Definitions | ||
@@ -139,7 +135,7 @@ | ||
if (!(currQuality <= quality)) { | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'null'. | ||
ruleType = currRuleType; | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'ParserRule' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'ParserRule' is not assignable to type 'null'. | ||
rule = currRule; | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Capture' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'Capture' is not assignable to type 'null'. | ||
capture = currCapture; | ||
@@ -172,3 +168,3 @@ quality = currQuality; | ||
} | ||
// @ts-expect-error [FEI-5003] - TS2339 - Property 'index' does not exist on type 'never'. | ||
// @ts-expect-error - TS2339 - Property 'index' does not exist on type 'never'. | ||
if (capture.index) { | ||
@@ -179,3 +175,3 @@ // If present and non-zero, i.e. a non-^ regexp result: | ||
// @ts-expect-error [FEI-5003] - TS2339 - Property 'parse' does not exist on type 'never'. | ||
// @ts-expect-error - TS2339 - Property 'parse' does not exist on type 'never'. | ||
var parsed = rule.parse(capture, nestedParse, state); | ||
@@ -232,3 +228,3 @@ // We maintain the same object here so that rules can | ||
}; | ||
// @ts-expect-error [FEI-5003] - TS2339 - Property 'regex' does not exist on type '(source: string, state: State, prevCapture: string) => Capture | null | undefined'. | ||
// @ts-expect-error - TS2339 - Property 'regex' does not exist on type '(source: string, state: State, prevCapture: string) => Capture | null | undefined'. | ||
match.regex = regex; | ||
@@ -439,3 +435,3 @@ return match; | ||
} | ||
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'SingleASTNode' is not assignable to parameter of type 'never'. | ||
// @ts-expect-error - TS2345 - Argument of type 'SingleASTNode' is not assignable to parameter of type 'never'. | ||
cells[cells.length - 1].push(node); | ||
@@ -699,3 +695,3 @@ } | ||
var start = ordered ? +bullet : undefined; | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'RegExpMatchArray | null' is not assignable to type 'string[]'. | ||
// @ts-expect-error - TS2322 - Type 'RegExpMatchArray | null' is not assignable to type 'string[]'. | ||
var items = capture[0].replace(LIST_BLOCK_END_R, "\n").match(LIST_ITEM_R); | ||
@@ -1257,3 +1253,3 @@ | ||
var nestedRuleOutput = function (ast, outputFunc, state) { | ||
// @ts-expect-error [FEI-5003] - TS2349 - This expression is not callable. | ||
// @ts-expect-error - TS2349 - This expression is not callable. | ||
// Type 'unknown' has no call signatures. | ||
@@ -1281,3 +1277,3 @@ return rules[ast.type][property](ast, outputFunc, state); | ||
if (typeof nodeOut === "string" && typeof lastResult === "string") { | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'null'. | ||
lastResult = lastResult + nodeOut; | ||
@@ -1287,3 +1283,3 @@ result[result.length - 1] = lastResult; | ||
result.push(nodeOut); | ||
// @ts-expect-error [FEI-5003] - TS2322 - Type 'ReactNode' is not assignable to type 'null'. | ||
// @ts-expect-error - TS2322 - Type 'ReactNode' is not assignable to type 'null'. | ||
lastResult = nodeOut; | ||
@@ -1325,7 +1321,7 @@ } | ||
// Tricks to convince tsc that this var is not null: | ||
// @ts-expect-error [FEI-5003] - TS2538 - Type 'symbol' cannot be used as an index type. | ||
// @ts-expect-error - TS2538 - Type 'symbol' cannot be used as an index type. | ||
var arrayRuleCheck = arrayRule[property]; | ||
if (!arrayRuleCheck) { | ||
throw new Error("simple-markdown: outputFor: to join nodes of type `" + | ||
// @ts-expect-error [FEI-5003] - TS2469 - The '+' operator cannot be applied to type 'symbol'. | ||
// @ts-expect-error - TS2469 - The '+' operator cannot be applied to type 'symbol'. | ||
property + "` you must provide an `Array:` joiner rule with that type, " + "Please see the docs for details on specifying an Array rule."); | ||
@@ -1340,3 +1336,3 @@ } | ||
} else { | ||
// @ts-expect-error [FEI-5003] - TS2349 - This expression is not callable. | ||
// @ts-expect-error - TS2349 - This expression is not callable. | ||
// Type 'unknown' has no call signatures. | ||
@@ -1353,3 +1349,3 @@ return rules[ast.type][property](ast, nestedOutput, state); | ||
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'DefaultRules' is not assignable to parameter of type 'ParserRules'. | ||
// @ts-expect-error - TS2345 - Argument of type 'DefaultRules' is not assignable to parameter of type 'ParserRules'. | ||
var defaultRawParse = parserFor(defaultRules); | ||
@@ -1442,3 +1438,4 @@ var defaultBlockParse = function (source, state) { | ||
module.exports = SimpleMarkdown; | ||
exports["default"] = SimpleMarkdown; | ||
exports.libVersion = libVersion; | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.0-PR684-20230821213119", | ||
"version": "0.0.0-PR745-20230928001000", | ||
"publishConfig": { | ||
@@ -13,3 +13,4 @@ "access": "public" | ||
"type": "git", | ||
"url": "https://github.com/Khan/simple-markdown.git" | ||
"url": "https://github.com/Khan/perseus.git", | ||
"directory": "packages/simple-markdown" | ||
}, | ||
@@ -30,3 +31,3 @@ "bugs": { | ||
"@types/react-dom": ">=16.0.0", | ||
"perseus-build-settings": "^0.1.0", | ||
"perseus-build-settings": "^0.2.0", | ||
"size-limit": "^0.21.1", | ||
@@ -33,0 +34,0 @@ "typescript": "^3.6.4", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
9528
654241
17