@khanacademy/simple-markdown 0.14.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -1,11 +1,34 @@
1
1
  import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-utils';
2
2
 
3
3
  // This file is processed by a Rollup plugin (replace) to inject the production
4
+ // version number during the release build.
5
+ // In dev, you'll never see the version number.
6
+
4
7
  const libName = "@khanacademy/simple-markdown";
5
- const libVersion = "0.14.1";
8
+ const libVersion = "2.0.0";
6
9
  addLibraryVersionToPerseusDebug(libName, libVersion);
7
10
 
8
11
  /* eslint-disable prefer-spread, no-regex-spaces, guard-for-in, no-console, no-var */
12
+ /**
13
+ * Simple-Markdown
14
+ * ===============
15
+ *
16
+ * Simple-Markdown's primary goal is to be easy to adapt. It aims
17
+ * to be compliant with John Gruber's [Markdown Syntax page][1],
18
+ * but compatiblity with other markdown implementations' edge-cases
19
+ * will be sacrificed where it conflicts with simplicity or
20
+ * extensibility.
21
+ *
22
+ * If your goal is to simply embed a standard markdown implementation
23
+ * in your website, simple-markdown is probably not the best library
24
+ * for you (although it should work). But if you have struggled to
25
+ * customize an existing library to meet your needs, simple-markdown
26
+ * might be able to help.
27
+ *
28
+ * Many of the regexes and original logic has been adapted from
29
+ * the wonderful [marked.js](https://github.com/chjj/marked)
30
+ */
31
+
9
32
 
10
33
  // Type Definitions:
11
34
 
@@ -139,8 +162,10 @@ var parserFor = function parserFor(rules, defaultState) {
139
162
  currRule = rules[currRuleType];
140
163
  } while (
141
164
  // keep looping while we're still within the ruleList
165
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
142
166
  currRule && (
143
167
  // if we don't have a match yet, continue
168
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
144
169
  !capture ||
145
170
  // or if we have a match, but the next rule is
146
171
  // at the same order, and has a quality measurement
@@ -238,7 +263,11 @@ var anyScopeRegex = function anyScopeRegex(regex) {
238
263
  match.regex = regex;
239
264
  return match;
240
265
  };
241
- var TYPE_SYMBOL = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
266
+ var TYPE_SYMBOL = typeof Symbol === "function" &&
267
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
268
+ Symbol.for &&
269
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
270
+ Symbol.for("react.element") || 0xeac7;
242
271
  var reactElement = function reactElement(type, key, props) {
243
272
  var element = {
244
273
  $$typeof: TYPE_SYMBOL,
@@ -266,7 +295,9 @@ var htmlTag = function htmlTag(tagName, content, attributes, isClosed) {
266
295
  for (var attr in attributes) {
267
296
  var attribute = attributes[attr];
268
297
  // Removes falsey attributes
269
- if (Object.prototype.hasOwnProperty.call(attributes, attr) && attribute) {
298
+ if (Object.prototype.hasOwnProperty.call(attributes, attr) &&
299
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
300
+ attribute) {
270
301
  attributeString += " " + sanitizeText(attr) + '="' + sanitizeText(attribute) + '"';
271
302
  }
272
303
  }
@@ -1235,6 +1266,7 @@ var defaultRules = {
1235
1266
 
1236
1267
  /** (deprecated) */
1237
1268
  var ruleOutput = function ruleOutput(rules, property) {
1269
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
1238
1270
  if (!property && typeof console !== "undefined") {
1239
1271
  console.warn("simple-markdown ruleOutput should take 'react' or " + "'html' as the second argument.");
1240
1272
  }
@@ -1296,6 +1328,7 @@ var htmlFor = function htmlFor(outputFunc) {
1296
1328
  return nestedOutput;
1297
1329
  };
1298
1330
  var outputFor = function outputFor(rules, property, defaultState = {}) {
1331
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
1299
1332
  if (!property) {
1300
1333
  throw new Error("simple-markdown: outputFor: `property` must be " + "defined. " + "if you just upgraded, you probably need to replace `outputFor` " + "with `reactFor`");
1301
1334
  }