chaffjs 0.17.0 → 0.19.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/README.md +52 -56
- package/bin/chaff.js +17 -2
- package/dist/acronym-expansions.d.ts +26 -0
- package/dist/acronym-expansions.d.ts.map +1 -0
- package/dist/acronym-expansions.js +88 -0
- package/dist/acronym-expansions.js.map +1 -0
- package/dist/announced-count.d.ts +26 -0
- package/dist/announced-count.d.ts.map +1 -0
- package/dist/announced-count.js +138 -0
- package/dist/announced-count.js.map +1 -0
- package/dist/announced-list.d.ts +30 -0
- package/dist/announced-list.d.ts.map +1 -0
- package/dist/announced-list.js +95 -0
- package/dist/announced-list.js.map +1 -0
- package/dist/api.d.ts +168 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +10 -0
- package/dist/api.js.map +1 -0
- package/dist/bare-url.d.ts +14 -0
- package/dist/bare-url.d.ts.map +1 -0
- package/dist/bare-url.js +28 -0
- package/dist/bare-url.js.map +1 -0
- package/dist/baseline.d.ts +5 -0
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +16 -1
- package/dist/baseline.js.map +1 -1
- package/dist/body-section.d.ts +7 -0
- package/dist/body-section.d.ts.map +1 -0
- package/dist/body-section.js +6 -0
- package/dist/body-section.js.map +1 -0
- package/dist/calendar-number.d.ts +2 -0
- package/dist/calendar-number.d.ts.map +1 -1
- package/dist/calendar-number.js +9 -2
- package/dist/calendar-number.js.map +1 -1
- package/dist/cli-args.d.ts +4 -0
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +5 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-text.d.ts +0 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +14 -18
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +83 -84
- package/dist/cli.js.map +1 -1
- package/dist/closing-paragraph.d.ts +7 -0
- package/dist/closing-paragraph.d.ts.map +1 -0
- package/dist/closing-paragraph.js +22 -0
- package/dist/closing-paragraph.js.map +1 -0
- package/dist/commands/compare.d.ts +15 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +64 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/document-commands.d.ts +9 -0
- package/dist/commands/document-commands.d.ts.map +1 -0
- package/dist/commands/document-commands.js +17 -0
- package/dist/commands/document-commands.js.map +1 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +19 -10
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/facts.d.ts +8 -0
- package/dist/commands/facts.d.ts.map +1 -0
- package/dist/commands/facts.js +30 -0
- package/dist/commands/facts.js.map +1 -0
- package/dist/commands/feedback.d.ts +15 -2
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +36 -6
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/fix-plan.d.ts +13 -0
- package/dist/commands/fix-plan.d.ts.map +1 -0
- package/dist/commands/fix-plan.js +44 -0
- package/dist/commands/fix-plan.js.map +1 -0
- package/dist/commands/outline.d.ts +8 -0
- package/dist/commands/outline.d.ts.map +1 -0
- package/dist/commands/outline.js +43 -0
- package/dist/commands/outline.js.map +1 -0
- package/dist/commands/read-document.d.ts +14 -0
- package/dist/commands/read-document.d.ts.map +1 -0
- package/dist/commands/read-document.js +21 -0
- package/dist/commands/read-document.js.map +1 -0
- package/dist/commands/suppressions.d.ts +7 -0
- package/dist/commands/suppressions.d.ts.map +1 -0
- package/dist/commands/suppressions.js +9 -0
- package/dist/commands/suppressions.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +3 -5
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/tree.d.ts +13 -0
- package/dist/commands/tree.d.ts.map +1 -1
- package/dist/commands/tree.js +35 -5
- package/dist/commands/tree.js.map +1 -1
- package/dist/compare/atom.d.ts +31 -0
- package/dist/compare/atom.d.ts.map +1 -0
- package/dist/compare/atom.js +4 -0
- package/dist/compare/atom.js.map +1 -0
- package/dist/compare/clock-time.d.ts +8 -0
- package/dist/compare/clock-time.d.ts.map +1 -0
- package/dist/compare/clock-time.js +68 -0
- package/dist/compare/clock-time.js.map +1 -0
- package/dist/compare/distinct.d.ts +9 -0
- package/dist/compare/distinct.d.ts.map +1 -0
- package/dist/compare/distinct.js +12 -0
- package/dist/compare/distinct.js.map +1 -0
- package/dist/compare/extract.d.ts +15 -0
- package/dist/compare/extract.d.ts.map +1 -0
- package/dist/compare/extract.js +60 -0
- package/dist/compare/extract.js.map +1 -0
- package/dist/compare/fact-key.d.ts +17 -0
- package/dist/compare/fact-key.d.ts.map +1 -0
- package/dist/compare/fact-key.js +25 -0
- package/dist/compare/fact-key.js.map +1 -0
- package/dist/compare/fact-text.d.ts +28 -0
- package/dist/compare/fact-text.d.ts.map +1 -0
- package/dist/compare/fact-text.js +61 -0
- package/dist/compare/fact-text.js.map +1 -0
- package/dist/compare/facts-render.d.ts +17 -0
- package/dist/compare/facts-render.d.ts.map +1 -0
- package/dist/compare/facts-render.js +43 -0
- package/dist/compare/facts-render.js.map +1 -0
- package/dist/compare/facts-text.d.ts +15 -0
- package/dist/compare/facts-text.d.ts.map +1 -0
- package/dist/compare/facts-text.js +27 -0
- package/dist/compare/facts-text.js.map +1 -0
- package/dist/compare/markup-atoms.d.ts +11 -0
- package/dist/compare/markup-atoms.d.ts.map +1 -0
- package/dist/compare/markup-atoms.js +23 -0
- package/dist/compare/markup-atoms.js.map +1 -0
- package/dist/compare/match.d.ts +20 -0
- package/dist/compare/match.d.ts.map +1 -0
- package/dist/compare/match.js +84 -0
- package/dist/compare/match.js.map +1 -0
- package/dist/compare/outcome.d.ts +36 -0
- package/dist/compare/outcome.d.ts.map +1 -0
- package/dist/compare/outcome.js +46 -0
- package/dist/compare/outcome.js.map +1 -0
- package/dist/compare/proper-nouns.d.ts +19 -0
- package/dist/compare/proper-nouns.d.ts.map +1 -0
- package/dist/compare/proper-nouns.js +43 -0
- package/dist/compare/proper-nouns.js.map +1 -0
- package/dist/compare/render.d.ts +13 -0
- package/dist/compare/render.d.ts.map +1 -0
- package/dist/compare/render.js +64 -0
- package/dist/compare/render.js.map +1 -0
- package/dist/compare/spans.d.ts +9 -0
- package/dist/compare/spans.d.ts.map +1 -0
- package/dist/compare/spans.js +11 -0
- package/dist/compare/spans.js.map +1 -0
- package/dist/compare/text-atoms.d.ts +27 -0
- package/dist/compare/text-atoms.d.ts.map +1 -0
- package/dist/compare/text-atoms.js +69 -0
- package/dist/compare/text-atoms.js.map +1 -0
- package/dist/compare/text.d.ts +24 -0
- package/dist/compare/text.d.ts.map +1 -0
- package/dist/compare/text.js +90 -0
- package/dist/compare/text.js.map +1 -0
- package/dist/compare/tree-atoms.d.ts +20 -0
- package/dist/compare/tree-atoms.d.ts.map +1 -0
- package/dist/compare/tree-atoms.js +58 -0
- package/dist/compare/tree-atoms.js.map +1 -0
- package/dist/compare/written-names.d.ts +8 -0
- package/dist/compare/written-names.d.ts.map +1 -0
- package/dist/compare/written-names.js +24 -0
- package/dist/compare/written-names.js.map +1 -0
- package/dist/config/load.d.ts +23 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +6 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +17 -0
- package/dist/config/option-problems.d.ts.map +1 -0
- package/dist/config/option-problems.js +59 -0
- package/dist/config/option-problems.js.map +1 -0
- package/dist/config/read.d.ts +4 -0
- package/dist/config/read.d.ts.map +1 -0
- package/dist/config/read.js +8 -0
- package/dist/config/read.js.map +1 -0
- package/dist/config/rule-problems.d.ts +2 -4
- package/dist/config/rule-problems.d.ts.map +1 -1
- package/dist/config/rule-problems.js +7 -1
- package/dist/config/rule-problems.js.map +1 -1
- package/dist/config/style.d.ts +21 -0
- package/dist/config/style.d.ts.map +1 -0
- package/dist/config/style.js +48 -0
- package/dist/config/style.js.map +1 -0
- package/dist/config/warnings.d.ts +6 -0
- package/dist/config/warnings.d.ts.map +1 -0
- package/dist/config/warnings.js +10 -0
- package/dist/config/warnings.js.map +1 -0
- package/dist/config/write.d.ts.map +1 -1
- package/dist/config/write.js +17 -4
- package/dist/config/write.js.map +1 -1
- package/dist/custom/bounded-match.d.ts +15 -0
- package/dist/custom/bounded-match.d.ts.map +1 -0
- package/dist/custom/bounded-match.js +43 -0
- package/dist/custom/bounded-match.js.map +1 -0
- package/dist/custom/load.d.ts +11 -0
- package/dist/custom/load.d.ts.map +1 -0
- package/dist/custom/load.js +19 -0
- package/dist/custom/load.js.map +1 -0
- package/dist/custom/module-path.d.ts +11 -0
- package/dist/custom/module-path.d.ts.map +1 -0
- package/dist/custom/module-path.js +15 -0
- package/dist/custom/module-path.js.map +1 -0
- package/dist/custom/parse.d.ts +84 -0
- package/dist/custom/parse.d.ts.map +1 -0
- package/dist/custom/parse.js +258 -0
- package/dist/custom/parse.js.map +1 -0
- package/dist/custom/problems.d.ts +8 -0
- package/dist/custom/problems.d.ts.map +1 -0
- package/dist/custom/problems.js +95 -0
- package/dist/custom/problems.js.map +1 -0
- package/dist/custom/regex-safety.d.ts +11 -0
- package/dist/custom/regex-safety.d.ts.map +1 -0
- package/dist/custom/regex-safety.js +110 -0
- package/dist/custom/regex-safety.js.map +1 -0
- package/dist/custom/token-pattern.d.ts +8 -0
- package/dist/custom/token-pattern.d.ts.map +1 -0
- package/dist/custom/token-pattern.js +75 -0
- package/dist/custom/token-pattern.js.map +1 -0
- package/dist/detect-language.js +1 -1
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +30 -2
- package/dist/detect.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +2 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +12 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts +23 -0
- package/dist/detectors/ai-phrasing.d.ts.map +1 -0
- package/dist/detectors/ai-phrasing.js +116 -0
- package/dist/detectors/ai-phrasing.js.map +1 -0
- package/dist/detectors/announced-count.d.ts +4 -0
- package/dist/detectors/announced-count.d.ts.map +1 -0
- package/dist/detectors/announced-count.js +20 -0
- package/dist/detectors/announced-count.js.map +1 -0
- package/dist/detectors/bold-label.d.ts +10 -0
- package/dist/detectors/bold-label.d.ts.map +1 -0
- package/dist/detectors/bold-label.js +44 -0
- package/dist/detectors/bold-label.js.map +1 -0
- package/dist/detectors/broken-link.d.ts +17 -0
- package/dist/detectors/broken-link.d.ts.map +1 -0
- package/dist/detectors/broken-link.js +66 -0
- package/dist/detectors/broken-link.js.map +1 -0
- package/dist/detectors/cited-name.d.ts.map +1 -1
- package/dist/detectors/cited-name.js +4 -4
- package/dist/detectors/cited-name.js.map +1 -1
- package/dist/detectors/cited-title.d.ts +11 -0
- package/dist/detectors/cited-title.d.ts.map +1 -0
- package/dist/detectors/cited-title.js +75 -0
- package/dist/detectors/cited-title.js.map +1 -0
- package/dist/detectors/concrete-evidence.d.ts +1 -1
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +2 -1
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/contrast-frame.d.ts +17 -0
- package/dist/detectors/contrast-frame.d.ts.map +1 -0
- package/dist/detectors/contrast-frame.js +32 -0
- package/dist/detectors/contrast-frame.js.map +1 -0
- package/dist/detectors/custom.d.ts +8 -0
- package/dist/detectors/custom.d.ts.map +1 -0
- package/dist/detectors/custom.js +71 -0
- package/dist/detectors/custom.js.map +1 -0
- package/dist/detectors/dangling-figure.d.ts +7 -0
- package/dist/detectors/dangling-figure.d.ts.map +1 -0
- package/dist/detectors/dangling-figure.js +20 -0
- package/dist/detectors/dangling-figure.js.map +1 -0
- package/dist/detectors/definition-use.d.ts +8 -0
- package/dist/detectors/definition-use.d.ts.map +1 -0
- package/dist/detectors/definition-use.js +32 -0
- package/dist/detectors/definition-use.js.map +1 -0
- package/dist/detectors/doubled-punctuation.d.ts +9 -0
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -0
- package/dist/detectors/doubled-punctuation.js +35 -0
- package/dist/detectors/doubled-punctuation.js.map +1 -0
- package/dist/detectors/doubled-word.d.ts +5 -0
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +24 -11
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/duplicate-heading.d.ts +14 -0
- package/dist/detectors/duplicate-heading.d.ts.map +1 -0
- package/dist/detectors/duplicate-heading.js +39 -0
- package/dist/detectors/duplicate-heading.js.map +1 -0
- package/dist/detectors/empty-section.d.ts +8 -0
- package/dist/detectors/empty-section.d.ts.map +1 -0
- package/dist/detectors/empty-section.js +16 -0
- package/dist/detectors/empty-section.js.map +1 -0
- package/dist/detectors/enumerated-runs.d.ts +1 -1
- package/dist/detectors/enumerated-runs.d.ts.map +1 -1
- package/dist/detectors/enumerated-runs.js +15 -4
- package/dist/detectors/enumerated-runs.js.map +1 -1
- package/dist/detectors/fullwidth-alnum.d.ts +24 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -0
- package/dist/detectors/fullwidth-alnum.js +88 -0
- package/dist/detectors/fullwidth-alnum.js.map +1 -0
- package/dist/detectors/gram-furniture.d.ts +6 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -0
- package/dist/detectors/gram-furniture.js +21 -0
- package/dist/detectors/gram-furniture.js.map +1 -0
- package/dist/detectors/gram-place.d.ts +2 -0
- package/dist/detectors/gram-place.d.ts.map +1 -1
- package/dist/detectors/gram-place.js +9 -7
- package/dist/detectors/gram-place.js.map +1 -1
- package/dist/detectors/gram-windows.d.ts +9 -0
- package/dist/detectors/gram-windows.d.ts.map +1 -0
- package/dist/detectors/gram-windows.js +27 -0
- package/dist/detectors/gram-windows.js.map +1 -0
- package/dist/detectors/hankaku-kana.d.ts +9 -0
- package/dist/detectors/hankaku-kana.d.ts.map +1 -0
- package/dist/detectors/hankaku-kana.js +27 -0
- package/dist/detectors/hankaku-kana.js.map +1 -0
- package/dist/detectors/heading-case.d.ts +2 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +29 -2
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-code-words.d.ts +6 -0
- package/dist/detectors/heading-code-words.d.ts.map +1 -0
- package/dist/detectors/heading-code-words.js +29 -0
- package/dist/detectors/heading-code-words.js.map +1 -0
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +7 -4
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/heading-level-skip.d.ts +12 -0
- package/dist/detectors/heading-level-skip.d.ts.map +1 -0
- package/dist/detectors/heading-level-skip.js +11 -0
- package/dist/detectors/heading-level-skip.js.map +1 -0
- package/dist/detectors/image-alt-text.d.ts +3 -0
- package/dist/detectors/image-alt-text.d.ts.map +1 -0
- package/dist/detectors/image-alt-text.js +9 -0
- package/dist/detectors/image-alt-text.js.map +1 -0
- package/dist/detectors/index.d.ts.map +1 -1
- package/dist/detectors/index.js +70 -1
- package/dist/detectors/index.js.map +1 -1
- package/dist/detectors/invisible-character.d.ts +20 -0
- package/dist/detectors/invisible-character.d.ts.map +1 -0
- package/dist/detectors/invisible-character.js +143 -0
- package/dist/detectors/invisible-character.js.map +1 -0
- package/dist/detectors/kutoten-consistency.d.ts +24 -0
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -0
- package/dist/detectors/kutoten-consistency.js +77 -0
- package/dist/detectors/kutoten-consistency.js.map +1 -0
- package/dist/detectors/lead-in.d.ts +1 -0
- package/dist/detectors/lead-in.d.ts.map +1 -1
- package/dist/detectors/lead-in.js +2 -1
- package/dist/detectors/lead-in.js.map +1 -1
- package/dist/detectors/lexicon-match.d.ts +14 -1
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +32 -2
- package/dist/detectors/lexicon-match.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +6 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +31 -13
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/list-item.d.ts +45 -0
- package/dist/detectors/list-item.d.ts.map +1 -0
- package/dist/detectors/list-item.js +88 -0
- package/dist/detectors/list-item.js.map +1 -0
- package/dist/detectors/list-items.d.ts +31 -0
- package/dist/detectors/list-items.d.ts.map +1 -0
- package/dist/detectors/list-items.js +113 -0
- package/dist/detectors/list-items.js.map +1 -0
- package/dist/detectors/list-lead-in.d.ts +7 -0
- package/dist/detectors/list-lead-in.d.ts.map +1 -0
- package/dist/detectors/list-lead-in.js +28 -0
- package/dist/detectors/list-lead-in.js.map +1 -0
- package/dist/detectors/list-sentence.d.ts +67 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -0
- package/dist/detectors/list-sentence.js +130 -0
- package/dist/detectors/list-sentence.js.map +1 -0
- package/dist/detectors/list-view.d.ts +34 -0
- package/dist/detectors/list-view.d.ts.map +1 -0
- package/dist/detectors/list-view.js +137 -0
- package/dist/detectors/list-view.js.map +1 -0
- package/dist/detectors/long-vowel.d.ts +7 -0
- package/dist/detectors/long-vowel.d.ts.map +1 -0
- package/dist/detectors/long-vowel.js +71 -0
- package/dist/detectors/long-vowel.js.map +1 -0
- package/dist/detectors/markup-finding.d.ts +8 -0
- package/dist/detectors/markup-finding.d.ts.map +1 -0
- package/dist/detectors/markup-finding.js +29 -0
- package/dist/detectors/markup-finding.js.map +1 -0
- package/dist/detectors/modal-conflict.d.ts +4 -0
- package/dist/detectors/modal-conflict.d.ts.map +1 -0
- package/dist/detectors/modal-conflict.js +22 -0
- package/dist/detectors/modal-conflict.js.map +1 -0
- package/dist/detectors/name-numeral.d.ts +1 -1
- package/dist/detectors/name-numeral.d.ts.map +1 -1
- package/dist/detectors/name-numeral.js +2 -7
- package/dist/detectors/name-numeral.js.map +1 -1
- package/dist/detectors/name-variant.d.ts +4 -0
- package/dist/detectors/name-variant.d.ts.map +1 -0
- package/dist/detectors/name-variant.js +13 -0
- package/dist/detectors/name-variant.js.map +1 -0
- package/dist/detectors/nominalization.d.ts +11 -0
- package/dist/detectors/nominalization.d.ts.map +1 -0
- package/dist/detectors/nominalization.js +56 -0
- package/dist/detectors/nominalization.js.map +1 -0
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +72 -37
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/outside-announced-list.d.ts +4 -0
- package/dist/detectors/outside-announced-list.d.ts.map +1 -0
- package/dist/detectors/outside-announced-list.js +24 -0
- package/dist/detectors/outside-announced-list.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts +7 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +136 -229
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +4 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +26 -7
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/place-run.d.ts.map +1 -1
- package/dist/detectors/place-run.js +10 -6
- package/dist/detectors/place-run.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts +9 -0
- package/dist/detectors/placeholder-text.d.ts.map +1 -0
- package/dist/detectors/placeholder-text.js +18 -0
- package/dist/detectors/placeholder-text.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +3 -0
- package/dist/detectors/quote-around.d.ts.map +1 -0
- package/dist/detectors/quote-around.js +8 -0
- package/dist/detectors/quote-around.js.map +1 -0
- package/dist/detectors/ra-nuki.d.ts +9 -0
- package/dist/detectors/ra-nuki.d.ts.map +1 -0
- package/dist/detectors/ra-nuki.js +30 -0
- package/dist/detectors/ra-nuki.js.map +1 -0
- package/dist/detectors/register.d.ts +11 -3
- package/dist/detectors/register.d.ts.map +1 -1
- package/dist/detectors/register.js +28 -9
- package/dist/detectors/register.js.map +1 -1
- package/dist/detectors/requirement-modal.d.ts +5 -0
- package/dist/detectors/requirement-modal.d.ts.map +1 -0
- package/dist/detectors/requirement-modal.js +54 -0
- package/dist/detectors/requirement-modal.js.map +1 -0
- package/dist/detectors/requirement-smell.d.ts +4 -0
- package/dist/detectors/requirement-smell.d.ts.map +1 -0
- package/dist/detectors/requirement-smell.js +41 -0
- package/dist/detectors/requirement-smell.js.map +1 -0
- package/dist/detectors/roman-numeral.d.ts +2 -0
- package/dist/detectors/roman-numeral.d.ts.map +1 -1
- package/dist/detectors/roman-numeral.js +2 -0
- package/dist/detectors/roman-numeral.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +17 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +13 -7
- package/dist/detectors/sentence-ending.js.map +1 -1
- package/dist/detectors/sentence-length.d.ts.map +1 -1
- package/dist/detectors/sentence-length.js +13 -4
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/signals.d.ts +8 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +67 -46
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/space-before-punctuation.d.ts +8 -0
- package/dist/detectors/space-before-punctuation.d.ts.map +1 -0
- package/dist/detectors/space-before-punctuation.js +24 -0
- package/dist/detectors/space-before-punctuation.js.map +1 -0
- package/dist/detectors/spelling-variety.d.ts +23 -0
- package/dist/detectors/spelling-variety.d.ts.map +1 -0
- package/dist/detectors/spelling-variety.js +59 -0
- package/dist/detectors/spelling-variety.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts +6 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +39 -1
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts +1 -3
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +19 -6
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-comparison.d.ts +20 -0
- package/dist/detectors/superlative-comparison.d.ts.map +1 -0
- package/dist/detectors/superlative-comparison.js +32 -0
- package/dist/detectors/superlative-comparison.js.map +1 -0
- package/dist/detectors/superlative-name.d.ts.map +1 -1
- package/dist/detectors/superlative-name.js +8 -5
- package/dist/detectors/superlative-name.js.map +1 -1
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +9 -4
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/token-column.d.ts +46 -0
- package/dist/detectors/token-column.d.ts.map +1 -0
- package/dist/detectors/token-column.js +95 -0
- package/dist/detectors/token-column.js.map +1 -0
- package/dist/detectors/unbalanced-bracket.d.ts +22 -0
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -0
- package/dist/detectors/unbalanced-bracket.js +119 -0
- package/dist/detectors/unbalanced-bracket.js.map +1 -0
- package/dist/detectors/url-run-on.d.ts +9 -0
- package/dist/detectors/url-run-on.d.ts.map +1 -0
- package/dist/detectors/url-run-on.js +24 -0
- package/dist/detectors/url-run-on.js.map +1 -0
- package/dist/detectors/vague-figure-pointer.d.ts +10 -0
- package/dist/detectors/vague-figure-pointer.d.ts.map +1 -0
- package/dist/detectors/vague-figure-pointer.js +46 -0
- package/dist/detectors/vague-figure-pointer.js.map +1 -0
- package/dist/detectors/word-list.d.ts +2 -0
- package/dist/detectors/word-list.d.ts.map +1 -1
- package/dist/detectors/word-list.js +4 -1
- package/dist/detectors/word-list.js.map +1 -1
- package/dist/document-sections.d.ts +13 -0
- package/dist/document-sections.d.ts.map +1 -0
- package/dist/document-sections.js +32 -0
- package/dist/document-sections.js.map +1 -0
- package/dist/document.d.ts +20 -7
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +140 -125
- package/dist/document.js.map +1 -1
- package/dist/email-parts.d.ts +28 -0
- package/dist/email-parts.d.ts.map +1 -0
- package/dist/email-parts.js +230 -0
- package/dist/email-parts.js.map +1 -0
- package/dist/eval.d.ts +2 -1
- package/dist/eval.d.ts.map +1 -1
- package/dist/eval.js +16 -4
- package/dist/eval.js.map +1 -1
- package/dist/extension/document-view.d.ts +7 -0
- package/dist/extension/document-view.d.ts.map +1 -0
- package/dist/extension/document-view.js +91 -0
- package/dist/extension/document-view.js.map +1 -0
- package/dist/extension/failure-text.d.ts +5 -0
- package/dist/extension/failure-text.d.ts.map +1 -0
- package/dist/extension/failure-text.js +33 -0
- package/dist/extension/failure-text.js.map +1 -0
- package/dist/extension/import-default.d.ts +7 -0
- package/dist/extension/import-default.d.ts.map +1 -0
- package/dist/extension/import-default.js +21 -0
- package/dist/extension/import-default.js.map +1 -0
- package/dist/extension/load.d.ts +28 -0
- package/dist/extension/load.d.ts.map +1 -0
- package/dist/extension/load.js +51 -0
- package/dist/extension/load.js.map +1 -0
- package/dist/extension/module-detector.d.ts +21 -0
- package/dist/extension/module-detector.d.ts.map +1 -0
- package/dist/extension/module-detector.js +49 -0
- package/dist/extension/module-detector.js.map +1 -0
- package/dist/extension/plugin-load.d.ts +9 -0
- package/dist/extension/plugin-load.d.ts.map +1 -0
- package/dist/extension/plugin-load.js +68 -0
- package/dist/extension/plugin-load.js.map +1 -0
- package/dist/extension/plugin-name.d.ts +8 -0
- package/dist/extension/plugin-name.d.ts.map +1 -0
- package/dist/extension/plugin-name.js +22 -0
- package/dist/extension/plugin-name.js.map +1 -0
- package/dist/extension/plugin-parse.d.ts +41 -0
- package/dist/extension/plugin-parse.d.ts.map +1 -0
- package/dist/extension/plugin-parse.js +156 -0
- package/dist/extension/plugin-parse.js.map +1 -0
- package/dist/extension/problem-text.d.ts +5 -0
- package/dist/extension/problem-text.d.ts.map +1 -0
- package/dist/extension/problem-text.js +74 -0
- package/dist/extension/problem-text.js.map +1 -0
- package/dist/extension/real-path.d.ts +3 -0
- package/dist/extension/real-path.d.ts.map +1 -0
- package/dist/extension/real-path.js +8 -0
- package/dist/extension/real-path.js.map +1 -0
- package/dist/extension/returned-findings.d.ts +17 -0
- package/dist/extension/returned-findings.d.ts.map +1 -0
- package/dist/extension/returned-findings.js +48 -0
- package/dist/extension/returned-findings.js.map +1 -0
- package/dist/extension/rule-export.d.ts +13 -0
- package/dist/extension/rule-export.d.ts.map +1 -0
- package/dist/extension/rule-export.js +16 -0
- package/dist/extension/rule-export.js.map +1 -0
- package/dist/feedback/draft.d.ts +2 -0
- package/dist/feedback/draft.d.ts.map +1 -1
- package/dist/feedback/draft.js +3 -0
- package/dist/feedback/draft.js.map +1 -1
- package/dist/figure-references.d.ts +39 -0
- package/dist/figure-references.d.ts.map +1 -0
- package/dist/figure-references.js +113 -0
- package/dist/figure-references.js.map +1 -0
- package/dist/files.d.ts +2 -0
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +4 -0
- package/dist/files.js.map +1 -1
- package/dist/finding-order.d.ts +9 -0
- package/dist/finding-order.d.ts.map +1 -0
- package/dist/finding-order.js +3 -0
- package/dist/finding-order.js.map +1 -0
- package/dist/fix-plan/mode.d.ts +21 -0
- package/dist/fix-plan/mode.d.ts.map +1 -0
- package/dist/fix-plan/mode.js +16 -0
- package/dist/fix-plan/mode.js.map +1 -0
- package/dist/fix-plan/plan.d.ts +77 -0
- package/dist/fix-plan/plan.d.ts.map +1 -0
- package/dist/fix-plan/plan.js +100 -0
- package/dist/fix-plan/plan.js.map +1 -0
- package/dist/fix-plan/render.d.ts +6 -0
- package/dist/fix-plan/render.d.ts.map +1 -0
- package/dist/fix-plan/render.js +101 -0
- package/dist/fix-plan/render.js.map +1 -0
- package/dist/fix-plan/text.d.ts +35 -0
- package/dist/fix-plan/text.d.ts.map +1 -0
- package/dist/fix-plan/text.js +95 -0
- package/dist/fix-plan/text.js.map +1 -0
- package/dist/heading-label.d.ts +22 -0
- package/dist/heading-label.d.ts.map +1 -0
- package/dist/heading-label.js +50 -0
- package/dist/heading-label.js.map +1 -0
- package/dist/in-page-nav.d.ts +4 -1
- package/dist/in-page-nav.d.ts.map +1 -1
- package/dist/in-page-nav.js +53 -18
- package/dist/in-page-nav.js.map +1 -1
- package/dist/joined-view.d.ts.map +1 -1
- package/dist/joined-view.js +1 -0
- package/dist/joined-view.js.map +1 -1
- package/dist/language-sample.d.ts +2 -0
- package/dist/language-sample.d.ts.map +1 -0
- package/dist/language-sample.js +41 -0
- package/dist/language-sample.js.map +1 -0
- package/dist/levels.d.ts +5 -1
- package/dist/levels.d.ts.map +1 -1
- package/dist/levels.js +9 -0
- package/dist/levels.js.map +1 -1
- package/dist/line-paragraphs.d.ts +8 -0
- package/dist/line-paragraphs.d.ts.map +1 -1
- package/dist/line-paragraphs.js +33 -10
- package/dist/line-paragraphs.js.map +1 -1
- package/dist/link-line.d.ts +8 -0
- package/dist/link-line.d.ts.map +1 -0
- package/dist/link-line.js +12 -0
- package/dist/link-line.js.map +1 -0
- package/dist/long-vowel.d.ts +38 -0
- package/dist/long-vowel.d.ts.map +1 -0
- package/dist/long-vowel.js +78 -0
- package/dist/long-vowel.js.map +1 -0
- package/dist/markdown-node.d.ts +19 -0
- package/dist/markdown-node.d.ts.map +1 -0
- package/dist/markdown-node.js +6 -0
- package/dist/markdown-node.js.map +1 -0
- package/dist/markdown-read.d.ts +17 -0
- package/dist/markdown-read.d.ts.map +1 -0
- package/dist/markdown-read.js +37 -0
- package/dist/markdown-read.js.map +1 -0
- package/dist/markup.d.ts +22 -0
- package/dist/markup.d.ts.map +1 -0
- package/dist/markup.js +182 -0
- package/dist/markup.js.map +1 -0
- package/dist/mask.js +8 -5
- package/dist/mask.js.map +1 -1
- package/dist/name-variants.d.ts +25 -0
- package/dist/name-variants.d.ts.map +1 -0
- package/dist/name-variants.js +181 -0
- package/dist/name-variants.js.map +1 -0
- package/dist/node-version.d.ts +7 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +19 -0
- package/dist/node-version.js.map +1 -0
- package/dist/not-run.d.ts +14 -0
- package/dist/not-run.d.ts.map +1 -0
- package/dist/not-run.js +12 -0
- package/dist/not-run.js.map +1 -0
- package/dist/number-name.d.ts +21 -5
- package/dist/number-name.d.ts.map +1 -1
- package/dist/number-name.js +119 -17
- package/dist/number-name.js.map +1 -1
- package/dist/orthography.d.ts +10 -1
- package/dist/orthography.d.ts.map +1 -1
- package/dist/orthography.js +42 -16
- package/dist/orthography.js.map +1 -1
- package/dist/outline/render.d.ts +18 -0
- package/dist/outline/render.d.ts.map +1 -0
- package/dist/outline/render.js +60 -0
- package/dist/outline/render.js.map +1 -0
- package/dist/outline/shape.d.ts +26 -0
- package/dist/outline/shape.d.ts.map +1 -0
- package/dist/outline/shape.js +37 -0
- package/dist/outline/shape.js.map +1 -0
- package/dist/outline/text.d.ts +21 -0
- package/dist/outline/text.d.ts.map +1 -0
- package/dist/outline/text.js +30 -0
- package/dist/outline/text.js.map +1 -0
- package/dist/page-furniture.d.ts +5 -2
- package/dist/page-furniture.d.ts.map +1 -1
- package/dist/page-furniture.js +8 -2
- package/dist/page-furniture.js.map +1 -1
- package/dist/plain-source.d.ts +1 -0
- package/dist/plain-source.d.ts.map +1 -1
- package/dist/plain-source.js +2 -1
- package/dist/plain-source.js.map +1 -1
- package/dist/plugin.d.ts +138 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/profile/for-file.d.ts.map +1 -1
- package/dist/profile/for-file.js +3 -1
- package/dist/profile/for-file.js.map +1 -1
- package/dist/quoted-span.d.ts.map +1 -1
- package/dist/quoted-span.js +8 -3
- package/dist/quoted-span.js.map +1 -1
- package/dist/reasons.d.ts +4 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +8 -0
- package/dist/reasons.js.map +1 -1
- package/dist/reference-lists.d.ts +3 -0
- package/dist/reference-lists.d.ts.map +1 -0
- package/dist/reference-lists.js +75 -0
- package/dist/reference-lists.js.map +1 -0
- package/dist/render/compact.d.ts +3 -1
- package/dist/render/compact.d.ts.map +1 -1
- package/dist/render/compact.js +8 -2
- package/dist/render/compact.js.map +1 -1
- package/dist/render/explain.d.ts +9 -1
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +54 -13
- package/dist/render/explain.js.map +1 -1
- package/dist/render/friendly.d.ts.map +1 -1
- package/dist/render/friendly.js +19 -9
- package/dist/render/friendly.js.map +1 -1
- package/dist/render/options.d.ts +7 -0
- package/dist/render/options.d.ts.map +1 -0
- package/dist/render/options.js +50 -0
- package/dist/render/options.js.map +1 -0
- package/dist/render/rules-json.d.ts +4 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +110 -16
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/rules-table.d.ts +4 -0
- package/dist/render/rules-table.d.ts.map +1 -0
- package/dist/render/rules-table.js +70 -0
- package/dist/render/rules-table.js.map +1 -0
- package/dist/render/sarif.js +4 -4
- package/dist/render/sarif.js.map +1 -1
- package/dist/render/semantic.js +3 -3
- package/dist/render/semantic.js.map +1 -1
- package/dist/render/severity-name.d.ts +6 -0
- package/dist/render/severity-name.d.ts.map +1 -0
- package/dist/render/severity-name.js +7 -0
- package/dist/render/severity-name.js.map +1 -0
- package/dist/render/suppressions.d.ts +3 -0
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +20 -1
- package/dist/render/suppressions.js.map +1 -1
- package/dist/render/text.d.ts +7 -2
- package/dist/render/text.d.ts.map +1 -1
- package/dist/render/text.js +15 -4
- package/dist/render/text.js.map +1 -1
- package/dist/resolve-genre.d.ts +1 -1
- package/dist/resolve-genre.d.ts.map +1 -1
- package/dist/resolve-genre.js +4 -1
- package/dist/resolve-genre.js.map +1 -1
- package/dist/rule-genres.d.ts +24 -0
- package/dist/rule-genres.d.ts.map +1 -0
- package/dist/rule-genres.js +11 -0
- package/dist/rule-genres.js.map +1 -0
- package/dist/rule-guide.d.ts +73 -0
- package/dist/rule-guide.d.ts.map +1 -0
- package/dist/rule-guide.js +95 -0
- package/dist/rule-guide.js.map +1 -0
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +87 -33
- package/dist/rule-load.js.map +1 -1
- package/dist/rule-options.d.ts +50 -0
- package/dist/rule-options.d.ts.map +1 -0
- package/dist/rule-options.js +106 -0
- package/dist/rule-options.js.map +1 -0
- package/dist/run-semantic.d.ts.map +1 -1
- package/dist/run-semantic.js +2 -1
- package/dist/run-semantic.js.map +1 -1
- package/dist/run.d.ts +18 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +80 -19
- package/dist/run.js.map +1 -1
- package/dist/sentence-shape.d.ts.map +1 -1
- package/dist/sentence-shape.js +4 -4
- package/dist/sentence-shape.js.map +1 -1
- package/dist/setting-problems.d.ts +2 -1
- package/dist/setting-problems.d.ts.map +1 -1
- package/dist/setting-problems.js +8 -1
- package/dist/setting-problems.js.map +1 -1
- package/dist/spacing-minority.d.ts +16 -0
- package/dist/spacing-minority.d.ts.map +1 -0
- package/dist/spacing-minority.js +23 -0
- package/dist/spacing-minority.js.map +1 -0
- package/dist/span-cut.d.ts +6 -0
- package/dist/span-cut.d.ts.map +1 -0
- package/dist/span-cut.js +22 -0
- package/dist/span-cut.js.map +1 -0
- package/dist/stet-block.d.ts +5 -0
- package/dist/stet-block.d.ts.map +1 -0
- package/dist/stet-block.js +59 -0
- package/dist/stet-block.js.map +1 -0
- package/dist/stet.d.ts +4 -0
- package/dist/stet.d.ts.map +1 -1
- package/dist/stet.js +31 -11
- package/dist/stet.js.map +1 -1
- package/dist/structure/aside-depth.d.ts +21 -0
- package/dist/structure/aside-depth.d.ts.map +1 -0
- package/dist/structure/aside-depth.js +65 -0
- package/dist/structure/aside-depth.js.map +1 -0
- package/dist/structure/build.d.ts +5 -1
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +29 -17
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/closed-pairs.d.ts +8 -0
- package/dist/structure/closed-pairs.d.ts.map +1 -0
- package/dist/structure/closed-pairs.js +22 -0
- package/dist/structure/closed-pairs.js.map +1 -0
- package/dist/structure/date-range.d.ts +31 -0
- package/dist/structure/date-range.d.ts.map +1 -0
- package/dist/structure/date-range.js +77 -0
- package/dist/structure/date-range.js.map +1 -0
- package/dist/structure/definition-use.d.ts +32 -0
- package/dist/structure/definition-use.d.ts.map +1 -0
- package/dist/structure/definition-use.js +102 -0
- package/dist/structure/definition-use.js.map +1 -0
- package/dist/structure/known-mentions.d.ts +18 -0
- package/dist/structure/known-mentions.d.ts.map +1 -0
- package/dist/structure/known-mentions.js +78 -0
- package/dist/structure/known-mentions.js.map +1 -0
- package/dist/structure/lazy-tree.d.ts +8 -0
- package/dist/structure/lazy-tree.d.ts.map +1 -0
- package/dist/structure/lazy-tree.js +14 -0
- package/dist/structure/lazy-tree.js.map +1 -0
- package/dist/structure/modal-conflict.d.ts +28 -0
- package/dist/structure/modal-conflict.d.ts.map +1 -0
- package/dist/structure/modal-conflict.js +74 -0
- package/dist/structure/modal-conflict.js.map +1 -0
- package/dist/structure/numbered-clauses.d.ts +4 -0
- package/dist/structure/numbered-clauses.d.ts.map +1 -0
- package/dist/structure/numbered-clauses.js +9 -0
- package/dist/structure/numbered-clauses.js.map +1 -0
- package/dist/structure/numbering.d.ts +1 -0
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +11 -6
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/of.d.ts +3 -1
- package/dist/structure/of.d.ts.map +1 -1
- package/dist/structure/of.js +5 -1
- package/dist/structure/of.js.map +1 -1
- package/dist/structure/percent-sum.d.ts +16 -0
- package/dist/structure/percent-sum.d.ts.map +1 -0
- package/dist/structure/percent-sum.js +104 -0
- package/dist/structure/percent-sum.js.map +1 -0
- package/dist/structure/quoted-number.d.ts +8 -0
- package/dist/structure/quoted-number.d.ts.map +1 -0
- package/dist/structure/quoted-number.js +34 -0
- package/dist/structure/quoted-number.js.map +1 -0
- package/dist/structure/relative-find.d.ts.map +1 -1
- package/dist/structure/relative-find.js +34 -46
- package/dist/structure/relative-find.js.map +1 -1
- package/dist/structure/relative-resolve.d.ts.map +1 -1
- package/dist/structure/relative-resolve.js +76 -30
- package/dist/structure/relative-resolve.js.map +1 -1
- package/dist/structure/runs.d.ts +2 -0
- package/dist/structure/runs.d.ts.map +1 -1
- package/dist/structure/runs.js +2 -2
- package/dist/structure/runs.js.map +1 -1
- package/dist/structure/sexp.d.ts +1 -1
- package/dist/structure/sexp.d.ts.map +1 -1
- package/dist/structure/sexp.js +18 -6
- package/dist/structure/sexp.js.map +1 -1
- package/dist/structure/total.d.ts +3 -0
- package/dist/structure/total.d.ts.map +1 -1
- package/dist/structure/total.js +2 -2
- package/dist/structure/total.js.map +1 -1
- package/dist/structure/universal.d.ts +14 -2
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +24 -3
- package/dist/structure/universal.js.map +1 -1
- package/dist/structure/wrapped-tail.d.ts +14 -7
- package/dist/structure/wrapped-tail.d.ts.map +1 -1
- package/dist/structure/wrapped-tail.js +33 -8
- package/dist/structure/wrapped-tail.js.map +1 -1
- package/dist/style-load.d.ts +4 -0
- package/dist/style-load.d.ts.map +1 -0
- package/dist/style-load.js +28 -0
- package/dist/style-load.js.map +1 -0
- package/dist/style-parse.d.ts +25 -0
- package/dist/style-parse.d.ts.map +1 -0
- package/dist/style-parse.js +88 -0
- package/dist/style-parse.js.map +1 -0
- package/dist/subheading-line.d.ts +23 -0
- package/dist/subheading-line.d.ts.map +1 -0
- package/dist/subheading-line.js +85 -0
- package/dist/subheading-line.js.map +1 -0
- package/dist/tag-coverage.d.ts +8 -0
- package/dist/tag-coverage.d.ts.map +1 -0
- package/dist/tag-coverage.js +7 -0
- package/dist/tag-coverage.js.map +1 -0
- package/dist/template-syntax.d.ts +17 -0
- package/dist/template-syntax.d.ts.map +1 -0
- package/dist/template-syntax.js +140 -0
- package/dist/template-syntax.js.map +1 -0
- package/dist/text-above.d.ts +19 -0
- package/dist/text-above.d.ts.map +1 -0
- package/dist/text-above.js +43 -0
- package/dist/text-above.js.map +1 -0
- package/dist/text-figures.d.ts +10 -0
- package/dist/text-figures.d.ts.map +1 -0
- package/dist/text-figures.js +131 -0
- package/dist/text-figures.js.map +1 -0
- package/dist/trailing-aside.d.ts +2 -0
- package/dist/trailing-aside.d.ts.map +1 -0
- package/dist/trailing-aside.js +53 -0
- package/dist/trailing-aside.js.map +1 -0
- package/dist/tree-walk.d.ts +18 -0
- package/dist/tree-walk.d.ts.map +1 -0
- package/dist/tree-walk.js +45 -0
- package/dist/tree-walk.js.map +1 -0
- package/genres.yaml +68 -0
- package/package.json +9 -3
- package/reference-headings.yaml +17 -0
- package/rules/acronym-expansion-conflict.yaml +82 -0
- package/rules/adverb-overuse.yaml +19 -0
- package/rules/agentless-passive.yaml +47 -0
- package/rules/agreement-slip.yaml +14 -1
- package/rules/ai-generated-composite.yaml +102 -0
- package/rules/ai-tell.yaml +57 -0
- package/rules/announced-count-mismatch.yaml +57 -0
- package/rules/announcing-opener.yaml +82 -0
- package/rules/assistant-residue.yaml +82 -0
- package/rules/bold-density.yaml +59 -0
- package/rules/bold-label-list.yaml +81 -0
- package/rules/broken-link.yaml +65 -0
- package/rules/closing-cliche.yaml +58 -0
- package/rules/colon-lead-in.yaml +83 -0
- package/rules/concrete-evidence-density.yaml +41 -0
- package/rules/contraction-consistency.yaml +18 -0
- package/rules/contrast-framing.yaml +88 -0
- package/rules/cushion-phrase-density.yaml +53 -1
- package/rules/dangling-figure-reference.yaml +61 -0
- package/rules/dangling-reference.yaml +54 -1
- package/rules/date-order.yaml +34 -1
- package/rules/date-range-reversed.yaml +46 -0
- package/rules/date-weekday-mismatch.yaml +17 -1
- package/rules/double-keigo.yaml +16 -0
- package/rules/double-negative.yaml +51 -0
- package/rules/doubled-punctuation.yaml +45 -0
- package/rules/doubled-word.yaml +18 -2
- package/rules/duplicate-definition.yaml +59 -1
- package/rules/duplicate-heading.yaml +78 -0
- package/rules/emoji-density.yaml +28 -2
- package/rules/empty-conclusion.yaml +28 -0
- package/rules/empty-intensifier.yaml +44 -0
- package/rules/empty-section.yaml +74 -0
- package/rules/excessive-hedging.yaml +49 -2
- package/rules/expletive-construction.yaml +19 -0
- package/rules/fullwidth-alnum-consistency.yaml +53 -0
- package/rules/hankaku-kana.yaml +41 -0
- package/rules/heading-echo.yaml +31 -0
- package/rules/heading-level-skip.yaml +78 -0
- package/rules/hiragana-fukushi.yaml +16 -0
- package/rules/image-alt-text.yaml +54 -0
- package/rules/internal-jargon.yaml +21 -0
- package/rules/invisible-character.yaml +63 -0
- package/rules/katakana-long-vowel.yaml +99 -0
- package/rules/kutoten-consistency.yaml +53 -0
- package/rules/latin-spacing.yaml +30 -4
- package/rules/max-kanji-continuous.yaml +17 -0
- package/rules/max-paragraph-length.yaml +34 -0
- package/rules/max-sentence-length.yaml +58 -0
- package/rules/modal-conflict.yaml +106 -0
- package/rules/name-variant.yaml +88 -0
- package/rules/ngram-repetition.yaml +29 -2
- package/rules/no-doubled-joshi.yaml +17 -0
- package/rules/no-em-dash.yaml +49 -0
- package/rules/no-mixed-desumasu.yaml +28 -2
- package/rules/no-nakaguro-parallel.yaml +20 -0
- package/rules/nominalization.yaml +89 -0
- package/rules/numbering-gap.yaml +53 -1
- package/rules/outside-announced-list.yaml +80 -0
- package/rules/oxford-comma-consistency.yaml +18 -0
- package/rules/padded-intro.yaml +44 -0
- package/rules/paragraph-length-variance.yaml +73 -0
- package/rules/percent-sum-mismatch.yaml +58 -0
- package/rules/preamble-length.yaml +56 -0
- package/rules/preferred-term.yaml +28 -0
- package/rules/proper-noun-density.yaml +37 -2
- package/rules/ra-nuki.yaml +43 -0
- package/rules/repeated-conjunction.yaml +47 -0
- package/rules/repeated-sentence-head.yaml +23 -0
- package/rules/required-sections.yaml +49 -0
- package/rules/requirement-modal.yaml +94 -0
- package/rules/requirement-smell.yaml +70 -0
- package/rules/risk-disclosure.yaml +22 -0
- package/rules/rule-of-three.yaml +143 -0
- package/rules/sasete-itadaku.yaml +18 -0
- package/rules/section-length-uniformity.yaml +113 -0
- package/rules/sentence-initial-conjunction-run.yaml +18 -0
- package/rules/sentence-rhythm.yaml +51 -0
- package/rules/space-before-punctuation.yaml +41 -0
- package/rules/spelling-consistency.yaml +47 -0
- package/rules/stock-transition.yaml +86 -0
- package/rules/stray-space.yaml +18 -0
- package/rules/taigen-dome-in-prose.yaml +33 -0
- package/rules/title-case-consistency.yaml +42 -0
- package/rules/total-mismatch.yaml +38 -1
- package/rules/unbalanced-bracket.yaml +56 -0
- package/rules/undefined-acronym.yaml +23 -0
- package/rules/unfilled-placeholder.yaml +50 -0
- package/rules/unqualified-superlative.yaml +20 -0
- package/rules/unsourced-number.yaml +16 -0
- package/rules/unused-definition.yaml +75 -0
- package/rules/url-run-on.yaml +45 -0
- package/rules/use-before-definition.yaml +77 -0
- package/rules/vague-figure-reference.yaml +66 -0
- package/skills/chaff/SKILL.md +171 -1
- package/src/acronym-expansions.ts +106 -0
- package/src/announced-count.ts +190 -0
- package/src/announced-list.ts +120 -0
- package/src/api.ts +154 -0
- package/src/bare-url.ts +35 -0
- package/src/baseline.ts +17 -1
- package/src/body-section.ts +7 -0
- package/src/calendar-number.ts +18 -4
- package/src/cli-args.ts +6 -0
- package/src/cli-text.ts +14 -15
- package/src/cli.ts +93 -92
- package/src/closing-paragraph.ts +24 -0
- package/src/commands/compare.ts +73 -0
- package/src/commands/document-commands.ts +19 -0
- package/src/commands/eval.ts +22 -10
- package/src/commands/facts.ts +33 -0
- package/src/commands/feedback.ts +45 -7
- package/src/commands/fix-plan.ts +53 -0
- package/src/commands/outline.ts +49 -0
- package/src/commands/read-document.ts +24 -0
- package/src/commands/suppressions.ts +19 -0
- package/src/commands/test.ts +3 -5
- package/src/commands/tree.ts +41 -5
- package/src/compare/atom.ts +33 -0
- package/src/compare/clock-time.ts +89 -0
- package/src/compare/distinct.ts +13 -0
- package/src/compare/extract.ts +80 -0
- package/src/compare/fact-key.ts +31 -0
- package/src/compare/fact-text.ts +87 -0
- package/src/compare/facts-render.ts +63 -0
- package/src/compare/facts-text.ts +41 -0
- package/src/compare/markup-atoms.ts +29 -0
- package/src/compare/match.ts +105 -0
- package/src/compare/outcome.ts +80 -0
- package/src/compare/proper-nouns.ts +65 -0
- package/src/compare/render.ts +102 -0
- package/src/compare/spans.ts +17 -0
- package/src/compare/text-atoms.ts +96 -0
- package/src/compare/text.ts +121 -0
- package/src/compare/tree-atoms.ts +80 -0
- package/src/compare/written-names.ts +26 -0
- package/src/config/load.ts +30 -0
- package/src/config/option-problems.ts +72 -0
- package/src/config/read.ts +8 -0
- package/src/config/rule-problems.ts +12 -2
- package/src/config/style.ts +55 -0
- package/src/config/warnings.ts +13 -0
- package/src/config/write.ts +18 -4
- package/src/custom/bounded-match.ts +58 -0
- package/src/custom/load.ts +23 -0
- package/src/custom/module-path.ts +23 -0
- package/src/custom/parse.ts +323 -0
- package/src/custom/problems.ts +111 -0
- package/src/custom/regex-safety.ts +118 -0
- package/src/custom/token-pattern.ts +84 -0
- package/src/detect-language.ts +1 -1
- package/src/detect.ts +35 -2
- package/src/detectors/acronym-context.ts +16 -4
- package/src/detectors/ai-phrasing.ts +141 -0
- package/src/detectors/announced-count.ts +25 -0
- package/src/detectors/bold-label.ts +55 -0
- package/src/detectors/broken-link.ts +90 -0
- package/src/detectors/cited-name.ts +6 -5
- package/src/detectors/cited-title.ts +96 -0
- package/src/detectors/concrete-evidence.ts +3 -2
- package/src/detectors/contrast-frame.ts +54 -0
- package/src/detectors/custom.ts +89 -0
- package/src/detectors/dangling-figure.ts +26 -0
- package/src/detectors/definition-use.ts +41 -0
- package/src/detectors/doubled-punctuation.ts +52 -0
- package/src/detectors/doubled-word.ts +19 -4
- package/src/detectors/duplicate-heading.ts +47 -0
- package/src/detectors/empty-section.ts +21 -0
- package/src/detectors/enumerated-runs.ts +13 -4
- package/src/detectors/fullwidth-alnum.ts +118 -0
- package/src/detectors/gram-furniture.ts +30 -0
- package/src/detectors/gram-place.ts +9 -5
- package/src/detectors/gram-windows.ts +31 -0
- package/src/detectors/hankaku-kana.ts +38 -0
- package/src/detectors/heading-case.ts +30 -2
- package/src/detectors/heading-code-words.ts +35 -0
- package/src/detectors/heading-echo.ts +8 -4
- package/src/detectors/heading-level-skip.ts +19 -0
- package/src/detectors/image-alt-text.ts +11 -0
- package/src/detectors/index.ts +79 -1
- package/src/detectors/invisible-character.ts +190 -0
- package/src/detectors/kutoten-consistency.ts +96 -0
- package/src/detectors/lead-in.ts +3 -1
- package/src/detectors/lexicon-match.ts +41 -2
- package/src/detectors/lexicon.ts +40 -13
- package/src/detectors/list-item.ts +122 -0
- package/src/detectors/list-items.ts +163 -0
- package/src/detectors/list-lead-in.ts +33 -0
- package/src/detectors/list-sentence.ts +198 -0
- package/src/detectors/list-view.ts +157 -0
- package/src/detectors/long-vowel.ts +82 -0
- package/src/detectors/markup-finding.ts +39 -0
- package/src/detectors/modal-conflict.ts +26 -0
- package/src/detectors/name-numeral.ts +4 -2
- package/src/detectors/name-variant.ts +15 -0
- package/src/detectors/nominalization.ts +73 -0
- package/src/detectors/orthography.ts +97 -41
- package/src/detectors/outside-announced-list.ts +25 -0
- package/src/detectors/oxford-comma.ts +179 -283
- package/src/detectors/phrase-match.ts +27 -7
- package/src/detectors/place-run.ts +7 -4
- package/src/detectors/placeholder-text.ts +27 -0
- package/src/detectors/quote-around.ts +9 -0
- package/src/detectors/ra-nuki.ts +38 -0
- package/src/detectors/register.ts +37 -10
- package/src/detectors/requirement-modal.ts +67 -0
- package/src/detectors/requirement-smell.ts +52 -0
- package/src/detectors/roman-numeral.ts +3 -0
- package/src/detectors/sentence-ending.ts +14 -7
- package/src/detectors/sentence-length.ts +16 -5
- package/src/detectors/signals.ts +80 -46
- package/src/detectors/space-before-punctuation.ts +32 -0
- package/src/detectors/spelling-variety.ts +81 -0
- package/src/detectors/structure-tree.ts +47 -1
- package/src/detectors/structure.ts +20 -7
- package/src/detectors/superlative-comparison.ts +47 -0
- package/src/detectors/superlative-name.ts +7 -4
- package/src/detectors/superlative-scope.ts +8 -3
- package/src/detectors/token-column.ts +149 -0
- package/src/detectors/unbalanced-bracket.ts +153 -0
- package/src/detectors/url-run-on.ts +33 -0
- package/src/detectors/vague-figure-pointer.ts +58 -0
- package/src/detectors/word-list.ts +6 -1
- package/src/document-sections.ts +46 -0
- package/src/document.ts +188 -173
- package/src/email-parts.ts +269 -0
- package/src/eval.ts +14 -4
- package/src/extension/document-view.ts +109 -0
- package/src/extension/failure-text.ts +46 -0
- package/src/extension/import-default.ts +13 -0
- package/src/extension/load.ts +97 -0
- package/src/extension/module-detector.ts +61 -0
- package/src/extension/plugin-load.ts +82 -0
- package/src/extension/plugin-name.ts +26 -0
- package/src/extension/plugin-parse.ts +229 -0
- package/src/extension/problem-text.ts +103 -0
- package/src/extension/real-path.ts +10 -0
- package/src/extension/returned-findings.ts +62 -0
- package/src/extension/rule-export.ts +23 -0
- package/src/feedback/draft.ts +6 -0
- package/src/figure-references.ts +173 -0
- package/src/files.ts +5 -0
- package/src/finding-order.ts +3 -0
- package/src/fix-plan/mode.ts +34 -0
- package/src/fix-plan/plan.ts +181 -0
- package/src/fix-plan/render.ts +128 -0
- package/src/fix-plan/text.ts +133 -0
- package/src/heading-label.ts +55 -0
- package/src/in-page-nav.ts +48 -19
- package/src/joined-view.ts +1 -0
- package/src/language-sample.ts +48 -0
- package/src/levels.ts +14 -1
- package/src/line-paragraphs.ts +52 -9
- package/src/link-line.ts +13 -0
- package/src/long-vowel.ts +109 -0
- package/src/markdown-node.ts +19 -0
- package/src/markdown-read.ts +44 -0
- package/src/markup.ts +212 -0
- package/src/mask.ts +8 -8
- package/src/name-variants.ts +217 -0
- package/src/node-version.ts +22 -0
- package/src/not-run.ts +16 -0
- package/src/number-name.ts +151 -24
- package/src/orthography.ts +50 -14
- package/src/outline/render.ts +85 -0
- package/src/outline/shape.ts +72 -0
- package/src/outline/text.ts +50 -0
- package/src/page-furniture.ts +11 -2
- package/src/plain-source.ts +2 -1
- package/src/plugin.ts +120 -3
- package/src/profile/for-file.ts +3 -1
- package/src/quoted-span.ts +9 -3
- package/src/reasons.ts +12 -0
- package/src/reference-lists.ts +91 -0
- package/src/render/compact.ts +13 -3
- package/src/render/explain.ts +75 -14
- package/src/render/friendly.ts +20 -9
- package/src/render/options.ts +58 -0
- package/src/render/rules-json.ts +140 -18
- package/src/render/rules-table.ts +91 -0
- package/src/render/sarif.ts +4 -4
- package/src/render/semantic.ts +3 -3
- package/src/render/severity-name.ts +10 -0
- package/src/render/suppressions.ts +30 -2
- package/src/render/text.ts +21 -7
- package/src/resolve-genre.ts +4 -1
- package/src/rule-genres.ts +25 -0
- package/src/rule-guide.ts +173 -0
- package/src/rule-load.ts +91 -34
- package/src/rule-options.ts +131 -0
- package/src/run-semantic.ts +2 -1
- package/src/run.ts +105 -22
- package/src/sentence-shape.ts +4 -5
- package/src/setting-problems.ts +9 -1
- package/src/spacing-minority.ts +27 -0
- package/src/span-cut.ts +28 -0
- package/src/stet-block.ts +60 -0
- package/src/stet.ts +41 -15
- package/src/structure/aside-depth.ts +67 -0
- package/src/structure/build.ts +38 -19
- package/src/structure/closed-pairs.ts +20 -0
- package/src/structure/date-range.ts +117 -0
- package/src/structure/definition-use.ts +130 -0
- package/src/structure/known-mentions.ts +96 -0
- package/src/structure/lazy-tree.ts +15 -0
- package/src/structure/modal-conflict.ts +86 -0
- package/src/structure/numbered-clauses.ts +11 -0
- package/src/structure/numbering.ts +9 -5
- package/src/structure/of.ts +11 -3
- package/src/structure/percent-sum.ts +135 -0
- package/src/structure/quoted-number.ts +36 -0
- package/src/structure/relative-find.ts +34 -47
- package/src/structure/relative-resolve.ts +77 -30
- package/src/structure/runs.ts +2 -2
- package/src/structure/sexp.ts +17 -5
- package/src/structure/total.ts +2 -2
- package/src/structure/universal.ts +33 -5
- package/src/structure/wrapped-tail.ts +38 -13
- package/src/style-load.ts +28 -0
- package/src/style-parse.ts +112 -0
- package/src/subheading-line.ts +106 -0
- package/src/tag-coverage.ts +13 -0
- package/src/template-syntax.ts +164 -0
- package/src/text-above.ts +49 -0
- package/src/text-figures.ts +147 -0
- package/src/trailing-aside.ts +50 -0
- package/src/tree-walk.ts +48 -0
- package/styles/bunkacho.yaml +25 -0
- package/styles/ieice.yaml +30 -0
- package/styles/jis-z8301-2011.yaml +28 -0
- package/styles/jis-z8301-2019.yaml +31 -0
- package/styles/koyobun.yaml +35 -0
- package/dist/legal-address.d.ts +0 -2
- package/dist/legal-address.d.ts.map +0 -1
- package/dist/legal-address.js +0 -16
- package/dist/legal-address.js.map +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Lexicon, NumberingContext, StructurePatterns, Token } from "./plugin.ts";
|
|
2
|
+
import { universalNumber } from "./structure/universal.ts";
|
|
3
|
+
|
|
4
|
+
const ON_HEADING: NumberingContext = { open: [], isHeading: true };
|
|
5
|
+
|
|
6
|
+
/** 木を組むときと同じ読み方(numbering-gap が比べる番号)で読んだ、番号の後ろの題。「第2章 概要」「Chapter 2: Setup」「1. はじめに」。 */
|
|
7
|
+
const numberedTitle = (heading: string, patterns: StructurePatterns): string | undefined => {
|
|
8
|
+
const numbered = patterns.numbered(heading, ON_HEADING) ?? universalNumber(patterns, heading, ON_HEADING, false);
|
|
9
|
+
return numbered === undefined || numbered.heading === "" ? undefined : numbered.heading;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const SPECIAL = /[.*+?^${}()|[\]\\]/gu;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 番号の前に書いて名前を付ける語(語彙表 numbered-label の before: 例・問・Step)と番号と区切りで始まる見出しの、札の部分。
|
|
16
|
+
* 区切りはコロンか空白。札の後ろに題が無ければ当てない。木はこの札を番号として読まない。
|
|
17
|
+
*/
|
|
18
|
+
export const labelPatternOf = (labelWords: readonly string[]): RegExp | undefined => {
|
|
19
|
+
if (labelWords.length === 0) return undefined;
|
|
20
|
+
const words = labelWords.map((word) => word.replace(SPECIAL, String.raw`\$&`)).join("|");
|
|
21
|
+
return new RegExp(String.raw`^(?:${words})[ \t\u3000]?[0-90-9]+(?:[..][0-90-9]+)*(?:[ \t\u3000]*[::][ \t\u3000]*|[ \t\u3000]+)(?=\S)`, "u");
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 見出しの頭の番号の札を除いた題。札は本文で繰り返されないので、見出しと文の重なりを測るときは数えない。
|
|
26
|
+
* 番号は木と同じ読み方で読み、木が読まない札(「例 3:」「Step 3:」)は語彙表の語で読む。札が無ければ見出しのまま。
|
|
27
|
+
*/
|
|
28
|
+
export const unlabeledHeading = (heading: string, patterns: StructurePatterns | undefined, labelPattern: RegExp | undefined): string => {
|
|
29
|
+
const titled = patterns === undefined ? undefined : numberedTitle(heading, patterns);
|
|
30
|
+
if (titled !== undefined) return titled;
|
|
31
|
+
const label = labelPattern?.exec(heading)?.[0];
|
|
32
|
+
return label === undefined ? heading : heading.slice(label.length);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 見出しごとに、札を除いた題を読まれたときに一度だけ読む関数。読むのは heading-echo だけなので、ほかの rule には番号を読む代金を払わせない。
|
|
37
|
+
* 札の語は語彙表 numbered-label の before。
|
|
38
|
+
*/
|
|
39
|
+
export const unlabeledReader = (patterns: StructurePatterns | undefined, lexicons: Readonly<Record<string, Lexicon>>): ((heading: string) => () => string) => {
|
|
40
|
+
const labelWords = (lexicons["numbered-label"] ?? []).filter((entry) => entry.position === "before").map((entry) => entry.pattern);
|
|
41
|
+
const labelPattern = labelPatternOf(labelWords);
|
|
42
|
+
return (heading) => {
|
|
43
|
+
const memo: { value?: string } = {};
|
|
44
|
+
return () => (memo.value ??= unlabeledHeading(heading, patterns, labelPattern));
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 見出しの語のうち、札より後ろ(題)のもの。tokens の位置は見出しの中の位置。札の語(例・Step)を見出しにある語と数えると、
|
|
50
|
+
* 文が札の語を使っただけ(例として…)で「見出しに無い語を足していない」ことになる。
|
|
51
|
+
*/
|
|
52
|
+
export const titleTokens = (heading: string, title: string, tokens: readonly Token[]): readonly Token[] => {
|
|
53
|
+
const titleStart = heading.lastIndexOf(title);
|
|
54
|
+
return tokens.filter((token) => token.span.start >= titleStart);
|
|
55
|
+
};
|
package/src/in-page-nav.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { eachPreOrder } from "./tree-walk.ts";
|
|
2
|
+
|
|
1
3
|
/** mdast の節のうち、ページ内の案内かどうかの判定に要る部分だけ。 */
|
|
2
4
|
export type NavNode = {
|
|
3
5
|
readonly type: string;
|
|
@@ -17,28 +19,44 @@ const WRAPPERS = new Set(["strong", "emphasis", "delete"]);
|
|
|
17
19
|
|
|
18
20
|
const pointsInPage = (url: string | undefined): boolean => (url ?? "").startsWith("#");
|
|
19
21
|
|
|
20
|
-
const collectAnchors = (node: NavNode, found: Set<string>): void => {
|
|
21
|
-
if (node.type === "definition" && node.identifier !== undefined && pointsInPage(node.url)) found.add(node.identifier);
|
|
22
|
-
(node.children ?? []).forEach((child) => collectAnchors(child, found));
|
|
23
|
-
};
|
|
24
|
-
|
|
25
22
|
export const inPageAnchors = (root: NavNode): InPageAnchors => {
|
|
26
23
|
const found = new Set<string>();
|
|
27
|
-
|
|
24
|
+
eachPreOrder(root, (node) => {
|
|
25
|
+
if (node.type === "definition" && node.identifier !== undefined && pointsInPage(node.url)) found.add(node.identifier);
|
|
26
|
+
});
|
|
28
27
|
return found;
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
const isInPageLink = (node: NavNode, anchors: InPageAnchors): boolean =>
|
|
32
31
|
(node.type === "link" && pointsInPage(node.url)) || (node.type === "linkReference" && anchors.has(node.identifier ?? ""));
|
|
33
32
|
|
|
33
|
+
/** What must also be a part for this node to be one: nothing for a link or symbols, the children of emphasis. undefined when it is prose. */
|
|
34
|
+
const partsWithin = (node: NavNode, anchors: InPageAnchors): readonly NavNode[] | undefined => {
|
|
35
|
+
if (isInPageLink(node, anchors) || node.type === "break") return [];
|
|
36
|
+
if (node.type === "text") return WORD.test(node.value ?? "") ? undefined : [];
|
|
37
|
+
return WRAPPERS.has(node.type) ? (node.children ?? []) : undefined;
|
|
38
|
+
};
|
|
39
|
+
|
|
34
40
|
const isNavigationPart = (node: NavNode, anchors: InPageAnchors): boolean => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
const pending: NavNode[] = [node];
|
|
42
|
+
while (pending.length > 0) {
|
|
43
|
+
const next = pending.pop();
|
|
44
|
+
const within = next === undefined ? [] : partsWithin(next, anchors);
|
|
45
|
+
if (within === undefined) return false;
|
|
46
|
+
within.forEach((child) => pending.push(child));
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
38
49
|
};
|
|
39
50
|
|
|
40
|
-
const containsInPageLink = (node: NavNode, anchors: InPageAnchors): boolean =>
|
|
41
|
-
|
|
51
|
+
const containsInPageLink = (node: NavNode, anchors: InPageAnchors): boolean => {
|
|
52
|
+
const pending: NavNode[] = [node];
|
|
53
|
+
while (pending.length > 0) {
|
|
54
|
+
const next = pending.pop();
|
|
55
|
+
if (next !== undefined && isInPageLink(next, anchors)) return true;
|
|
56
|
+
(next?.children ?? []).forEach((child) => pending.push(child));
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
};
|
|
42
60
|
|
|
43
61
|
/**
|
|
44
62
|
* 同じページの中へのリンク(`](#…)`)と記号だけでできた段落。「▲ 目次に戻る」や目次の項目で、本文ではなくページの案内。
|
|
@@ -53,15 +71,26 @@ export const isInPageNavigation = (paragraph: NavNode, anchors: InPageAnchors =
|
|
|
53
71
|
);
|
|
54
72
|
};
|
|
55
73
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
74
|
+
/** The blocks inside a list's items, or undefined unless it is a list whose every item holds a block. */
|
|
75
|
+
const itemBlocks = (list: NavNode): readonly NavNode[] | undefined => {
|
|
76
|
+
const items = list.children ?? [];
|
|
77
|
+
if (list.type !== "list" || items.length === 0) return undefined;
|
|
78
|
+
const blocks = items.map((item) => (item.type === "listItem" ? (item.children ?? []) : []));
|
|
79
|
+
return blocks.some((children) => children.length === 0) ? undefined : blocks.flat();
|
|
61
80
|
};
|
|
62
81
|
|
|
63
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* 項目がどれもページの案内(入れ子も含む)の箇条書き。目次の項目の数は節の数で決まり、書いた人が選んだ並べ方ではない。
|
|
84
|
+
* 項目の中の段落はページの案内の段落で、段落でない塊は、それ自身がページの案内の箇条書き。
|
|
85
|
+
*/
|
|
64
86
|
export const isNavigationList = (list: NavNode, anchors: InPageAnchors = new Set()): boolean => {
|
|
65
|
-
const
|
|
66
|
-
|
|
87
|
+
const pending: NavNode[] = [list];
|
|
88
|
+
while (pending.length > 0) {
|
|
89
|
+
const next = pending.pop();
|
|
90
|
+
const blocks = next === undefined ? [] : itemBlocks(next);
|
|
91
|
+
if (blocks === undefined) return false;
|
|
92
|
+
if (!blocks.every((block) => block.type !== "paragraph" || isInPageNavigation(block, anchors))) return false;
|
|
93
|
+
blocks.filter((block) => block.type !== "paragraph").forEach((block) => pending.push(block));
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
67
96
|
};
|
package/src/joined-view.ts
CHANGED
|
@@ -61,6 +61,7 @@ const sentenceInSource =
|
|
|
61
61
|
span,
|
|
62
62
|
text: text.slice(span.start, span.end),
|
|
63
63
|
...(sentence.tokens === undefined ? {} : { tokens: sentence.tokens.map(tokenInSource(view)) }),
|
|
64
|
+
...(sentence.embeddedLanguage === undefined ? {} : { embeddedLanguage: sentence.embeddedLanguage }),
|
|
64
65
|
};
|
|
65
66
|
};
|
|
66
67
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { readMarkdown, spansOfType } from "./markdown-read.ts";
|
|
2
|
+
import { spanOf, type MarkdownNode } from "./markdown-node.ts";
|
|
3
|
+
import { maskSpans } from "./mask.ts";
|
|
4
|
+
import type { Span } from "./plugin.ts";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The text the document's language is guessed from: what the writer wrote in it. Fenced code, inline code, HTML tags
|
|
8
|
+
* and comments, HTML code blocks (`<script>`, `<pre>` and the like), YAML front matter, a site generator's syntax (MDX imports, component lines) and URLs are blanked out.
|
|
9
|
+
* A technical article in Japanese can hold more Latin letters in its code than kana and kanji in its prose. The text
|
|
10
|
+
* between HTML tags is kept: a `<details>` block holds prose. Indented code is kept too: in plain text an indented
|
|
11
|
+
* paragraph is prose, and Markdown would read it as code.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const FENCE = /^ {0,3}(?:```|~~~)/u;
|
|
15
|
+
const URL_PATTERN = /\b[a-z][a-z\d+.-]*:\/\/[^\s<>"'`)\]]+/giu;
|
|
16
|
+
const NOT_WRITTEN_IN_IT: readonly string[] = ["inlineCode", "yaml"];
|
|
17
|
+
/** HTML whose content is not prose: a comment, or a block that holds code (CommonMark's raw HTML blocks, and `<code>`). */
|
|
18
|
+
const NOT_PROSE_HTML = /^\s*(?:<!--|<(?:script|style|pre|textarea|code)\b)/iu;
|
|
19
|
+
|
|
20
|
+
const isFenced = (source: string) => (node: MarkdownNode) => {
|
|
21
|
+
const span = spanOf(node);
|
|
22
|
+
return span !== undefined && FENCE.test(source.slice(span.start, span.end));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const urlSpans = (source: string): Span[] => [...source.matchAll(URL_PATTERN)].map((match) => ({ start: match.index, end: match.index + match[0].length }));
|
|
26
|
+
|
|
27
|
+
/** The tags in an HTML node (`<…>`), found with indexOf so that a stray `<` costs one scan, not a backtrack. */
|
|
28
|
+
const tagSpans = (source: string, node: Span): Span[] => {
|
|
29
|
+
const spans: Span[] = [];
|
|
30
|
+
let open = source.indexOf("<", node.start);
|
|
31
|
+
while (open !== -1 && open < node.end) {
|
|
32
|
+
const close = source.indexOf(">", open);
|
|
33
|
+
if (close === -1 || close >= node.end) break;
|
|
34
|
+
spans.push({ start: open, end: close + 1 });
|
|
35
|
+
open = source.indexOf("<", close + 1);
|
|
36
|
+
}
|
|
37
|
+
return spans;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** A comment or a code block is blanked whole; any other HTML keeps the text between its tags. */
|
|
41
|
+
const htmlSpans = (source: string, nodes: readonly Span[]): Span[] =>
|
|
42
|
+
nodes.flatMap((node) => (NOT_PROSE_HTML.test(source.slice(node.start, node.end)) ? [node] : tagSpans(source, node)));
|
|
43
|
+
|
|
44
|
+
export const languageSample = (source: string): string => {
|
|
45
|
+
const { root, syntax } = readMarkdown(source);
|
|
46
|
+
const code = [...spansOfType(root, "code", isFenced(source)), ...NOT_WRITTEN_IN_IT.flatMap((type) => spansOfType(root, type))];
|
|
47
|
+
return maskSpans(source, [...code, ...htmlSpans(source, spansOfType(root, "html")), ...syntax, ...urlSpans(source)]);
|
|
48
|
+
};
|
package/src/levels.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Level, LevelTable, RuleDefinition } from "./plugin.ts";
|
|
1
|
+
import type { Level, LevelTable, RuleDefinition, Severity } from "./plugin.ts";
|
|
2
2
|
|
|
3
3
|
const LEVELS: readonly Level[] = ["strict", "normal", "relaxed", "off"];
|
|
4
4
|
|
|
@@ -37,3 +37,16 @@ export const resolve = (rule: RuleDefinition, level: Level, genre?: string): Res
|
|
|
37
37
|
|
|
38
38
|
/** その rule が実際に区別できる段だけを返す。CLI の案内に使う。 */
|
|
39
39
|
export const definedLevels = (rule: RuleDefinition): Level[] => LEVELS.filter((level) => level === "off" || rule.levels[level] !== undefined);
|
|
40
|
+
|
|
41
|
+
/** Lightest first: a level table holds info as 1, warning as 2 and error as 3. */
|
|
42
|
+
const SEVERITY_BY_RANK: readonly Severity[] = ["info", "warning", "error"];
|
|
43
|
+
|
|
44
|
+
/** A severity written in a level table, as the number the table holds. */
|
|
45
|
+
export const rankOfSeverity = (value: unknown): number | undefined => {
|
|
46
|
+
const index = SEVERITY_BY_RANK.findIndex((entry) => entry === value);
|
|
47
|
+
return index === -1 ? undefined : index + 1;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** The severity a rule with nothing to count gives its findings at a level. A counting rule keeps its own. */
|
|
51
|
+
export const severityAt = (rule: RuleDefinition, level: Exclude<Level, "off">, genre?: string): Severity =>
|
|
52
|
+
rule.level_sets === "severity" ? (SEVERITY_BY_RANK[resolve(rule, level, genre).limit - 1] ?? rule.severity) : rule.severity;
|
package/src/line-paragraphs.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { Span } from "./plugin.ts";
|
|
|
10
10
|
* (議事録は発言者の行と発言の行が交互に来るので、半分ちょうどは割る)。
|
|
11
11
|
* - 1 行 1 文の書き方(行を意味の切れ目で改める。英語の Markdown に多い)は、段落のつもりではない。
|
|
12
12
|
* 文の頭で始まり文の終わりで終わる行が 2 文以上を持つことが、段落を 1 行に書いた印。それがたまにしか無ければ割らない。
|
|
13
|
+
* この印は文書全体で数える(documentIsLineShaped)。
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
/** 2 文以上を持つ行がこれより少なければ、1 行 1 文の書き方にたまに混じる 2 文の行と見分けられない。 */
|
|
@@ -69,18 +70,60 @@ const sentencesIn = (group: Span, cores: readonly Span[]): number => firstStarti
|
|
|
69
70
|
const wholeMultiSentenceLines = (lines: readonly Line[], closing: readonly boolean[], cores: readonly Span[]): number =>
|
|
70
71
|
lines.filter((line, index) => (index === 0 || closing[index - 1] === true) && closing[index] === true && sentencesIn(line.span, cores) >= 2).length;
|
|
71
72
|
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
/** 1 つの段落の形: 割るならどこで割るか(groups)と、行ごとの段落と読む手がかり。 */
|
|
74
|
+
type Shape = {
|
|
75
|
+
readonly paragraph: Span;
|
|
76
|
+
readonly groups: readonly Span[];
|
|
77
|
+
readonly lines: number;
|
|
78
|
+
/** 文で終わる行が半分以上。届かなければ固定幅の折り返し。 */
|
|
79
|
+
readonly mostlyClosed: boolean;
|
|
80
|
+
/** 文の頭で始まり文の終わりで終わる、2 文以上の行の数。 */
|
|
81
|
+
readonly multi: number;
|
|
77
82
|
};
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
export const lineParagraphs = (source: string, paragraph: Span, sentences: readonly Span[]): Span[] => {
|
|
84
|
+
const shapeOf = (source: string, paragraph: Span, sentences: readonly Span[]): Shape => {
|
|
81
85
|
const lines = linesOf(source, paragraph);
|
|
82
86
|
const cores = sentences.map((sentence) => coreOf(source, sentence)).filter((core) => core.end > core.start);
|
|
83
87
|
const closing = lines.map((line) => hasText(source, line) && endsSentence(line, cores));
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
return {
|
|
89
|
+
paragraph,
|
|
90
|
+
groups: groupAt(lines, closing),
|
|
91
|
+
lines: lines.length,
|
|
92
|
+
mostlyClosed: closing.filter(Boolean).length * 2 >= closing.length,
|
|
93
|
+
multi: wholeMultiSentenceLines(lines, closing, cores),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** 2 文以上の行が、1 行 1 文の書き方にたまに混じる数より多い。 */
|
|
98
|
+
const enoughMulti = (multi: number, groups: number): boolean => multi >= MIN_MULTI_SENTENCE && multi >= groups * MULTI_SENTENCE_SHARE;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 文書が 1 行 1 段落で書かれているか。書き方は書き手のもので、段落 1 つずつでは決まらない(見出しごとの短い段落が並ぶ演説)。
|
|
102
|
+
* 手がかりは、2 行以上あって折り返しでない段落だけから集める。1 行だけの段落は空行で区切った普通の段落で、1 行 1 段落の印ではない。
|
|
103
|
+
*/
|
|
104
|
+
const documentIsLineShaped = (shapes: readonly Shape[]): boolean => {
|
|
105
|
+
const evidence = shapes.filter((shape) => shape.lines > 1 && shape.mostlyClosed);
|
|
106
|
+
const total = (count: (shape: Shape) => number): number => evidence.reduce((sum, shape) => sum + count(shape), 0);
|
|
107
|
+
return enoughMulti(
|
|
108
|
+
total((shape) => shape.multi),
|
|
109
|
+
total((shape) => shape.groups.length),
|
|
110
|
+
);
|
|
86
111
|
};
|
|
112
|
+
|
|
113
|
+
/** 割るか: 折り返しでなく、段落だけで、または文書全体で、行ごとの段落と読める。 */
|
|
114
|
+
const splits = (shape: Shape, lineShapedDocument: boolean): boolean =>
|
|
115
|
+
shape.mostlyClosed && (lineShapedDocument || enoughMulti(shape.multi, shape.groups.length));
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 文書の段落(並び順)を、書いた人が段落のつもりで改めた行ごとに割った段落。そう読めない段落はそのまま。
|
|
119
|
+
* sentences は段落の中の文。
|
|
120
|
+
*/
|
|
121
|
+
export const documentLineParagraphs = (source: string, paragraphs: readonly { readonly span: Span; readonly sentences: readonly Span[] }[]): Span[] => {
|
|
122
|
+
const shapes = paragraphs.map((paragraph) => shapeOf(source, paragraph.span, paragraph.sentences));
|
|
123
|
+
const lineShaped = documentIsLineShaped(shapes);
|
|
124
|
+
return shapes.flatMap((shape) => (splits(shape, lineShaped) ? shape.groups : [shape.paragraph]));
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/** paragraph を、書いた人が段落のつもりで改めた行ごとに割る。そう読めなければ paragraph 1 つ。sentences は段落の中の文。 */
|
|
128
|
+
export const lineParagraphs = (source: string, paragraph: Span, sentences: readonly Span[]): Span[] =>
|
|
129
|
+
documentLineParagraphs(source, [{ span: paragraph, sentences }]);
|
package/src/link-line.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Span } from "./plugin.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 行が一つのリンクだけか。前後の空白を除いた行が、どれかのリンクの範囲とちょうど重なる。
|
|
5
|
+
* 記事の一覧のようにリンクを 1 行ずつ並べた段落では、句点が無くても行ごとに一つの項目と読まれる。
|
|
6
|
+
* line と links は source の中の位置。
|
|
7
|
+
*/
|
|
8
|
+
export const isLinkLine = (source: string, line: Span, links: readonly Span[]): boolean => {
|
|
9
|
+
const text = source.slice(line.start, line.end);
|
|
10
|
+
const start = line.start + text.length - text.trimStart().length;
|
|
11
|
+
const end = line.end - (text.length - text.trimEnd().length);
|
|
12
|
+
return links.some((link) => link.start === start && link.end === end);
|
|
13
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// The final long-vowel mark (ー) of katakana loanwords: how long a word is, and which written forms go against the chosen way.
|
|
2
|
+
// Pure: the words come in already picked from the document's tokens.
|
|
3
|
+
|
|
4
|
+
/** Small kana that join the kana before them into one mora (キャ, ファ, ウィ). ッ, ン and ー are morae of their own. */
|
|
5
|
+
const JOINING: ReadonlySet<string> = new Set(Array.from("ァィゥェォャュョヮぁぃぅぇぉゃゅょゎ"));
|
|
6
|
+
|
|
7
|
+
/** The number of morae (音) in a kana word: コンピューター is コ・ン・ピュ・ー・タ・ー, six. */
|
|
8
|
+
export const moraCount = (word: string): number => Array.from(word).filter((char) => !JOINING.has(char)).length;
|
|
9
|
+
|
|
10
|
+
const LONG_VOWEL = "ー";
|
|
11
|
+
const KATAKANA_WORD = /^[ァ-ヺー]+$/u;
|
|
12
|
+
|
|
13
|
+
/** A katakana word without its final ー: the part both ways of writing it share (コンピュータ for コンピューター). */
|
|
14
|
+
export const stemOf = (surface: string): string => {
|
|
15
|
+
const chars = Array.from(surface);
|
|
16
|
+
return chars.slice(0, chars.findLastIndex((char) => char !== LONG_VOWEL) + 1).join("");
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** Whether the surface is a katakana word with something besides ー in it. */
|
|
20
|
+
export const isKatakanaWord = (surface: string): boolean => KATAKANA_WORD.test(surface) && stemOf(surface) !== "";
|
|
21
|
+
|
|
22
|
+
/** A katakana word the rule reads: where it is, how it is written, and whether a final ー could be written or dropped. */
|
|
23
|
+
export type KanaWord = {
|
|
24
|
+
readonly surface: string;
|
|
25
|
+
readonly offset: number;
|
|
26
|
+
/** Written with a final ー. */
|
|
27
|
+
readonly long: boolean;
|
|
28
|
+
/** Written without one, and the dictionary knows the form with one (the language adapter's LongVowelEnding=Dropped). */
|
|
29
|
+
readonly dropped: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The morae of the word before its final ー: カー is one, カバー two, コンピューター five. JIS Z 8301:2011 Table G.3 counts so:
|
|
34
|
+
* カバー is its example of a word of two sounds or fewer, which keeps the ー.
|
|
35
|
+
*/
|
|
36
|
+
export const stemMorae = (surface: string): number => moraCount(stemOf(surface));
|
|
37
|
+
|
|
38
|
+
export type Ending = "consistent" | "drop" | "keep";
|
|
39
|
+
|
|
40
|
+
export type Odd = {
|
|
41
|
+
readonly word: KanaWord;
|
|
42
|
+
/** How the rule found it: same-word (one word written both ways), drop or keep (against the setting). */
|
|
43
|
+
readonly variant: "same-word" | "drop" | "keep";
|
|
44
|
+
/** The form the rule asks for. */
|
|
45
|
+
readonly preferred: string;
|
|
46
|
+
/** For same-word: how many times the word is written the way this one is, and how many times in all. */
|
|
47
|
+
readonly count: number;
|
|
48
|
+
readonly of: number;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const otherForm = (word: KanaWord): string => (word.long ? stemOf(word.surface) : `${word.surface}${LONG_VOWEL}`);
|
|
52
|
+
|
|
53
|
+
/** The side written less; on a tie, the side the document did not use first. undefined when only one side is used. */
|
|
54
|
+
const minorityLong = (words: readonly KanaWord[]): boolean | undefined => {
|
|
55
|
+
const long = words.filter((word) => word.long).length;
|
|
56
|
+
const short = words.length - long;
|
|
57
|
+
if (long === 0 || short === 0) return undefined;
|
|
58
|
+
if (long !== short) return long < short;
|
|
59
|
+
return !(words[0]?.long ?? false);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const minorityOf = (words: readonly KanaWord[], variant: Odd["variant"]): Odd[] => {
|
|
63
|
+
const minority = minorityLong(words);
|
|
64
|
+
if (minority === undefined) return [];
|
|
65
|
+
const odd = words.filter((word) => word.long === minority);
|
|
66
|
+
return odd.map((word) => ({ word, variant, preferred: otherForm(word), count: odd.length, of: words.length }));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** The document's words grouped by the part both ways share (コンピュータ with コンピューター). */
|
|
70
|
+
const sameWordGroups = (words: readonly KanaWord[]): KanaWord[][] => {
|
|
71
|
+
const groups = new Map<string, KanaWord[]>();
|
|
72
|
+
words.forEach((word) => {
|
|
73
|
+
const stem = stemOf(word.surface);
|
|
74
|
+
const group = groups.get(stem);
|
|
75
|
+
if (group === undefined) groups.set(stem, [word]);
|
|
76
|
+
else group.push(word);
|
|
77
|
+
});
|
|
78
|
+
return [...groups.values()];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* With no side taken: a word written both ways (コンピュータ and コンピューター), at its fewer form. Different words are not compared:
|
|
83
|
+
* a document may write サーバー and ブラウザ by each word's usual spelling, and no guideline makes that a mistake.
|
|
84
|
+
*/
|
|
85
|
+
const inconsistent = (words: readonly KanaWord[]): Odd[] => sameWordGroups(words).flatMap((group) => minorityOf(group, "same-word"));
|
|
86
|
+
|
|
87
|
+
/** Whether drop reaches the word: its final ー follows one of the kana the guideline drops it after (ア段: -er, -or, -ar). Any, when none are given. */
|
|
88
|
+
const droppable = (word: KanaWord, dropAfter: ReadonlySet<string> | undefined): boolean =>
|
|
89
|
+
dropAfter === undefined || dropAfter.has(Array.from(stemOf(word.surface)).at(-1) ?? "");
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The words that go against the chosen way. drop: a word of minMorae or more written with its final ー after a kana of dropAfter.
|
|
93
|
+
* keep: a word written without one where the dictionary, or the document itself, has the form with one. consistent: see inconsistent.
|
|
94
|
+
* Words shorter than minMorae are left alone whichever way: the guidelines that drop the ー keep it on them (カー, カバー).
|
|
95
|
+
*/
|
|
96
|
+
export const oddLongVowels = (words: readonly KanaWord[], ending: Ending, minMorae: number, dropAfter?: ReadonlySet<string>): Odd[] => {
|
|
97
|
+
const counted = words.filter((word) => stemMorae(word.surface) >= minMorae);
|
|
98
|
+
if (ending === "drop")
|
|
99
|
+
return counted
|
|
100
|
+
.filter((word) => word.long && droppable(word, dropAfter))
|
|
101
|
+
.map((word) => ({ word, variant: "drop", preferred: otherForm(word), count: 0, of: 0 }));
|
|
102
|
+
if (ending === "keep") {
|
|
103
|
+
const longStems = new Set(counted.filter((word) => word.long).map((word) => stemOf(word.surface)));
|
|
104
|
+
return counted
|
|
105
|
+
.filter((word) => !word.long && (word.dropped || longStems.has(word.surface)))
|
|
106
|
+
.map((word) => ({ word, variant: "keep", preferred: otherForm(word), count: 0, of: 0 }));
|
|
107
|
+
}
|
|
108
|
+
return inconsistent(counted).toSorted((left, right) => left.word.offset - right.word.offset);
|
|
109
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Span } from "./plugin.ts";
|
|
2
|
+
|
|
3
|
+
type Place = { readonly offset?: number | undefined };
|
|
4
|
+
|
|
5
|
+
/** The part of an mdast node chaff reads. */
|
|
6
|
+
export type MarkdownNode = {
|
|
7
|
+
readonly type: string;
|
|
8
|
+
readonly url?: string | undefined;
|
|
9
|
+
readonly value?: string | undefined;
|
|
10
|
+
readonly identifier?: string | undefined;
|
|
11
|
+
readonly position?: { readonly start: Place; readonly end: Place } | undefined;
|
|
12
|
+
readonly children?: readonly MarkdownNode[] | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const spanOf = (node: MarkdownNode): Span | undefined => {
|
|
16
|
+
const start = node.position?.start.offset;
|
|
17
|
+
const end = node.position?.end.offset;
|
|
18
|
+
return start === undefined || end === undefined ? undefined : { start, end };
|
|
19
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
2
|
+
import { gfmTable } from "micromark-extension-gfm-table";
|
|
3
|
+
import { gfmTableFromMarkdown } from "mdast-util-gfm-table";
|
|
4
|
+
import { frontmatter } from "micromark-extension-frontmatter";
|
|
5
|
+
import { frontmatterFromMarkdown } from "mdast-util-frontmatter";
|
|
6
|
+
import { maskSpans } from "./mask.ts";
|
|
7
|
+
import { spanOf, type MarkdownNode } from "./markdown-node.ts";
|
|
8
|
+
import { componentLines, moduleBlocks, templateSpans } from "./template-syntax.ts";
|
|
9
|
+
import { eachPreOrder } from "./tree-walk.ts";
|
|
10
|
+
import type { Span } from "./plugin.ts";
|
|
11
|
+
|
|
12
|
+
export const parse = (source: string): MarkdownNode =>
|
|
13
|
+
fromMarkdown(source, { extensions: [gfmTable(), frontmatter(["yaml"])], mdastExtensions: [gfmTableFromMarkdown(), frontmatterFromMarkdown(["yaml"])] });
|
|
14
|
+
|
|
15
|
+
export const spansOfType = (root: MarkdownNode, type: string, keep: (node: MarkdownNode) => boolean = () => true): Span[] => {
|
|
16
|
+
const found: Span[] = [];
|
|
17
|
+
eachPreOrder(root, (node) => {
|
|
18
|
+
if (node.type !== type || !keep(node)) return;
|
|
19
|
+
const span = spanOf(node);
|
|
20
|
+
if (span !== undefined) found.push(span);
|
|
21
|
+
});
|
|
22
|
+
return found;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** 番号を探してはいけない範囲。コードの中の「第3条」は条ではなく、参照でもない。 */
|
|
26
|
+
const OPAQUE = ["code", "inlineCode", "html", "yaml", "toml"];
|
|
27
|
+
|
|
28
|
+
export const opaqueSpans = (root: MarkdownNode): Span[] => OPAQUE.flatMap((type) => spansOfType(root, type));
|
|
29
|
+
|
|
30
|
+
/** Template syntax outside code: a `{{` in backticks is code, and does not open a tag that runs to the next `}}`. */
|
|
31
|
+
const templateOf = (root: MarkdownNode, source: string): Span[] => (source.includes("{") ? templateSpans(maskSpans(source, opaqueSpans(root))) : []);
|
|
32
|
+
|
|
33
|
+
type MarkdownRead = { readonly root: MarkdownNode; readonly syntax: readonly Span[] };
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Markdown as MDX reads it: a line of nothing but JSX tags is a block of its own, not the start of an HTML block.
|
|
37
|
+
* `syntax` is the site generator's markup in it (those lines, MDX's imports and exports, and template tags outside
|
|
38
|
+
* code), which is neither prose nor structure.
|
|
39
|
+
*/
|
|
40
|
+
export const readMarkdown = (source: string): MarkdownRead => {
|
|
41
|
+
const components = source.includes("<") ? componentLines(source) : [];
|
|
42
|
+
const root = parse(components.length === 0 ? source : maskSpans(source, components));
|
|
43
|
+
return { root, syntax: [...components, ...moduleBlocks(root, source), ...templateOf(root, source)] };
|
|
44
|
+
};
|