@redocly/recheck 0.1.0 → 0.3.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 +1023 -56
- package/dist/cli.js +40 -7
- package/dist/cli.js.map +1 -1
- package/dist/commands/markdoc-schema.d.ts +17 -0
- package/dist/commands/markdoc-schema.d.ts.map +1 -0
- package/dist/commands/markdoc-schema.js +127 -0
- package/dist/commands/markdoc-schema.js.map +1 -0
- package/dist/commands/run.d.ts +2 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +87 -10
- package/dist/commands/run.js.map +1 -1
- package/dist/config/load.d.ts +11 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +12 -2
- package/dist/config/load.js.map +1 -1
- package/dist/config/presets/google.d.ts +3 -0
- package/dist/config/presets/google.d.ts.map +1 -0
- package/dist/config/presets/google.js +1671 -0
- package/dist/config/presets/google.js.map +1 -0
- package/dist/config/presets/inclusive-language.d.ts +3 -0
- package/dist/config/presets/inclusive-language.d.ts.map +1 -0
- package/dist/config/presets/inclusive-language.js +321 -0
- package/dist/config/presets/inclusive-language.js.map +1 -0
- package/dist/config/presets/index.d.ts +67 -0
- package/dist/config/presets/index.d.ts.map +1 -0
- package/dist/config/presets/index.js +137 -0
- package/dist/config/presets/index.js.map +1 -0
- package/dist/config/presets/markdoc.d.ts +21 -0
- package/dist/config/presets/markdoc.d.ts.map +1 -0
- package/dist/config/presets/markdoc.js +101 -0
- package/dist/config/presets/markdoc.js.map +1 -0
- package/dist/config/presets/markdown-relaxed.d.ts +3 -0
- package/dist/config/presets/markdown-relaxed.d.ts.map +1 -0
- package/dist/config/presets/markdown-relaxed.js +98 -0
- package/dist/config/presets/markdown-relaxed.js.map +1 -0
- package/dist/config/presets/markdown.d.ts +43 -0
- package/dist/config/presets/markdown.d.ts.map +1 -0
- package/dist/config/presets/markdown.js +132 -0
- package/dist/config/presets/markdown.js.map +1 -0
- package/dist/config/presets/microsoft.d.ts +3 -0
- package/dist/config/presets/microsoft.d.ts.map +1 -0
- package/dist/config/presets/microsoft.js +2268 -0
- package/dist/config/presets/microsoft.js.map +1 -0
- package/dist/config/presets/minimal.d.ts +3 -0
- package/dist/config/presets/minimal.d.ts.map +1 -0
- package/dist/config/presets/minimal.js +21 -0
- package/dist/config/presets/minimal.js.map +1 -0
- package/dist/config/presets/plain-language.d.ts +3 -0
- package/dist/config/presets/plain-language.d.ts.map +1 -0
- package/dist/config/presets/plain-language.js +351 -0
- package/dist/config/presets/plain-language.js.map +1 -0
- package/dist/config/presets/prose.d.ts +52 -0
- package/dist/config/presets/prose.d.ts.map +1 -0
- package/dist/config/presets/prose.js +138 -0
- package/dist/config/presets/prose.js.map +1 -0
- package/dist/config/schema.d.ts +128 -22
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +105 -21
- package/dist/config/schema.js.map +1 -1
- package/dist/config/validate.d.ts +12 -2
- package/dist/config/validate.d.ts.map +1 -1
- package/dist/config/validate.js +1200 -44
- package/dist/config/validate.js.map +1 -1
- package/dist/core/auto-fix.d.ts +8 -13
- package/dist/core/auto-fix.d.ts.map +1 -1
- package/dist/core/auto-fix.js +94 -75
- package/dist/core/auto-fix.js.map +1 -1
- package/dist/core/case-preserve.d.ts +46 -0
- package/dist/core/case-preserve.d.ts.map +1 -0
- package/dist/core/case-preserve.js +57 -0
- package/dist/core/case-preserve.js.map +1 -0
- package/dist/core/directives.d.ts +9 -0
- package/dist/core/directives.d.ts.map +1 -0
- package/dist/core/directives.js +73 -0
- package/dist/core/directives.js.map +1 -0
- package/dist/core/files.d.ts +63 -0
- package/dist/core/files.d.ts.map +1 -1
- package/dist/core/files.js +185 -0
- package/dist/core/files.js.map +1 -1
- package/dist/core/inline-code.d.ts +87 -0
- package/dist/core/inline-code.d.ts.map +1 -0
- package/dist/core/inline-code.js +104 -0
- package/dist/core/inline-code.js.map +1 -0
- package/dist/core/line-endings.d.ts +32 -0
- package/dist/core/line-endings.d.ts.map +1 -0
- package/dist/core/line-endings.js +65 -0
- package/dist/core/line-endings.js.map +1 -0
- package/dist/core/markdoc-tags.d.ts +79 -0
- package/dist/core/markdoc-tags.d.ts.map +1 -0
- package/dist/core/markdoc-tags.js +131 -0
- package/dist/core/markdoc-tags.js.map +1 -0
- package/dist/core/rule-filters.d.ts +17 -0
- package/dist/core/rule-filters.d.ts.map +1 -1
- package/dist/core/rule-filters.js +64 -0
- package/dist/core/rule-filters.js.map +1 -1
- package/dist/core/runner.d.ts +92 -3
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +348 -110
- package/dist/core/runner.js.map +1 -1
- package/dist/core/timing.d.ts.map +1 -1
- package/dist/data/markdoc-realm-schema.d.ts +3 -0
- package/dist/data/markdoc-realm-schema.d.ts.map +1 -0
- package/dist/data/markdoc-realm-schema.js +760 -0
- package/dist/data/markdoc-realm-schema.js.map +1 -0
- package/dist/data/proper-nouns.d.ts +2 -0
- package/dist/data/proper-nouns.d.ts.map +1 -0
- package/dist/data/proper-nouns.js +47 -0
- package/dist/data/proper-nouns.js.map +1 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +152 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics/formulas.d.ts +17 -0
- package/dist/metrics/formulas.d.ts.map +1 -0
- package/dist/metrics/formulas.js +70 -0
- package/dist/metrics/formulas.js.map +1 -0
- package/dist/metrics/index.d.ts +5 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +3 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/statistics.d.ts +27 -0
- package/dist/metrics/statistics.d.ts.map +1 -0
- package/dist/metrics/statistics.js +56 -0
- package/dist/metrics/statistics.js.map +1 -0
- package/dist/parser/index.d.ts +18 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +168 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/markdoc/extract-statics.d.ts +45 -0
- package/dist/parser/markdoc/extract-statics.d.ts.map +1 -0
- package/dist/parser/markdoc/extract-statics.js +139 -0
- package/dist/parser/markdoc/extract-statics.js.map +1 -0
- package/dist/parser/markdoc/pairing.d.ts +63 -0
- package/dist/parser/markdoc/pairing.d.ts.map +1 -0
- package/dist/parser/markdoc/pairing.js +94 -0
- package/dist/parser/markdoc/pairing.js.map +1 -0
- package/dist/parser/markdoc/schema.d.ts +85 -0
- package/dist/parser/markdoc/schema.d.ts.map +1 -0
- package/dist/parser/markdoc/schema.js +86 -0
- package/dist/parser/markdoc/schema.js.map +1 -0
- package/dist/parser/markdoc/span.d.ts +64 -0
- package/dist/parser/markdoc/span.d.ts.map +1 -0
- package/dist/parser/markdoc/span.js +729 -0
- package/dist/parser/markdoc/span.js.map +1 -0
- package/dist/parser/markdoc/structure.d.ts +28 -0
- package/dist/parser/markdoc/structure.d.ts.map +1 -0
- package/dist/parser/markdoc/structure.js +153 -0
- package/dist/parser/markdoc/structure.js.map +1 -0
- package/dist/parser/markdoc/syntax.d.ts +44 -0
- package/dist/parser/markdoc/syntax.d.ts.map +1 -0
- package/dist/parser/markdoc/syntax.js +317 -0
- package/dist/parser/markdoc/syntax.js.map +1 -0
- package/dist/parser/types.d.ts +18 -0
- package/dist/parser/types.d.ts.map +1 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/reporter/fixes.d.ts.map +1 -1
- package/dist/reporter/fixes.js +22 -1
- package/dist/reporter/fixes.js.map +1 -1
- package/dist/reporter/statistics.d.ts +1 -8
- package/dist/reporter/statistics.d.ts.map +1 -1
- package/dist/reporter/statistics.js.map +1 -1
- package/dist/rules/registry.d.ts +15 -0
- package/dist/rules/registry.d.ts.map +1 -0
- package/dist/rules/registry.js +81 -0
- package/dist/rules/registry.js.map +1 -0
- package/dist/rules/scope/capitalization.d.ts +3 -0
- package/dist/rules/scope/capitalization.d.ts.map +1 -0
- package/dist/rules/scope/capitalization.js +163 -0
- package/dist/rules/scope/capitalization.js.map +1 -0
- package/dist/rules/scope/conditional.d.ts +3 -0
- package/dist/rules/scope/conditional.d.ts.map +1 -0
- package/dist/rules/scope/conditional.js +112 -0
- package/dist/rules/scope/conditional.js.map +1 -0
- package/dist/rules/scope/consistency.d.ts +3 -0
- package/dist/rules/scope/consistency.d.ts.map +1 -0
- package/dist/rules/scope/consistency.js +178 -0
- package/dist/rules/scope/consistency.js.map +1 -0
- package/dist/rules/scope/length.d.ts +3 -0
- package/dist/rules/scope/length.d.ts.map +1 -0
- package/dist/rules/scope/length.js +69 -0
- package/dist/rules/scope/length.js.map +1 -0
- package/dist/rules/scope/max-image-size.d.ts +3 -0
- package/dist/rules/scope/max-image-size.d.ts.map +1 -0
- package/dist/rules/scope/max-image-size.js +65 -0
- package/dist/rules/scope/max-image-size.js.map +1 -0
- package/dist/rules/scope/metric.d.ts +17 -0
- package/dist/rules/scope/metric.d.ts.map +1 -0
- package/dist/rules/scope/metric.js +216 -0
- package/dist/rules/scope/metric.js.map +1 -0
- package/dist/rules/scope/occurrence.d.ts +3 -0
- package/dist/rules/scope/occurrence.d.ts.map +1 -0
- package/dist/rules/scope/occurrence.js +48 -0
- package/dist/rules/scope/occurrence.js.map +1 -0
- package/dist/rules/scope/pattern.d.ts +3 -0
- package/dist/rules/scope/pattern.d.ts.map +1 -0
- package/dist/rules/scope/pattern.js +75 -0
- package/dist/rules/scope/pattern.js.map +1 -0
- package/dist/rules/scope/repetition.d.ts +3 -0
- package/dist/rules/scope/repetition.d.ts.map +1 -0
- package/dist/rules/scope/repetition.js +139 -0
- package/dist/rules/scope/repetition.js.map +1 -0
- package/dist/rules/scope/semantic-line-breaks.d.ts +3 -0
- package/dist/rules/scope/semantic-line-breaks.d.ts.map +1 -0
- package/dist/rules/scope/semantic-line-breaks.js +213 -0
- package/dist/rules/scope/semantic-line-breaks.js.map +1 -0
- package/dist/rules/scope/spelling.d.ts +27 -0
- package/dist/rules/scope/spelling.d.ts.map +1 -0
- package/dist/rules/scope/spelling.js +227 -0
- package/dist/rules/scope/spelling.js.map +1 -0
- package/dist/rules/scope/swap.d.ts +3 -0
- package/dist/rules/scope/swap.d.ts.map +1 -0
- package/dist/rules/scope/swap.js +149 -0
- package/dist/rules/scope/swap.js.map +1 -0
- package/dist/rules/scope/title-case.d.ts +46 -0
- package/dist/rules/scope/title-case.d.ts.map +1 -0
- package/dist/rules/scope/title-case.js +301 -0
- package/dist/rules/scope/title-case.js.map +1 -0
- package/dist/rules/token/blanks-around-fences.d.ts +3 -0
- package/dist/rules/token/blanks-around-fences.d.ts.map +1 -0
- package/dist/rules/token/blanks-around-fences.js +44 -0
- package/dist/rules/token/blanks-around-fences.js.map +1 -0
- package/dist/rules/token/blanks-around-headings.d.ts +3 -0
- package/dist/rules/token/blanks-around-headings.d.ts.map +1 -0
- package/dist/rules/token/blanks-around-headings.js +108 -0
- package/dist/rules/token/blanks-around-headings.js.map +1 -0
- package/dist/rules/token/blanks-around-lists.d.ts +3 -0
- package/dist/rules/token/blanks-around-lists.d.ts.map +1 -0
- package/dist/rules/token/blanks-around-lists.js +56 -0
- package/dist/rules/token/blanks-around-lists.js.map +1 -0
- package/dist/rules/token/blanks-around-tables.d.ts +3 -0
- package/dist/rules/token/blanks-around-tables.d.ts.map +1 -0
- package/dist/rules/token/blanks-around-tables.js +42 -0
- package/dist/rules/token/blanks-around-tables.js.map +1 -0
- package/dist/rules/token/code-block-style.d.ts +3 -0
- package/dist/rules/token/code-block-style.d.ts.map +1 -0
- package/dist/rules/token/code-block-style.js +30 -0
- package/dist/rules/token/code-block-style.js.map +1 -0
- package/dist/rules/token/code-fence-style.d.ts +3 -0
- package/dist/rules/token/code-fence-style.d.ts.map +1 -0
- package/dist/rules/token/code-fence-style.js +35 -0
- package/dist/rules/token/code-fence-style.js.map +1 -0
- package/dist/rules/token/commands-show-output.d.ts +3 -0
- package/dist/rules/token/commands-show-output.d.ts.map +1 -0
- package/dist/rules/token/commands-show-output.js +38 -0
- package/dist/rules/token/commands-show-output.js.map +1 -0
- package/dist/rules/token/descriptive-link-text.d.ts +3 -0
- package/dist/rules/token/descriptive-link-text.d.ts.map +1 -0
- package/dist/rules/token/descriptive-link-text.js +53 -0
- package/dist/rules/token/descriptive-link-text.js.map +1 -0
- package/dist/rules/token/emphasis-style.d.ts +3 -0
- package/dist/rules/token/emphasis-style.d.ts.map +1 -0
- package/dist/rules/token/emphasis-style.js +51 -0
- package/dist/rules/token/emphasis-style.js.map +1 -0
- package/dist/rules/token/fenced-code-language.d.ts +3 -0
- package/dist/rules/token/fenced-code-language.d.ts.map +1 -0
- package/dist/rules/token/fenced-code-language.js +35 -0
- package/dist/rules/token/fenced-code-language.js.map +1 -0
- package/dist/rules/token/first-line-h1.d.ts +3 -0
- package/dist/rules/token/first-line-h1.d.ts.map +1 -0
- package/dist/rules/token/first-line-h1.js +107 -0
- package/dist/rules/token/first-line-h1.js.map +1 -0
- package/dist/rules/token/heading-increment.d.ts +3 -0
- package/dist/rules/token/heading-increment.d.ts.map +1 -0
- package/dist/rules/token/heading-increment.js +27 -0
- package/dist/rules/token/heading-increment.js.map +1 -0
- package/dist/rules/token/heading-start-left.d.ts +3 -0
- package/dist/rules/token/heading-start-left.d.ts.map +1 -0
- package/dist/rules/token/heading-start-left.js +31 -0
- package/dist/rules/token/heading-start-left.js.map +1 -0
- package/dist/rules/token/heading-style.d.ts +3 -0
- package/dist/rules/token/heading-style.d.ts.map +1 -0
- package/dist/rules/token/heading-style.js +41 -0
- package/dist/rules/token/heading-style.js.map +1 -0
- package/dist/rules/token/helpers.d.ts +313 -0
- package/dist/rules/token/helpers.d.ts.map +1 -0
- package/dist/rules/token/helpers.js +746 -0
- package/dist/rules/token/helpers.js.map +1 -0
- package/dist/rules/token/hr-style.d.ts +3 -0
- package/dist/rules/token/hr-style.d.ts.map +1 -0
- package/dist/rules/token/hr-style.js +28 -0
- package/dist/rules/token/hr-style.js.map +1 -0
- package/dist/rules/token/index.d.ts +75 -0
- package/dist/rules/token/index.d.ts.map +1 -0
- package/dist/rules/token/index.js +226 -0
- package/dist/rules/token/index.js.map +1 -0
- package/dist/rules/token/line-length.d.ts +3 -0
- package/dist/rules/token/line-length.d.ts.map +1 -0
- package/dist/rules/token/line-length.js +120 -0
- package/dist/rules/token/line-length.js.map +1 -0
- package/dist/rules/token/link-fragments.d.ts +3 -0
- package/dist/rules/token/link-fragments.d.ts.map +1 -0
- package/dist/rules/token/link-fragments.js +145 -0
- package/dist/rules/token/link-fragments.js.map +1 -0
- package/dist/rules/token/link-image-reference-definitions.d.ts +3 -0
- package/dist/rules/token/link-image-reference-definitions.d.ts.map +1 -0
- package/dist/rules/token/link-image-reference-definitions.js +50 -0
- package/dist/rules/token/link-image-reference-definitions.js.map +1 -0
- package/dist/rules/token/link-image-style.d.ts +3 -0
- package/dist/rules/token/link-image-style.d.ts.map +1 -0
- package/dist/rules/token/link-image-style.js +131 -0
- package/dist/rules/token/link-image-style.js.map +1 -0
- package/dist/rules/token/list-indent.d.ts +3 -0
- package/dist/rules/token/list-indent.d.ts.map +1 -0
- package/dist/rules/token/list-indent.js +60 -0
- package/dist/rules/token/list-indent.js.map +1 -0
- package/dist/rules/token/list-length.d.ts +3 -0
- package/dist/rules/token/list-length.d.ts.map +1 -0
- package/dist/rules/token/list-length.js +55 -0
- package/dist/rules/token/list-length.js.map +1 -0
- package/dist/rules/token/list-marker-space.d.ts +3 -0
- package/dist/rules/token/list-marker-space.d.ts.map +1 -0
- package/dist/rules/token/list-marker-space.js +52 -0
- package/dist/rules/token/list-marker-space.js.map +1 -0
- package/dist/rules/token/markdoc-attributes.d.ts +3 -0
- package/dist/rules/token/markdoc-attributes.d.ts.map +1 -0
- package/dist/rules/token/markdoc-attributes.js +269 -0
- package/dist/rules/token/markdoc-attributes.js.map +1 -0
- package/dist/rules/token/markdoc-pairing.d.ts +3 -0
- package/dist/rules/token/markdoc-pairing.d.ts.map +1 -0
- package/dist/rules/token/markdoc-pairing.js +73 -0
- package/dist/rules/token/markdoc-pairing.js.map +1 -0
- package/dist/rules/token/markdoc-syntax.d.ts +3 -0
- package/dist/rules/token/markdoc-syntax.d.ts.map +1 -0
- package/dist/rules/token/markdoc-syntax.js +119 -0
- package/dist/rules/token/markdoc-syntax.js.map +1 -0
- package/dist/rules/token/markdoc-unknown-tag.d.ts +3 -0
- package/dist/rules/token/markdoc-unknown-tag.d.ts.map +1 -0
- package/dist/rules/token/markdoc-unknown-tag.js +64 -0
- package/dist/rules/token/markdoc-unknown-tag.js.map +1 -0
- package/dist/rules/token/messages.d.ts +4 -0
- package/dist/rules/token/messages.d.ts.map +1 -0
- package/dist/rules/token/messages.js +20 -0
- package/dist/rules/token/messages.js.map +1 -0
- package/dist/rules/token/no-alt-text.d.ts +3 -0
- package/dist/rules/token/no-alt-text.d.ts.map +1 -0
- package/dist/rules/token/no-alt-text.js +47 -0
- package/dist/rules/token/no-alt-text.js.map +1 -0
- package/dist/rules/token/no-bare-urls.d.ts +3 -0
- package/dist/rules/token/no-bare-urls.d.ts.map +1 -0
- package/dist/rules/token/no-bare-urls.js +88 -0
- package/dist/rules/token/no-bare-urls.js.map +1 -0
- package/dist/rules/token/no-blanks-blockquote.d.ts +3 -0
- package/dist/rules/token/no-blanks-blockquote.d.ts.map +1 -0
- package/dist/rules/token/no-blanks-blockquote.js +39 -0
- package/dist/rules/token/no-blanks-blockquote.js.map +1 -0
- package/dist/rules/token/no-duplicate-heading.d.ts +3 -0
- package/dist/rules/token/no-duplicate-heading.d.ts.map +1 -0
- package/dist/rules/token/no-duplicate-heading.js +101 -0
- package/dist/rules/token/no-duplicate-heading.js.map +1 -0
- package/dist/rules/token/no-duplicate-link-destinations.d.ts +3 -0
- package/dist/rules/token/no-duplicate-link-destinations.d.ts.map +1 -0
- package/dist/rules/token/no-duplicate-link-destinations.js +65 -0
- package/dist/rules/token/no-duplicate-link-destinations.js.map +1 -0
- package/dist/rules/token/no-emphasis-as-heading.d.ts +3 -0
- package/dist/rules/token/no-emphasis-as-heading.d.ts.map +1 -0
- package/dist/rules/token/no-emphasis-as-heading.js +44 -0
- package/dist/rules/token/no-emphasis-as-heading.js.map +1 -0
- package/dist/rules/token/no-empty-headings.d.ts +3 -0
- package/dist/rules/token/no-empty-headings.d.ts.map +1 -0
- package/dist/rules/token/no-empty-headings.js +28 -0
- package/dist/rules/token/no-empty-headings.js.map +1 -0
- package/dist/rules/token/no-empty-links.d.ts +3 -0
- package/dist/rules/token/no-empty-links.d.ts.map +1 -0
- package/dist/rules/token/no-empty-links.js +67 -0
- package/dist/rules/token/no-empty-links.js.map +1 -0
- package/dist/rules/token/no-hard-tabs.d.ts +3 -0
- package/dist/rules/token/no-hard-tabs.d.ts.map +1 -0
- package/dist/rules/token/no-hard-tabs.js +76 -0
- package/dist/rules/token/no-hard-tabs.js.map +1 -0
- package/dist/rules/token/no-inline-html.d.ts +3 -0
- package/dist/rules/token/no-inline-html.d.ts.map +1 -0
- package/dist/rules/token/no-inline-html.js +45 -0
- package/dist/rules/token/no-inline-html.js.map +1 -0
- package/dist/rules/token/no-missing-space-atx.d.ts +3 -0
- package/dist/rules/token/no-missing-space-atx.d.ts.map +1 -0
- package/dist/rules/token/no-missing-space-atx.js +36 -0
- package/dist/rules/token/no-missing-space-atx.js.map +1 -0
- package/dist/rules/token/no-missing-space-closed-atx.d.ts +3 -0
- package/dist/rules/token/no-missing-space-closed-atx.d.ts.map +1 -0
- package/dist/rules/token/no-missing-space-closed-atx.js +45 -0
- package/dist/rules/token/no-missing-space-closed-atx.js.map +1 -0
- package/dist/rules/token/no-multiple-blanks.d.ts +3 -0
- package/dist/rules/token/no-multiple-blanks.d.ts.map +1 -0
- package/dist/rules/token/no-multiple-blanks.js +35 -0
- package/dist/rules/token/no-multiple-blanks.js.map +1 -0
- package/dist/rules/token/no-multiple-space-atx.d.ts +13 -0
- package/dist/rules/token/no-multiple-space-atx.d.ts.map +1 -0
- package/dist/rules/token/no-multiple-space-atx.js +50 -0
- package/dist/rules/token/no-multiple-space-atx.js.map +1 -0
- package/dist/rules/token/no-multiple-space-blockquote.d.ts +3 -0
- package/dist/rules/token/no-multiple-space-blockquote.d.ts.map +1 -0
- package/dist/rules/token/no-multiple-space-blockquote.js +43 -0
- package/dist/rules/token/no-multiple-space-blockquote.js.map +1 -0
- package/dist/rules/token/no-multiple-space-closed-atx.d.ts +3 -0
- package/dist/rules/token/no-multiple-space-closed-atx.d.ts.map +1 -0
- package/dist/rules/token/no-multiple-space-closed-atx.js +19 -0
- package/dist/rules/token/no-multiple-space-closed-atx.js.map +1 -0
- package/dist/rules/token/no-reversed-links.d.ts +3 -0
- package/dist/rules/token/no-reversed-links.d.ts.map +1 -0
- package/dist/rules/token/no-reversed-links.js +52 -0
- package/dist/rules/token/no-reversed-links.js.map +1 -0
- package/dist/rules/token/no-space-in-code.d.ts +3 -0
- package/dist/rules/token/no-space-in-code.d.ts.map +1 -0
- package/dist/rules/token/no-space-in-code.js +75 -0
- package/dist/rules/token/no-space-in-code.js.map +1 -0
- package/dist/rules/token/no-space-in-emphasis.d.ts +3 -0
- package/dist/rules/token/no-space-in-emphasis.d.ts.map +1 -0
- package/dist/rules/token/no-space-in-emphasis.js +79 -0
- package/dist/rules/token/no-space-in-emphasis.js.map +1 -0
- package/dist/rules/token/no-space-in-links.d.ts +3 -0
- package/dist/rules/token/no-space-in-links.d.ts.map +1 -0
- package/dist/rules/token/no-space-in-links.js +48 -0
- package/dist/rules/token/no-space-in-links.js.map +1 -0
- package/dist/rules/token/no-trailing-punctuation.d.ts +3 -0
- package/dist/rules/token/no-trailing-punctuation.d.ts.map +1 -0
- package/dist/rules/token/no-trailing-punctuation.js +38 -0
- package/dist/rules/token/no-trailing-punctuation.js.map +1 -0
- package/dist/rules/token/no-trailing-spaces.d.ts +3 -0
- package/dist/rules/token/no-trailing-spaces.d.ts.map +1 -0
- package/dist/rules/token/no-trailing-spaces.js +89 -0
- package/dist/rules/token/no-trailing-spaces.js.map +1 -0
- package/dist/rules/token/ol-prefix.d.ts +3 -0
- package/dist/rules/token/ol-prefix.d.ts.map +1 -0
- package/dist/rules/token/ol-prefix.js +70 -0
- package/dist/rules/token/ol-prefix.js.map +1 -0
- package/dist/rules/token/proper-names.d.ts +3 -0
- package/dist/rules/token/proper-names.d.ts.map +1 -0
- package/dist/rules/token/proper-names.js +93 -0
- package/dist/rules/token/proper-names.js.map +1 -0
- package/dist/rules/token/reference-links-images.d.ts +3 -0
- package/dist/rules/token/reference-links-images.d.ts.map +1 -0
- package/dist/rules/token/reference-links-images.js +36 -0
- package/dist/rules/token/reference-links-images.js.map +1 -0
- package/dist/rules/token/required-headings.d.ts +3 -0
- package/dist/rules/token/required-headings.d.ts.map +1 -0
- package/dist/rules/token/required-headings.js +83 -0
- package/dist/rules/token/required-headings.js.map +1 -0
- package/dist/rules/token/single-h1.d.ts +3 -0
- package/dist/rules/token/single-h1.d.ts.map +1 -0
- package/dist/rules/token/single-h1.js +56 -0
- package/dist/rules/token/single-h1.js.map +1 -0
- package/dist/rules/token/single-trailing-newline.d.ts +3 -0
- package/dist/rules/token/single-trailing-newline.d.ts.map +1 -0
- package/dist/rules/token/single-trailing-newline.js +25 -0
- package/dist/rules/token/single-trailing-newline.js.map +1 -0
- package/dist/rules/token/strong-style.d.ts +3 -0
- package/dist/rules/token/strong-style.d.ts.map +1 -0
- package/dist/rules/token/strong-style.js +51 -0
- package/dist/rules/token/strong-style.js.map +1 -0
- package/dist/rules/token/table-column-count.d.ts +3 -0
- package/dist/rules/token/table-column-count.d.ts.map +1 -0
- package/dist/rules/token/table-column-count.js +44 -0
- package/dist/rules/token/table-column-count.js.map +1 -0
- package/dist/rules/token/table-column-style.d.ts +3 -0
- package/dist/rules/token/table-column-style.d.ts.map +1 -0
- package/dist/rules/token/table-column-style.js +179 -0
- package/dist/rules/token/table-column-style.js.map +1 -0
- package/dist/rules/token/table-pipe-style.d.ts +3 -0
- package/dist/rules/token/table-pipe-style.d.ts.map +1 -0
- package/dist/rules/token/table-pipe-style.js +54 -0
- package/dist/rules/token/table-pipe-style.js.map +1 -0
- package/dist/rules/token/ul-indent.d.ts +3 -0
- package/dist/rules/token/ul-indent.d.ts.map +1 -0
- package/dist/rules/token/ul-indent.js +72 -0
- package/dist/rules/token/ul-indent.js.map +1 -0
- package/dist/rules/token/ul-style.d.ts +3 -0
- package/dist/rules/token/ul-style.d.ts.map +1 -0
- package/dist/rules/token/ul-style.js +80 -0
- package/dist/rules/token/ul-style.js.map +1 -0
- package/dist/rules/types.d.ts +81 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +2 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/rules/utils.d.ts +29 -0
- package/dist/rules/utils.d.ts.map +1 -0
- package/dist/{assertions → rules}/utils.js +27 -0
- package/dist/rules/utils.js.map +1 -0
- package/dist/scopes/extractor.d.ts +7 -0
- package/dist/scopes/extractor.d.ts.map +1 -0
- package/dist/scopes/extractor.js +475 -0
- package/dist/scopes/extractor.js.map +1 -0
- package/dist/scopes/selector.d.ts +51 -0
- package/dist/scopes/selector.d.ts.map +1 -0
- package/dist/scopes/selector.js +121 -0
- package/dist/scopes/selector.js.map +1 -0
- package/dist/scopes/sentences.d.ts +15 -0
- package/dist/scopes/sentences.d.ts.map +1 -0
- package/dist/scopes/sentences.js +124 -0
- package/dist/scopes/sentences.js.map +1 -0
- package/dist/scopes/types.d.ts +44 -0
- package/dist/scopes/types.d.ts.map +1 -0
- package/dist/scopes/types.js +2 -0
- package/dist/scopes/types.js.map +1 -0
- package/dist/scopes/vocabulary.d.ts +16 -0
- package/dist/scopes/vocabulary.d.ts.map +1 -0
- package/dist/scopes/vocabulary.js +70 -0
- package/dist/scopes/vocabulary.js.map +1 -0
- package/dist/types/assertions.d.ts +95 -32
- package/dist/types/assertions.d.ts.map +1 -1
- package/dist/types/problems.d.ts +4 -5
- package/dist/types/problems.d.ts.map +1 -1
- package/dist/types/rules.d.ts +4 -6
- package/dist/types/rules.d.ts.map +1 -1
- package/examples/appendices/google.appendix.yaml +91 -0
- package/examples/appendices/inclusive-language.appendix.yaml +61 -0
- package/examples/appendices/microsoft.appendix.yaml +99 -0
- package/examples/appendices/plain-language.appendix.yaml +88 -0
- package/examples/google.yaml +1525 -0
- package/examples/inclusive-language.yaml +304 -0
- package/examples/microsoft.yaml +1542 -0
- package/examples/plain-language.yaml +325 -0
- package/package.json +49 -16
- package/presets/google/PROVENANCE.md +1022 -0
- package/presets/google/sources.json +192 -0
- package/presets/inclusive-language/PROVENANCE.md +174 -0
- package/presets/inclusive-language/sources.json +107 -0
- package/presets/microsoft/PROVENANCE.md +1555 -0
- package/presets/microsoft/sources.json +494 -0
- package/presets/plain-language/PROVENANCE.md +364 -0
- package/presets/plain-language/sources.json +108 -0
- package/dist/assertions/bullet-style.d.ts +0 -3
- package/dist/assertions/bullet-style.d.ts.map +0 -1
- package/dist/assertions/bullet-style.js +0 -60
- package/dist/assertions/bullet-style.js.map +0 -1
- package/dist/assertions/index.d.ts +0 -21
- package/dist/assertions/index.d.ts.map +0 -1
- package/dist/assertions/index.js +0 -30
- package/dist/assertions/index.js.map +0 -1
- package/dist/assertions/max-image-size.d.ts +0 -3
- package/dist/assertions/max-image-size.d.ts.map +0 -1
- package/dist/assertions/max-image-size.js +0 -73
- package/dist/assertions/max-image-size.js.map +0 -1
- package/dist/assertions/max-line-length.d.ts +0 -3
- package/dist/assertions/max-line-length.d.ts.map +0 -1
- package/dist/assertions/max-line-length.js +0 -68
- package/dist/assertions/max-line-length.js.map +0 -1
- package/dist/assertions/no-broken-fragment-links.d.ts +0 -3
- package/dist/assertions/no-broken-fragment-links.d.ts.map +0 -1
- package/dist/assertions/no-broken-fragment-links.js +0 -79
- package/dist/assertions/no-broken-fragment-links.js.map +0 -1
- package/dist/assertions/no-duplicate-headings.d.ts +0 -3
- package/dist/assertions/no-duplicate-headings.d.ts.map +0 -1
- package/dist/assertions/no-duplicate-headings.js +0 -66
- package/dist/assertions/no-duplicate-headings.js.map +0 -1
- package/dist/assertions/no-hard-tabs.d.ts +0 -3
- package/dist/assertions/no-hard-tabs.d.ts.map +0 -1
- package/dist/assertions/no-hard-tabs.js +0 -63
- package/dist/assertions/no-hard-tabs.js.map +0 -1
- package/dist/assertions/no-trailing-spaces.d.ts +0 -3
- package/dist/assertions/no-trailing-spaces.d.ts.map +0 -1
- package/dist/assertions/no-trailing-spaces.js +0 -72
- package/dist/assertions/no-trailing-spaces.js.map +0 -1
- package/dist/assertions/pattern.d.ts +0 -3
- package/dist/assertions/pattern.d.ts.map +0 -1
- package/dist/assertions/pattern.js +0 -39
- package/dist/assertions/pattern.js.map +0 -1
- package/dist/assertions/semantic-line-breaks.d.ts +0 -3
- package/dist/assertions/semantic-line-breaks.d.ts.map +0 -1
- package/dist/assertions/semantic-line-breaks.js +0 -152
- package/dist/assertions/semantic-line-breaks.js.map +0 -1
- package/dist/assertions/swap.d.ts +0 -3
- package/dist/assertions/swap.d.ts.map +0 -1
- package/dist/assertions/swap.js +0 -39
- package/dist/assertions/swap.js.map +0 -1
- package/dist/assertions/utils.d.ts +0 -8
- package/dist/assertions/utils.d.ts.map +0 -1
- package/dist/assertions/utils.js.map +0 -1
- package/dist/core/scope-parser.d.ts +0 -26
- package/dist/core/scope-parser.d.ts.map +0 -1
- package/dist/core/scope-parser.js +0 -110
- package/dist/core/scope-parser.js.map +0 -1
- package/dist/files.d.ts +0 -2
- package/dist/files.d.ts.map +0 -1
- package/dist/files.js +0 -39
- package/dist/files.js.map +0 -1
- package/dist/load-config.d.ts +0 -25
- package/dist/load-config.d.ts.map +0 -1
- package/dist/load-config.js +0 -104
- package/dist/load-config.js.map +0 -1
- package/dist/load.d.ts +0 -25
- package/dist/load.d.ts.map +0 -1
- package/dist/load.js +0 -112
- package/dist/load.js.map +0 -1
- package/dist/scope.d.ts +0 -26
- package/dist/scope.d.ts.map +0 -1
- package/dist/scope.js +0 -110
- package/dist/scope.js.map +0 -1
- package/dist/types.d.ts +0 -109
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/validate.d.ts +0 -31
- package/dist/validate.d.ts.map +0 -1
- package/dist/validate.js +0 -154
- package/dist/validate.js.map +0 -1
- /package/dist/{types.js → parser/types.js} +0 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import type { Token, TokenTree } from '../../parser/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Adds a range of numbers (inclusive of both bounds) to a set.
|
|
4
|
+
*/
|
|
5
|
+
export declare function addRangeToSet(set: Set<number>, start: number, end: number): void;
|
|
6
|
+
/**
|
|
7
|
+
* A line/column range within a file (1-based, inclusive of both ends).
|
|
8
|
+
* Shares field names with `Token`'s start/end line/column so a `Token` can
|
|
9
|
+
* be passed directly wherever a `FileRange` is expected.
|
|
10
|
+
*/
|
|
11
|
+
export interface FileRange {
|
|
12
|
+
startLine: number;
|
|
13
|
+
startColumn: number;
|
|
14
|
+
endLine: number;
|
|
15
|
+
endColumn: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns whether two ranges (or Tokens) overlap anywhere. Ported from
|
|
19
|
+
* markdownlint's helpers/helpers.cjs `hasOverlap`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hasOverlap(rangeA: FileRange, rangeB: FileRange): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Filter a token tree, or an arbitrary token array (accepted so
|
|
24
|
+
* `blanksAroundLists`/MD032 can start the walk from `list.children`
|
|
25
|
+
* instead of the whole tree), by predicate — walking depth-first. Ported
|
|
26
|
+
* from upstream's `filterByPredicate(tokens, allowed, transformChildren)`:
|
|
27
|
+
* `transformChildren`, when given, replaces a token's own `children` array
|
|
28
|
+
* for traversal purposes only (the returned `result` array is unaffected) —
|
|
29
|
+
* upstream uses this to redirect traversal into htmlFlow subtokens, and
|
|
30
|
+
* MD032 uses it to stop descending into nested lists (so only *top-level*
|
|
31
|
+
* lists are returned) and to skip "non-content" token subtrees entirely.
|
|
32
|
+
* Omitting `transformChildren` walks every real child, matching every
|
|
33
|
+
* batch 1/2 caller's usage (none needed it before MD032).
|
|
34
|
+
*/
|
|
35
|
+
export declare function filterByPredicate(tree: TokenTree | Token[], predicate: (token: Token) => boolean, transformChildren?: (token: Token) => Token[]): Token[];
|
|
36
|
+
/**
|
|
37
|
+
* Gets a list of nested token descendants by type path. Each path element
|
|
38
|
+
* matches one depth of descent and may be a single type or (per upstream's
|
|
39
|
+
* own signature, `helpers/helpers.cjs`'s shared `getDescendantsByType`) an
|
|
40
|
+
* array of alternative types to match at that depth — used by batch 5's
|
|
41
|
+
* `link-image-style` (MD054) for `resourceDestination`'s
|
|
42
|
+
* literal/raw-destination split and `autolink`'s email/protocol split.
|
|
43
|
+
* Earlier batches (see `getHeadingText` below) predate this and call once
|
|
44
|
+
* per alternative instead, merging results themselves; both styles coexist
|
|
45
|
+
* since neither is wrong, but new callers needing an alternation can now
|
|
46
|
+
* use a single call.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getDescendantsByType(token: Token, typePath: readonly (string | readonly string[])[]): Token[];
|
|
49
|
+
/**
|
|
50
|
+
* Gets the nearest parent of one of the specified types for a token.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getParentOfType(token: Token, types: readonly string[]): Token | null;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the heading level of an atx or setext heading token. Matches
|
|
55
|
+
* upstream: looks for a direct child of type `atxHeadingSequence` or
|
|
56
|
+
* `setextHeadingLine` (the setext underline is a direct child of
|
|
57
|
+
* `setextHeading`, not nested further) and reads its level from the text.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getHeadingLevel(heading: Token): number;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the heading style of an atx or setext heading token: `'setext'` for
|
|
62
|
+
* setext headings, `'atx'` for a plain atx heading (one `atxHeadingSequence`
|
|
63
|
+
* child), or `'atx_closed'` for a closed atx heading (a trailing
|
|
64
|
+
* `atxHeadingSequence` closing marker as a second direct-child sequence).
|
|
65
|
+
*/
|
|
66
|
+
export declare function getHeadingStyle(heading: Token): 'setext' | 'atx' | 'atx_closed';
|
|
67
|
+
/**
|
|
68
|
+
* Gets the heading text of an atx or setext heading token. Descends into
|
|
69
|
+
* `atxHeadingText`/`setextHeadingText` (nested arbitrarily deep under the
|
|
70
|
+
* heading, e.g. inside inline containers) and concatenates all non-htmlText
|
|
71
|
+
* descendant text, collapsing internal newlines (setext headings can span
|
|
72
|
+
* multiple lines) to single spaces.
|
|
73
|
+
*/
|
|
74
|
+
export declare function getHeadingText(heading: Token): string;
|
|
75
|
+
/**
|
|
76
|
+
* Gets the blockquote prefix text (if any) for the specified line number,
|
|
77
|
+
* e.g. `"> "` for a line inside a single-level blockquote. Upstream filters
|
|
78
|
+
* a flat token list by type via `filterByTypes`; Recheck's `TokenTree`
|
|
79
|
+
* already carries a flat list (`tree.flat`), so this takes the tree
|
|
80
|
+
* directly rather than a pre-filtered token array.
|
|
81
|
+
*/
|
|
82
|
+
export declare function getBlockQuotePrefixText(tree: TokenTree, lineNumber: number, count?: number): string;
|
|
83
|
+
/**
|
|
84
|
+
* Returns true iff the input line is blank (contains nothing, whitespace,
|
|
85
|
+
* blockquote markers, or HTML comments (unclosed start/end comments
|
|
86
|
+
* allowed)). Ported from markdownlint's helpers/helpers.cjs `isBlankLine`.
|
|
87
|
+
*/
|
|
88
|
+
export declare function isBlankLine(line: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Set of token types that do not contain document content (used to skip
|
|
91
|
+
* over "non-content" tokens — indentation, blank lines, container prefixes
|
|
92
|
+
* — when scanning for a document's first meaningful token). Ported from
|
|
93
|
+
* markdownlint's helpers/micromark-helpers.cjs `nonContentTokens`.
|
|
94
|
+
*/
|
|
95
|
+
export declare const nonContentTokens: Set<string>;
|
|
96
|
+
/**
|
|
97
|
+
* Returns the last line number (1-based, inclusive) of the document's YAML
|
|
98
|
+
* frontmatter block, or 0 if there is none.
|
|
99
|
+
*
|
|
100
|
+
* Upstream markdownlint slices frontmatter out of `content` entirely
|
|
101
|
+
* before tokenizing (see markdownlint's `removeFrontMatter`) — every
|
|
102
|
+
* rule's `params.lines`/token stream is already frontmatter-free, with
|
|
103
|
+
* `frontMatterLines.length` added back only when reporting an error's line
|
|
104
|
+
* number. Recheck's parser instead keeps a `yaml` token (and all its
|
|
105
|
+
* descendant tokens — `yamlFence`, `yamlValue`, etc. — individually
|
|
106
|
+
* present in `tree.flat`, a full depth-first flattening) as real content.
|
|
107
|
+
* Rules that scan `ctx.lines` by index, or walk `ctx.tree.flat` from the
|
|
108
|
+
* top of the document looking for the first "real" token, must skip every
|
|
109
|
+
* line up to and including this one to match upstream's behavior — see
|
|
110
|
+
* first-line-h1.ts, single-h1.ts, and line-length.ts for call sites.
|
|
111
|
+
*/
|
|
112
|
+
export declare function getFrontmatterEndLine(tree: TokenTree): number;
|
|
113
|
+
/**
|
|
114
|
+
* Returns true iff the document's YAML front matter contains a title — i.e.
|
|
115
|
+
* the `pattern` regex matches at least one of the front matter block's lines.
|
|
116
|
+
*
|
|
117
|
+
* WHY THIS EXISTS: it ports upstream markdownlint's `front_matter_title`
|
|
118
|
+
* rule option (implemented there by helpers/helpers.cjs's own
|
|
119
|
+
* `frontMatterHasTitle`), which exists on exactly three upstream rules —
|
|
120
|
+
* MD001 (our heading-increment), MD025 (single-h1), and MD041
|
|
121
|
+
* (first-line-h1); see
|
|
122
|
+
* https://github.com/DavidAnson/markdownlint/blob/main/doc/md001.md.
|
|
123
|
+
* When the front matter declares a title, it counts as the document's
|
|
124
|
+
* implicit top-level (h1) heading:
|
|
125
|
+
* - heading-increment then expects the first body heading to be an h2;
|
|
126
|
+
* - single-h1 treats it as the document's one H1, so EVERY body h1 is a
|
|
127
|
+
* violation;
|
|
128
|
+
* - first-line-h1 is satisfied by it outright and checks nothing else.
|
|
129
|
+
*
|
|
130
|
+
* The default pattern is `^\s*"?title"?\s*[:=]`: a `title` key, optionally
|
|
131
|
+
* double-quoted, followed by `:` (YAML) or `=` (TOML-style front matter),
|
|
132
|
+
* matched case-insensitively. Each of the three rules declares that default
|
|
133
|
+
* in its own `defaults` object — exactly as each upstream rule declares its
|
|
134
|
+
* own default — and this helper only encapsulates the matching.
|
|
135
|
+
*
|
|
136
|
+
* CONTRACT: `pattern` is the raw config value (`ctx.config.frontMatterTitle`);
|
|
137
|
+
* configuring the empty string `''` (or a nullish value) disables the
|
|
138
|
+
* behavior entirely — this helper then always returns false — matching
|
|
139
|
+
* upstream's documented "specify `""` for `front_matter_title`" opt-out.
|
|
140
|
+
*
|
|
141
|
+
* Upstream builds the regex with the `i` flag only and tests it against each
|
|
142
|
+
* front matter LINE individually (`frontMatterLines.some(...)`), where
|
|
143
|
+
* `frontMatterLines` is the whole regex-matched front matter block —
|
|
144
|
+
* INCLUDING both delimiter fence lines — split on line endings (see
|
|
145
|
+
* markdownlint's `removeFrontMatter`). Recheck's parser keeps that same
|
|
146
|
+
* block as one `yaml` token (see getFrontmatterEndLine's doc comment above)
|
|
147
|
+
* whose text spans opening fence through closing fence with no trailing
|
|
148
|
+
* newline, so splitting it on `newLineRe` reproduces upstream's lines
|
|
149
|
+
* exactly, and the regex is tested per line here too. (Testing the whole
|
|
150
|
+
* block with `im` instead is NOT equivalent: a custom pattern containing a
|
|
151
|
+
* literal `\n`, or one where `\s*`/`[\s\S]*` can absorb a line ending —
|
|
152
|
+
* e.g. `author:.*\s*title` — would match across lines, which upstream
|
|
153
|
+
* never does.)
|
|
154
|
+
*/
|
|
155
|
+
export declare function frontMatterHasTitle(tree: TokenTree, pattern: unknown): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Returns true iff the token is an HTML comment (`<!-- ... -->`) that is
|
|
158
|
+
* valid per the CommonMark spec (comment body doesn't start with `>` or
|
|
159
|
+
* `->`, and doesn't end with `-`). Ported from markdownlint's
|
|
160
|
+
* helpers/micromark-helpers.cjs `isHtmlFlowComment`.
|
|
161
|
+
*/
|
|
162
|
+
export declare function isHtmlFlowComment(token: Token): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Replaces the content of valid CommonMark HTML comments with the `.`
|
|
165
|
+
* "safe" character, preserving every line/column position in the rest of
|
|
166
|
+
* the document (never removes characters, never touches `\r`/`\n`).
|
|
167
|
+
* Ported from markdownlint's helpers/helpers.cjs `clearHtmlCommentText`.
|
|
168
|
+
*
|
|
169
|
+
* This is upstream's OWN pre-processing pass -- run once, globally, before
|
|
170
|
+
* `params.lines` is computed -- so that rules doing plain text/line
|
|
171
|
+
* scanning (as opposed to token-tree scanning) never see real content
|
|
172
|
+
* inside an HTML comment: trailing whitespace inside a comment isn't
|
|
173
|
+
* "trailing whitespace" (MD009), a tab inside a comment isn't a "hard
|
|
174
|
+
* tab" (MD010), reversed-link syntax inside a comment isn't a broken link
|
|
175
|
+
* (MD011), etc. Token-tree-based scanning (e.g. MD033/MD037, which read
|
|
176
|
+
* `params.parsers.micromark.tokens`) is unaffected -- those tokens are
|
|
177
|
+
* built from the ORIGINAL, uncleared content upstream, matching how
|
|
178
|
+
* recheck's own token tree (`ctx.tree`) is never cleared either; only
|
|
179
|
+
* `ctx.lines` (see core/runner.ts) uses this cleared text.
|
|
180
|
+
*/
|
|
181
|
+
export declare function clearHtmlCommentText(text: string): string;
|
|
182
|
+
/**
|
|
183
|
+
* Returns true iff the heading is a DocFX tab heading (an atx heading whose
|
|
184
|
+
* entire text is a single link with a `#tab/...` destination) — see
|
|
185
|
+
* https://dotnet.github.io/docfx/docs/markdown.html?tabs=linux%2Cdotnet#tabs.
|
|
186
|
+
* Ported from markdownlint's helpers/micromark-helpers.cjs `isDocfxTab`.
|
|
187
|
+
*/
|
|
188
|
+
export declare const endOfLineHtmlEntityRe: RegExp;
|
|
189
|
+
export declare const endOfLineGemojiCodeRe: RegExp;
|
|
190
|
+
export declare const allPunctuation = ".,;:!?\u3002\uFF0C\uFF1B\uFF1A\uFF01\uFF1F";
|
|
191
|
+
export declare const allPunctuationNoQuestion: string;
|
|
192
|
+
/**
|
|
193
|
+
* Escapes a string for safe use inside a RegExp character class/pattern.
|
|
194
|
+
* Ported from markdownlint's helpers/helpers.cjs `escapeForRegExp`.
|
|
195
|
+
*/
|
|
196
|
+
export declare function escapeForRegExp(str: string): string;
|
|
197
|
+
/**
|
|
198
|
+
* Replaces lone (unpaired) surrogate code units with U+FFFD, matching the
|
|
199
|
+
* behavior of `String.prototype.toWellFormed()` (ES2024). Recheck's
|
|
200
|
+
* `tsconfig.json` targets ES2021 (shared across the whole package, not
|
|
201
|
+
* something this rule port should widen), so `link-fragments` (MD051) —
|
|
202
|
+
* the only upstream rule using `.toWellFormed()` (on heading/fragment text
|
|
203
|
+
* before `encodeURIComponent`, which throws on lone surrogates) — calls
|
|
204
|
+
* this instead of the native method.
|
|
205
|
+
*/
|
|
206
|
+
export declare function toWellFormedString(str: string): string;
|
|
207
|
+
/**
|
|
208
|
+
* HTML tag information: whether it's a closing tag and its (lowercased-by-
|
|
209
|
+
* caller-if-needed) name. Ported from markdownlint's
|
|
210
|
+
* helpers/micromark-helpers.cjs `getHtmlTagInfo`.
|
|
211
|
+
*/
|
|
212
|
+
export interface HtmlTagInfo {
|
|
213
|
+
close: boolean;
|
|
214
|
+
name: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Gets information about the tag in an HTML token (an `htmlText` token's
|
|
218
|
+
* opening `<tag ...>` or closing `</tag>`), or `null` if the token's text
|
|
219
|
+
* doesn't start with a recognizable tag (e.g. an HTML comment). Ported from
|
|
220
|
+
* markdownlint's helpers/micromark-helpers.cjs `getHtmlTagInfo`.
|
|
221
|
+
*/
|
|
222
|
+
export declare function getHtmlTagInfo(token: Token): HtmlTagInfo | null;
|
|
223
|
+
/**
|
|
224
|
+
* Builds a RegExp for matching the specified HTML attribute (e.g. `alt=`,
|
|
225
|
+
* `id=`) within a raw HTML tag's text, capturing its (optionally quoted)
|
|
226
|
+
* value. Ported from markdownlint's helpers/helpers.cjs `getHtmlAttributeRe`.
|
|
227
|
+
*/
|
|
228
|
+
export declare function getHtmlAttributeRe(name: string): RegExp;
|
|
229
|
+
/**
|
|
230
|
+
* Truncates long text for use in error context, keeping the start, end, or
|
|
231
|
+
* both ends depending on which end(s) matter. Ported from markdownlint's
|
|
232
|
+
* helpers/helpers.cjs `ellipsify`.
|
|
233
|
+
*/
|
|
234
|
+
export declare function ellipsify(text: string, start?: boolean, end?: boolean): string;
|
|
235
|
+
export declare function isDocfxTab(heading: Token | null | undefined): boolean;
|
|
236
|
+
export declare function normalizeReference(s: string): string;
|
|
237
|
+
/** One usage site of a reference/shortcut label: `[lineIndex, columnIndex, length]` (0-based line/column), matching upstream's `number[][]` shape exactly so MD052's line/column math ports verbatim. */
|
|
238
|
+
export type ReferenceDatum = [lineIndex: number, columnIndex: number, length: number];
|
|
239
|
+
export interface GetReferenceLinkImageDataResult {
|
|
240
|
+
/** Normalized label -> usage sites, for "full"/"collapsed" reference syntax (`[text][label]`, `[label][]`). */
|
|
241
|
+
references: Map<string, ReferenceDatum[]>;
|
|
242
|
+
/** Normalized label -> usage sites, for "shortcut" syntax (`[label]`) and footnote calls (`[^label]`). */
|
|
243
|
+
shortcuts: Map<string, ReferenceDatum[]>;
|
|
244
|
+
/** Normalized label -> `[lineIndex, destinationText]` for each `[label]: destination` (or footnote `[^label]: ...`) definition. */
|
|
245
|
+
definitions: Map<string, [number, string]>;
|
|
246
|
+
/** `[label, lineIndex]` for each definition after the first one seen for that label. */
|
|
247
|
+
duplicateDefinitions: [string, number][];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Returns information about reference-style links/images and their
|
|
251
|
+
* definitions across the whole document: which labels are defined, which
|
|
252
|
+
* are used (split into "full/collapsed" `references` vs "shortcut"
|
|
253
|
+
* `shortcuts`, since shortcut syntax is ambiguous with plain bracketed
|
|
254
|
+
* text), and which definitions are duplicates. Ported from markdownlint's
|
|
255
|
+
* helpers/helpers.cjs `getReferenceLinkImageData` (there, cached per-lint-
|
|
256
|
+
* run by lib/cache.mjs; Recheck's token rules have no shared per-run cache
|
|
257
|
+
* — see no-empty-links.ts's doc comment for the established precedent — so
|
|
258
|
+
* each of MD051/052/053/054 calls this fresh over the same tree).
|
|
259
|
+
*
|
|
260
|
+
* DEVIATION: upstream additionally detects reference syntax that fails to
|
|
261
|
+
* resolve to any definition at all (`undefinedReferenceShortcut/Collapsed/
|
|
262
|
+
* Full`) by monkeypatching micromark's internal `labelEnd` tokenizer
|
|
263
|
+
* (lib/micromark-parse.mjs) to synthesize tokens when label resolution
|
|
264
|
+
* backtracks to failure. Recheck's parser (src/parser/index.ts) is a much
|
|
265
|
+
* thinner micromark wrapper with no equivalent hook, and reproducing that
|
|
266
|
+
* shim correctly is a parser-level change out of scope for a rule port.
|
|
267
|
+
* Without it, an *undefined* reference/shortcut never becomes a `link`/
|
|
268
|
+
* `image`/`gfmFootnoteCall` token in Recheck's tree in the first place —
|
|
269
|
+
* it decomposes into plain `data` tokens — so there is no token for this
|
|
270
|
+
* function to inspect for that case via the token-shape path alone.
|
|
271
|
+
* `scanUndefinedReferences` below is a conservative, best-effort text-scan
|
|
272
|
+
* fallback (restricted to direct `data`/`lineEnding` children of a single
|
|
273
|
+
* container, requiring non-nested single-bracket-depth text with no `]`
|
|
274
|
+
* inside — mirroring the upstream shim's own `!text.includes("]")` guard)
|
|
275
|
+
* so MD052 (whose entire purpose is detecting undefined references) is not
|
|
276
|
+
* a permanent no-op; it is not a byte-for-byte port of the shim and may
|
|
277
|
+
* miss or mis-slice pathological/multi-line cases the real shim handles
|
|
278
|
+
* via micromark's own backtracking state. MD053's `duplicateDefinitions`/
|
|
279
|
+
* `definitions` and MD054's `definitions` lookups don't depend on this
|
|
280
|
+
* fallback at all (they only need successfully-resolved usages), so this
|
|
281
|
+
* deviation is fully scoped to MD052.
|
|
282
|
+
*/
|
|
283
|
+
export declare function getReferenceLinkImageData(tree: TokenTree): GetReferenceLinkImageDataResult;
|
|
284
|
+
export interface ImageDestination {
|
|
285
|
+
/** The `image` token itself — use its position/text for reporting. */
|
|
286
|
+
token: Token;
|
|
287
|
+
/**
|
|
288
|
+
* The image's destination exactly as written in the source: either the
|
|
289
|
+
* inline `(path "title")` destination (raw or angle-bracket literal), or
|
|
290
|
+
* the resolved reference/collapsed/shortcut definition's destination.
|
|
291
|
+
*/
|
|
292
|
+
destination: string;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Resolves every `image` token in the tree to its destination path/URL —
|
|
296
|
+
* both inline syntax (``, including angle-bracket
|
|
297
|
+
* literal destinations) and reference syntax (`![alt][ref]`, `![alt][]`,
|
|
298
|
+
* `![alt]`), the latter resolved through `getReferenceLinkImageData`'s
|
|
299
|
+
* `definitions` map the same way `link-image-style.ts` (MD054) resolves a
|
|
300
|
+
* reference link/image's destination for its autolink-eligibility check.
|
|
301
|
+
* An image whose reference never resolves to a definition never becomes an
|
|
302
|
+
* `image` token in the first place (see `getReferenceLinkImageData`'s
|
|
303
|
+
* DEVIATION note above) — there's no token to report for those here,
|
|
304
|
+
* matching every other AST-based rule's treatment of the same tree.
|
|
305
|
+
*
|
|
306
|
+
* Shared by `rules/scope/max-image-size.ts` (the rule that flags oversized
|
|
307
|
+
* images) and `core/files.ts`'s `extractImageReferences` (the on-disk
|
|
308
|
+
* metadata loader): a single extraction pass so both sides always agree on
|
|
309
|
+
* exactly which destination string keys a given image's on-disk stats in
|
|
310
|
+
* `ScopeRuleContext.fileMetadata.images`.
|
|
311
|
+
*/
|
|
312
|
+
export declare function getImageDestinations(tree: TokenTree): ImageDestination[];
|
|
313
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/rules/token/helpers.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAIhF;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB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