@khanacademy/perseus-linter 0.3.2 → 0.3.4

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/index.d.ts CHANGED
@@ -3,5 +3,29 @@ export { linterContextProps, linterContextDefault } from "./proptypes";
3
3
  export type { LinterContextProps } from "./types";
4
4
  declare const allLintRules: ReadonlyArray<any>;
5
5
  export { Rule, allLintRules as rules };
6
+ /**
7
+ * Run the Perseus linter over the specified markdown parse tree,
8
+ * with the specified context object, and
9
+ * return a (possibly empty) array of lint warning objects. If the
10
+ * highlight argument is true, this function also modifies the parse
11
+ * tree to add "lint" nodes that can be visually rendered,
12
+ * highlighting the problems for the user. The optional rules argument
13
+ * is an array of Rule objects specifying which lint rules should be
14
+ * applied to this parse tree. When omitted, a default set of rules is used.
15
+ *
16
+ * The context object may have additional properties that some lint
17
+ * rules require:
18
+ *
19
+ * context.content is the source content string that was parsed to create
20
+ * the parse tree.
21
+ *
22
+ * context.widgets is the widgets object associated
23
+ * with the content string
24
+ *
25
+ * TODO: to make this even more general, allow the first argument to be
26
+ * a string and run the parser over it in that case? (but ignore highlight
27
+ * in that case). This would allow the one function to be used for both
28
+ * online linting and batch linting.
29
+ */
6
30
  export declare function runLinter(tree: any, context: any, highlight: boolean, rules?: ReadonlyArray<any>): ReadonlyArray<any>;
7
31
  export declare function pushContextStack(context: any, name: string): any;
package/dist/index.js CHANGED
@@ -1566,30 +1566,30 @@ const linterContextDefault = {
1566
1566
 
1567
1567
  const allLintRules = AllRules.filter(r => r.severity < Rule.Severity.BULK_WARNING);
1568
1568
 
1569
- //
1570
- // Run the Perseus linter over the specified markdown parse tree,
1571
- // with the specified context object, and
1572
- // return a (possibly empty) array of lint warning objects. If the
1573
- // highlight argument is true, this function also modifies the parse
1574
- // tree to add "lint" nodes that can be visually rendered,
1575
- // highlighting the problems for the user. The optional rules argument
1576
- // is an array of Rule objects specifying which lint rules should be
1577
- // applied to this parse tree. When omitted, a default set of rules is used.
1578
- //
1579
- // The context object may have additional properties that some lint
1580
- // rules require:
1581
- //
1582
- // context.content is the source content string that was parsed to create
1583
- // the parse tree.
1584
- //
1585
- // context.widgets is the widgets object associated
1586
- // with the content string
1587
- //
1588
- // TODO: to make this even more general, allow the first argument to be
1589
- // a string and run the parser over it in that case? (but ignore highlight
1590
- // in that case). This would allow the one function to be used for both
1591
- // online linting and batch linting.
1592
- //
1569
+ /**
1570
+ * Run the Perseus linter over the specified markdown parse tree,
1571
+ * with the specified context object, and
1572
+ * return a (possibly empty) array of lint warning objects. If the
1573
+ * highlight argument is true, this function also modifies the parse
1574
+ * tree to add "lint" nodes that can be visually rendered,
1575
+ * highlighting the problems for the user. The optional rules argument
1576
+ * is an array of Rule objects specifying which lint rules should be
1577
+ * applied to this parse tree. When omitted, a default set of rules is used.
1578
+ *
1579
+ * The context object may have additional properties that some lint
1580
+ * rules require:
1581
+ *
1582
+ * context.content is the source content string that was parsed to create
1583
+ * the parse tree.
1584
+ *
1585
+ * context.widgets is the widgets object associated
1586
+ * with the content string
1587
+ *
1588
+ * TODO: to make this even more general, allow the first argument to be
1589
+ * a string and run the parser over it in that case? (but ignore highlight
1590
+ * in that case). This would allow the one function to be used for both
1591
+ * online linting and batch linting.
1592
+ */
1593
1593
  function runLinter(tree, context, highlight) {
1594
1594
  let rules = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : allLintRules;
1595
1595
  const warnings = [];