@redocly/recheck 0.14.0 → 2.58.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 +71 -1869
- package/examples/appendices/google.appendix.yaml +1 -1
- package/examples/appendices/inclusive-language.appendix.yaml +1 -1
- package/examples/appendices/microsoft.appendix.yaml +1 -1
- package/examples/appendices/plain-language.appendix.yaml +1 -1
- package/examples/appendices/technical-english.appendix.yaml +1 -1
- package/examples/google.yaml +7 -7
- package/examples/inclusive-language.yaml +7 -7
- package/examples/microsoft.yaml +7 -7
- package/examples/plain-language.yaml +7 -7
- package/examples/technical-english.yaml +7 -7
- package/lib/actions/baseline.d.ts +15 -0
- package/lib/actions/baseline.d.ts.map +1 -0
- package/lib/actions/baseline.js +51 -0
- package/lib/actions/baseline.js.map +1 -0
- package/lib/actions/lint.d.ts +51 -0
- package/lib/actions/lint.d.ts.map +1 -0
- package/lib/actions/lint.js +123 -0
- package/lib/actions/lint.js.map +1 -0
- package/lib/actions/markdoc-schema.d.ts +34 -0
- package/lib/actions/markdoc-schema.d.ts.map +1 -0
- package/lib/actions/markdoc-schema.js +106 -0
- package/lib/actions/markdoc-schema.js.map +1 -0
- package/lib/actions/readability.d.ts +25 -0
- package/lib/actions/readability.d.ts.map +1 -0
- package/lib/actions/readability.js +47 -0
- package/lib/actions/readability.js.map +1 -0
- package/lib/actions/roots.d.ts +7 -0
- package/lib/actions/roots.d.ts.map +1 -0
- package/lib/actions/roots.js +36 -0
- package/lib/actions/roots.js.map +1 -0
- package/lib/config/presets/api-descriptions.d.ts +8 -0
- package/lib/config/presets/api-descriptions.d.ts.map +1 -0
- package/lib/config/presets/api-descriptions.js +24 -0
- package/lib/config/presets/api-descriptions.js.map +1 -0
- package/lib/config/presets/google.d.ts +3 -0
- package/lib/config/presets/google.d.ts.map +1 -0
- package/lib/config/presets/google.js +1086 -0
- package/lib/config/presets/google.js.map +1 -0
- package/lib/config/presets/inclusive-language.d.ts +3 -0
- package/lib/config/presets/inclusive-language.d.ts.map +1 -0
- package/lib/config/presets/inclusive-language.js +151 -0
- package/lib/config/presets/inclusive-language.js.map +1 -0
- package/lib/config/presets/index.d.ts +16 -0
- package/lib/config/presets/index.d.ts.map +1 -0
- package/lib/config/presets/index.js +38 -0
- package/lib/config/presets/index.js.map +1 -0
- package/lib/config/presets/markdoc.d.ts +3 -0
- package/lib/config/presets/markdoc.d.ts.map +1 -0
- package/lib/config/presets/markdoc.js +45 -0
- package/lib/config/presets/markdoc.js.map +1 -0
- package/lib/config/presets/markdown-relaxed.d.ts +3 -0
- package/lib/config/presets/markdown-relaxed.d.ts.map +1 -0
- package/lib/config/presets/markdown-relaxed.js +34 -0
- package/lib/config/presets/markdown-relaxed.js.map +1 -0
- package/lib/config/presets/markdown.d.ts +11 -0
- package/lib/config/presets/markdown.d.ts.map +1 -0
- package/lib/config/presets/markdown.js +73 -0
- package/lib/config/presets/markdown.js.map +1 -0
- package/lib/config/presets/microsoft.d.ts +3 -0
- package/lib/config/presets/microsoft.d.ts.map +1 -0
- package/lib/config/presets/microsoft.js +1260 -0
- package/lib/config/presets/microsoft.js.map +1 -0
- package/lib/config/presets/minimal.d.ts +3 -0
- package/lib/config/presets/minimal.d.ts.map +1 -0
- package/lib/config/presets/minimal.js +13 -0
- package/lib/config/presets/minimal.js.map +1 -0
- package/lib/config/presets/plain-language.d.ts +3 -0
- package/lib/config/presets/plain-language.d.ts.map +1 -0
- package/lib/config/presets/plain-language.js +175 -0
- package/lib/config/presets/plain-language.js.map +1 -0
- package/lib/config/presets/prose.d.ts +3 -0
- package/lib/config/presets/prose.d.ts.map +1 -0
- package/lib/config/presets/prose.js +60 -0
- package/lib/config/presets/prose.js.map +1 -0
- package/lib/config/presets/technical-english.d.ts +22 -0
- package/lib/config/presets/technical-english.d.ts.map +1 -0
- package/lib/config/presets/technical-english.js +61 -0
- package/lib/config/presets/technical-english.js.map +1 -0
- package/lib/config/resolve.d.ts +36 -0
- package/lib/config/resolve.d.ts.map +1 -0
- package/lib/config/resolve.js +106 -0
- package/lib/config/resolve.js.map +1 -0
- package/lib/config/schema.d.ts +215 -0
- package/lib/config/schema.d.ts.map +1 -0
- package/lib/config/schema.js +152 -0
- package/lib/config/schema.js.map +1 -0
- package/lib/config/validate.d.ts +19 -0
- package/lib/config/validate.d.ts.map +1 -0
- package/lib/config/validate.js +1049 -0
- package/lib/config/validate.js.map +1 -0
- package/lib/core/auto-fix.d.ts.map +1 -0
- package/lib/core/auto-fix.js +94 -0
- package/lib/core/auto-fix.js.map +1 -0
- package/lib/core/baseline.d.ts +43 -0
- package/lib/core/baseline.d.ts.map +1 -0
- package/lib/core/baseline.js +142 -0
- package/lib/core/baseline.js.map +1 -0
- package/lib/core/case-preserve.d.ts +11 -0
- package/lib/core/case-preserve.d.ts.map +1 -0
- package/lib/core/case-preserve.js +22 -0
- package/lib/core/case-preserve.js.map +1 -0
- package/lib/core/directives.d.ts.map +1 -0
- package/lib/core/directives.js +66 -0
- package/lib/core/directives.js.map +1 -0
- package/lib/core/files.d.ts +31 -0
- package/lib/core/files.d.ts.map +1 -0
- package/lib/core/files.js +184 -0
- package/lib/core/files.js.map +1 -0
- package/lib/core/inline-code.d.ts +33 -0
- package/lib/core/inline-code.d.ts.map +1 -0
- package/lib/core/inline-code.js +50 -0
- package/lib/core/inline-code.js.map +1 -0
- package/lib/core/line-endings.d.ts +13 -0
- package/lib/core/line-endings.d.ts.map +1 -0
- package/lib/core/line-endings.js +39 -0
- package/lib/core/line-endings.js.map +1 -0
- package/lib/core/markdoc-tags.d.ts +48 -0
- package/lib/core/markdoc-tags.d.ts.map +1 -0
- package/lib/core/markdoc-tags.js +102 -0
- package/lib/core/markdoc-tags.js.map +1 -0
- package/lib/core/prose-extract.d.ts +6 -0
- package/lib/core/prose-extract.d.ts.map +1 -0
- package/lib/core/prose-extract.js +71 -0
- package/lib/core/prose-extract.js.map +1 -0
- package/lib/core/readability.d.ts +17 -0
- package/lib/core/readability.d.ts.map +1 -0
- package/lib/core/readability.js +34 -0
- package/lib/core/readability.js.map +1 -0
- package/lib/core/rule-filters.d.ts +29 -0
- package/lib/core/rule-filters.d.ts.map +1 -0
- package/lib/core/rule-filters.js +88 -0
- package/lib/core/rule-filters.js.map +1 -0
- package/lib/core/runner.d.ts +60 -0
- package/lib/core/runner.d.ts.map +1 -0
- package/lib/core/runner.js +305 -0
- package/lib/core/runner.js.map +1 -0
- package/lib/core/summary.d.ts +4 -0
- package/lib/core/summary.d.ts.map +1 -0
- package/lib/core/summary.js +37 -0
- package/lib/core/summary.js.map +1 -0
- package/lib/core/timing.d.ts +9 -0
- package/lib/core/timing.d.ts.map +1 -0
- package/lib/core/timing.js +19 -0
- package/lib/core/timing.js.map +1 -0
- package/lib/data/markdoc-realm-schema.d.ts.map +1 -0
- package/lib/data/markdoc-realm-schema.js +782 -0
- package/lib/data/markdoc-realm-schema.js.map +1 -0
- package/lib/data/proper-nouns.d.ts.map +1 -0
- package/lib/data/proper-nouns.js +42 -0
- package/lib/data/proper-nouns.js.map +1 -0
- package/lib/data/realm-front-matter-schema.d.ts +12 -0
- package/lib/data/realm-front-matter-schema.d.ts.map +1 -0
- package/lib/data/realm-front-matter-schema.js +51 -0
- package/lib/data/realm-front-matter-schema.js.map +1 -0
- package/lib/index.d.ts +81 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +114 -0
- package/lib/index.js.map +1 -0
- package/lib/metrics/formulas.d.ts +9 -0
- package/lib/metrics/formulas.d.ts.map +1 -0
- package/lib/metrics/formulas.js +59 -0
- package/lib/metrics/formulas.js.map +1 -0
- package/lib/metrics/statistics.d.ts +14 -0
- package/lib/metrics/statistics.d.ts.map +1 -0
- package/lib/metrics/statistics.js +35 -0
- package/lib/metrics/statistics.js.map +1 -0
- package/lib/parser/index.d.ts +13 -0
- package/lib/parser/index.d.ts.map +1 -0
- package/lib/parser/index.js +123 -0
- package/lib/parser/index.js.map +1 -0
- package/lib/parser/markdoc/extract-statics.d.ts +28 -0
- package/lib/parser/markdoc/extract-statics.d.ts.map +1 -0
- package/lib/parser/markdoc/extract-statics.js +80 -0
- package/lib/parser/markdoc/extract-statics.js.map +1 -0
- package/lib/parser/markdoc/pairing.d.ts +38 -0
- package/lib/parser/markdoc/pairing.d.ts.map +1 -0
- package/lib/parser/markdoc/pairing.js +77 -0
- package/lib/parser/markdoc/pairing.js.map +1 -0
- package/lib/parser/markdoc/schema.d.ts +56 -0
- package/lib/parser/markdoc/schema.d.ts.map +1 -0
- package/lib/parser/markdoc/schema.js +60 -0
- package/lib/parser/markdoc/schema.js.map +1 -0
- package/lib/parser/markdoc/span.d.ts +52 -0
- package/lib/parser/markdoc/span.d.ts.map +1 -0
- package/lib/parser/markdoc/span.js +577 -0
- package/lib/parser/markdoc/span.js.map +1 -0
- package/lib/parser/markdoc/structure.d.ts +17 -0
- package/lib/parser/markdoc/structure.d.ts.map +1 -0
- package/lib/parser/markdoc/structure.js +121 -0
- package/lib/parser/markdoc/structure.js.map +1 -0
- package/lib/parser/markdoc/syntax.d.ts +17 -0
- package/lib/parser/markdoc/syntax.d.ts.map +1 -0
- package/lib/parser/markdoc/syntax.js +262 -0
- package/lib/parser/markdoc/syntax.js.map +1 -0
- package/lib/parser/types.d.ts.map +1 -0
- package/lib/presets.d.ts +6 -0
- package/lib/presets.d.ts.map +1 -0
- package/lib/presets.js +12 -0
- package/lib/presets.js.map +1 -0
- package/lib/rules/registry.d.ts +13 -0
- package/lib/rules/registry.d.ts.map +1 -0
- package/lib/rules/registry.js +54 -0
- package/lib/rules/registry.js.map +1 -0
- package/lib/rules/scope/capitalization.d.ts.map +1 -0
- package/lib/rules/scope/capitalization.js +128 -0
- package/lib/rules/scope/capitalization.js.map +1 -0
- package/lib/rules/scope/conditional.d.ts.map +1 -0
- package/lib/rules/scope/conditional.js +93 -0
- package/lib/rules/scope/conditional.js.map +1 -0
- package/lib/rules/scope/consistency.d.ts.map +1 -0
- package/lib/rules/scope/consistency.js +118 -0
- package/lib/rules/scope/consistency.js.map +1 -0
- package/lib/rules/scope/length.d.ts.map +1 -0
- package/lib/rules/scope/length.js +50 -0
- package/lib/rules/scope/length.js.map +1 -0
- package/lib/rules/scope/max-image-size.d.ts.map +1 -0
- package/lib/rules/scope/max-image-size.js +55 -0
- package/lib/rules/scope/max-image-size.js.map +1 -0
- package/lib/rules/scope/metric.d.ts +3 -0
- package/lib/rules/scope/metric.d.ts.map +1 -0
- package/lib/rules/scope/metric.js +59 -0
- package/lib/rules/scope/metric.js.map +1 -0
- package/lib/rules/scope/occurrence.d.ts.map +1 -0
- package/lib/rules/scope/occurrence.js +41 -0
- package/lib/rules/scope/occurrence.js.map +1 -0
- package/lib/rules/scope/pattern.d.ts.map +1 -0
- package/lib/rules/scope/pattern.js +58 -0
- package/lib/rules/scope/pattern.js.map +1 -0
- package/lib/rules/scope/repetition.d.ts.map +1 -0
- package/lib/rules/scope/repetition.js +134 -0
- package/lib/rules/scope/repetition.js.map +1 -0
- package/lib/rules/scope/semantic-line-breaks.d.ts.map +1 -0
- package/lib/rules/scope/semantic-line-breaks.js +180 -0
- package/lib/rules/scope/semantic-line-breaks.js.map +1 -0
- package/lib/rules/scope/spelling.d.ts +11 -0
- package/lib/rules/scope/spelling.d.ts.map +1 -0
- package/lib/rules/scope/spelling.js +146 -0
- package/lib/rules/scope/spelling.js.map +1 -0
- package/lib/rules/scope/swap.d.ts.map +1 -0
- package/lib/rules/scope/swap.js +111 -0
- package/lib/rules/scope/swap.js.map +1 -0
- package/lib/rules/scope/title-case.d.ts +24 -0
- package/lib/rules/scope/title-case.d.ts.map +1 -0
- package/lib/rules/scope/title-case.js +216 -0
- package/lib/rules/scope/title-case.js.map +1 -0
- package/lib/rules/token/blanks-around-fences.d.ts.map +1 -0
- package/lib/rules/token/blanks-around-fences.js.map +1 -0
- package/lib/rules/token/blanks-around-headings.d.ts.map +1 -0
- package/lib/rules/token/blanks-around-headings.js +96 -0
- package/lib/rules/token/blanks-around-headings.js.map +1 -0
- package/lib/rules/token/blanks-around-lists.d.ts.map +1 -0
- package/lib/rules/token/blanks-around-lists.js +48 -0
- package/lib/rules/token/blanks-around-lists.js.map +1 -0
- package/lib/rules/token/blanks-around-tables.d.ts.map +1 -0
- package/lib/rules/token/blanks-around-tables.js +40 -0
- package/lib/rules/token/blanks-around-tables.js.map +1 -0
- package/lib/rules/token/code-block-style.d.ts.map +1 -0
- package/lib/rules/token/code-block-style.js.map +1 -0
- package/lib/rules/token/code-fence-style.d.ts.map +1 -0
- package/lib/rules/token/code-fence-style.js.map +1 -0
- package/lib/rules/token/commands-show-output.d.ts.map +1 -0
- package/lib/rules/token/commands-show-output.js.map +1 -0
- package/lib/rules/token/descriptive-link-text.d.ts.map +1 -0
- package/lib/rules/token/descriptive-link-text.js +46 -0
- package/lib/rules/token/descriptive-link-text.js.map +1 -0
- package/lib/rules/token/fenced-code-language.d.ts.map +1 -0
- package/lib/rules/token/fenced-code-language.js.map +1 -0
- package/lib/rules/token/first-line-h1.d.ts.map +1 -0
- package/lib/rules/token/first-line-h1.js +83 -0
- package/lib/rules/token/first-line-h1.js.map +1 -0
- package/lib/rules/token/front-matter.d.ts.map +1 -0
- package/lib/rules/token/front-matter.js +169 -0
- package/lib/rules/token/front-matter.js.map +1 -0
- package/lib/rules/token/heading-increment.d.ts.map +1 -0
- package/lib/rules/token/heading-increment.js +26 -0
- package/lib/rules/token/heading-increment.js.map +1 -0
- package/lib/rules/token/heading-start-left.d.ts.map +1 -0
- package/lib/rules/token/heading-start-left.js.map +1 -0
- package/lib/rules/token/heading-style.d.ts.map +1 -0
- package/lib/rules/token/heading-style.js.map +1 -0
- package/lib/rules/token/helpers.d.ts +115 -0
- package/lib/rules/token/helpers.d.ts.map +1 -0
- package/lib/rules/token/helpers.js +502 -0
- package/lib/rules/token/helpers.js.map +1 -0
- package/lib/rules/token/hr-style.d.ts.map +1 -0
- package/lib/rules/token/hr-style.js.map +1 -0
- package/lib/rules/token/index.d.ts +65 -0
- package/lib/rules/token/index.d.ts.map +1 -0
- package/lib/rules/token/index.js +157 -0
- package/lib/rules/token/index.js.map +1 -0
- package/lib/rules/token/line-length.d.ts.map +1 -0
- package/lib/rules/token/line-length.js +96 -0
- package/lib/rules/token/line-length.js.map +1 -0
- package/lib/rules/token/link-fragments.d.ts.map +1 -0
- package/lib/rules/token/link-fragments.js +398 -0
- package/lib/rules/token/link-fragments.js.map +1 -0
- package/lib/rules/token/link-image-reference-definitions.d.ts.map +1 -0
- package/lib/rules/token/link-image-reference-definitions.js.map +1 -0
- package/lib/rules/token/link-image-style.d.ts.map +1 -0
- package/lib/rules/token/link-image-style.js +138 -0
- package/lib/rules/token/link-image-style.js.map +1 -0
- package/lib/rules/token/list-indent.d.ts.map +1 -0
- package/lib/rules/token/list-indent.js.map +1 -0
- package/lib/rules/token/list-length.d.ts.map +1 -0
- package/lib/rules/token/list-length.js +31 -0
- package/lib/rules/token/list-length.js.map +1 -0
- package/lib/rules/token/list-marker-space.d.ts.map +1 -0
- package/lib/rules/token/list-marker-space.js.map +1 -0
- package/lib/rules/token/markdoc-attributes.d.ts.map +1 -0
- package/lib/rules/token/markdoc-attributes.js +198 -0
- package/lib/rules/token/markdoc-attributes.js.map +1 -0
- package/lib/rules/token/markdoc-pairing.d.ts.map +1 -0
- package/lib/rules/token/markdoc-pairing.js +65 -0
- package/lib/rules/token/markdoc-pairing.js.map +1 -0
- package/lib/rules/token/markdoc-syntax.d.ts.map +1 -0
- package/lib/rules/token/markdoc-syntax.js +84 -0
- package/lib/rules/token/markdoc-syntax.js.map +1 -0
- package/lib/rules/token/markdoc-unknown-tag.d.ts.map +1 -0
- package/lib/rules/token/markdoc-unknown-tag.js +44 -0
- package/lib/rules/token/markdoc-unknown-tag.js.map +1 -0
- package/lib/rules/token/no-alt-text.d.ts.map +1 -0
- package/lib/rules/token/no-alt-text.js +43 -0
- package/lib/rules/token/no-alt-text.js.map +1 -0
- package/lib/rules/token/no-bare-urls.d.ts.map +1 -0
- package/lib/rules/token/no-bare-urls.js +74 -0
- package/lib/rules/token/no-bare-urls.js.map +1 -0
- package/lib/rules/token/no-blanks-blockquote.d.ts.map +1 -0
- package/lib/rules/token/no-blanks-blockquote.js.map +1 -0
- package/lib/rules/token/no-duplicate-heading.d.ts.map +1 -0
- package/lib/rules/token/no-duplicate-heading.js +89 -0
- package/lib/rules/token/no-duplicate-heading.js.map +1 -0
- package/lib/rules/token/no-duplicate-link-destinations.d.ts.map +1 -0
- package/lib/rules/token/no-duplicate-link-destinations.js +54 -0
- package/lib/rules/token/no-duplicate-link-destinations.js.map +1 -0
- package/lib/rules/token/no-emphasis-as-heading.d.ts.map +1 -0
- package/lib/rules/token/no-emphasis-as-heading.js +39 -0
- package/lib/rules/token/no-emphasis-as-heading.js.map +1 -0
- package/lib/rules/token/no-empty-headings.d.ts.map +1 -0
- package/lib/rules/token/no-empty-headings.js +21 -0
- package/lib/rules/token/no-empty-headings.js.map +1 -0
- package/lib/rules/token/no-empty-links.d.ts.map +1 -0
- package/lib/rules/token/no-empty-links.js.map +1 -0
- package/lib/rules/token/no-hard-tabs.d.ts.map +1 -0
- package/lib/rules/token/no-hard-tabs.js.map +1 -0
- package/lib/rules/token/no-inline-html.d.ts.map +1 -0
- package/lib/rules/token/no-inline-html.js +41 -0
- package/lib/rules/token/no-inline-html.js.map +1 -0
- package/lib/rules/token/no-multiple-blanks.d.ts.map +1 -0
- package/lib/rules/token/no-multiple-blanks.js.map +1 -0
- package/lib/rules/token/no-multiple-space-atx.d.ts +9 -0
- package/lib/rules/token/no-multiple-space-atx.d.ts.map +1 -0
- package/lib/rules/token/no-multiple-space-atx.js +46 -0
- package/lib/rules/token/no-multiple-space-atx.js.map +1 -0
- package/lib/rules/token/no-multiple-space-closed-atx.d.ts.map +1 -0
- package/lib/rules/token/no-multiple-space-closed-atx.js.map +1 -0
- package/lib/rules/token/no-reversed-links.d.ts.map +1 -0
- package/lib/rules/token/no-reversed-links.js.map +1 -0
- package/lib/rules/token/no-space-in-code.d.ts.map +1 -0
- package/lib/rules/token/no-space-in-code.js.map +1 -0
- package/lib/rules/token/no-space-in-emphasis.d.ts.map +1 -0
- package/lib/rules/token/no-space-in-emphasis.js +72 -0
- package/lib/rules/token/no-space-in-emphasis.js.map +1 -0
- package/lib/rules/token/no-space-in-links.d.ts.map +1 -0
- package/lib/rules/token/no-space-in-links.js.map +1 -0
- package/lib/rules/token/no-trailing-punctuation.d.ts.map +1 -0
- package/lib/rules/token/no-trailing-punctuation.js.map +1 -0
- package/lib/rules/token/no-trailing-spaces.d.ts.map +1 -0
- package/lib/rules/token/no-trailing-spaces.js.map +1 -0
- package/lib/rules/token/ol-prefix.d.ts.map +1 -0
- package/lib/rules/token/ol-prefix.js.map +1 -0
- package/lib/rules/token/proper-names.d.ts.map +1 -0
- package/lib/rules/token/proper-names.js +87 -0
- package/lib/rules/token/proper-names.js.map +1 -0
- package/lib/rules/token/reference-links-images.d.ts.map +1 -0
- package/lib/rules/token/reference-links-images.js.map +1 -0
- package/lib/rules/token/required-headings.d.ts.map +1 -0
- package/lib/rules/token/required-headings.js +73 -0
- package/lib/rules/token/required-headings.js.map +1 -0
- package/lib/rules/token/single-h1.d.ts.map +1 -0
- package/lib/rules/token/single-h1.js +43 -0
- package/lib/rules/token/single-h1.js.map +1 -0
- package/lib/rules/token/table-column-count.d.ts.map +1 -0
- package/lib/rules/token/table-column-count.js.map +1 -0
- package/lib/rules/token/table-column-style.d.ts.map +1 -0
- package/lib/rules/token/table-column-style.js +162 -0
- package/lib/rules/token/table-column-style.js.map +1 -0
- package/lib/rules/token/table-pipe-style.d.ts.map +1 -0
- package/lib/rules/token/table-pipe-style.js.map +1 -0
- package/lib/rules/token/ul-indent.d.ts.map +1 -0
- package/lib/rules/token/ul-indent.js.map +1 -0
- package/lib/rules/token/ul-style.d.ts.map +1 -0
- package/lib/rules/token/ul-style.js +70 -0
- package/lib/rules/token/ul-style.js.map +1 -0
- package/lib/rules/types.d.ts +62 -0
- package/lib/rules/types.d.ts.map +1 -0
- package/lib/rules/utils.d.ts +18 -0
- package/lib/rules/utils.d.ts.map +1 -0
- package/lib/rules/utils.js +75 -0
- package/lib/rules/utils.js.map +1 -0
- package/lib/scopes/extractor.d.ts +6 -0
- package/lib/scopes/extractor.d.ts.map +1 -0
- package/lib/scopes/extractor.js +398 -0
- package/lib/scopes/extractor.js.map +1 -0
- package/lib/scopes/selector.d.ts +26 -0
- package/lib/scopes/selector.d.ts.map +1 -0
- package/lib/scopes/selector.js +78 -0
- package/lib/scopes/selector.js.map +1 -0
- package/lib/scopes/sentences.d.ts +13 -0
- package/lib/scopes/sentences.d.ts.map +1 -0
- package/lib/scopes/sentences.js +237 -0
- package/lib/scopes/sentences.js.map +1 -0
- package/lib/scopes/types.d.ts +35 -0
- package/lib/scopes/types.d.ts.map +1 -0
- package/lib/scopes/vocabulary.d.ts +12 -0
- package/lib/scopes/vocabulary.d.ts.map +1 -0
- package/lib/scopes/vocabulary.js +56 -0
- package/lib/scopes/vocabulary.js.map +1 -0
- package/lib/types/assertions.d.ts +97 -0
- package/lib/types/assertions.d.ts.map +1 -0
- package/lib/types/reporting.d.ts +23 -0
- package/lib/types/reporting.d.ts.map +1 -0
- package/lib/types/rules.d.ts +53 -0
- package/lib/types/rules.d.ts.map +1 -0
- package/lib/types/validation.d.ts +5 -0
- package/lib/types/validation.d.ts.map +1 -0
- package/lib/utils/is-plain-object.d.ts +2 -0
- package/lib/utils/is-plain-object.d.ts.map +1 -0
- package/lib/utils/is-plain-object.js +5 -0
- package/lib/utils/is-plain-object.js.map +1 -0
- package/package.json +58 -61
- package/presets/google/PROVENANCE.md +217 -221
- package/presets/inclusive-language/PROVENANCE.md +20 -19
- package/presets/microsoft/PROVENANCE.md +242 -243
- package/presets/plain-language/PROVENANCE.md +66 -60
- package/presets/technical-english/PROVENANCE.md +5 -5
- package/skills/recheck-config/SKILL.md +70 -20
- package/skills/recheck-lint/SKILL.md +37 -13
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -228
- package/dist/cli.js.map +0 -1
- package/dist/commands/baseline.d.ts +0 -10
- package/dist/commands/baseline.d.ts.map +0 -1
- package/dist/commands/baseline.js +0 -59
- package/dist/commands/baseline.js.map +0 -1
- package/dist/commands/markdoc-schema.d.ts +0 -17
- package/dist/commands/markdoc-schema.d.ts.map +0 -1
- package/dist/commands/markdoc-schema.js +0 -127
- package/dist/commands/markdoc-schema.js.map +0 -1
- package/dist/commands/readability.d.ts +0 -10
- package/dist/commands/readability.d.ts.map +0 -1
- package/dist/commands/readability.js +0 -90
- package/dist/commands/readability.js.map +0 -1
- package/dist/commands/run.d.ts +0 -21
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js +0 -236
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/validate.d.ts +0 -8
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/validate.js +0 -43
- package/dist/commands/validate.js.map +0 -1
- package/dist/config/load.d.ts +0 -33
- package/dist/config/load.d.ts.map +0 -1
- package/dist/config/load.js +0 -98
- package/dist/config/load.js.map +0 -1
- package/dist/config/presets/api-descriptions.d.ts +0 -8
- package/dist/config/presets/api-descriptions.d.ts.map +0 -1
- package/dist/config/presets/api-descriptions.js +0 -24
- package/dist/config/presets/api-descriptions.js.map +0 -1
- package/dist/config/presets/google.d.ts +0 -3
- package/dist/config/presets/google.d.ts.map +0 -1
- package/dist/config/presets/google.js +0 -1671
- package/dist/config/presets/google.js.map +0 -1
- package/dist/config/presets/inclusive-language.d.ts +0 -3
- package/dist/config/presets/inclusive-language.d.ts.map +0 -1
- package/dist/config/presets/inclusive-language.js +0 -321
- package/dist/config/presets/inclusive-language.js.map +0 -1
- package/dist/config/presets/index.d.ts +0 -67
- package/dist/config/presets/index.d.ts.map +0 -1
- package/dist/config/presets/index.js +0 -141
- package/dist/config/presets/index.js.map +0 -1
- package/dist/config/presets/markdoc.d.ts +0 -21
- package/dist/config/presets/markdoc.d.ts.map +0 -1
- package/dist/config/presets/markdoc.js +0 -101
- package/dist/config/presets/markdoc.js.map +0 -1
- package/dist/config/presets/markdown-relaxed.d.ts +0 -3
- package/dist/config/presets/markdown-relaxed.d.ts.map +0 -1
- package/dist/config/presets/markdown-relaxed.js +0 -98
- package/dist/config/presets/markdown-relaxed.js.map +0 -1
- package/dist/config/presets/markdown.d.ts +0 -43
- package/dist/config/presets/markdown.d.ts.map +0 -1
- package/dist/config/presets/markdown.js +0 -132
- package/dist/config/presets/markdown.js.map +0 -1
- package/dist/config/presets/microsoft.d.ts +0 -3
- package/dist/config/presets/microsoft.d.ts.map +0 -1
- package/dist/config/presets/microsoft.js +0 -2268
- package/dist/config/presets/microsoft.js.map +0 -1
- package/dist/config/presets/minimal.d.ts +0 -3
- package/dist/config/presets/minimal.d.ts.map +0 -1
- package/dist/config/presets/minimal.js +0 -21
- package/dist/config/presets/minimal.js.map +0 -1
- package/dist/config/presets/plain-language.d.ts +0 -3
- package/dist/config/presets/plain-language.d.ts.map +0 -1
- package/dist/config/presets/plain-language.js +0 -351
- package/dist/config/presets/plain-language.js.map +0 -1
- package/dist/config/presets/prose.d.ts +0 -52
- package/dist/config/presets/prose.d.ts.map +0 -1
- package/dist/config/presets/prose.js +0 -138
- package/dist/config/presets/prose.js.map +0 -1
- package/dist/config/presets/technical-english.d.ts +0 -34
- package/dist/config/presets/technical-english.d.ts.map +0 -1
- package/dist/config/presets/technical-english.js +0 -79
- package/dist/config/presets/technical-english.js.map +0 -1
- package/dist/config/schema.d.ts +0 -226
- package/dist/config/schema.d.ts.map +0 -1
- package/dist/config/schema.js +0 -196
- package/dist/config/schema.js.map +0 -1
- package/dist/config/validate.d.ts +0 -22
- package/dist/config/validate.d.ts.map +0 -1
- package/dist/config/validate.js +0 -1296
- package/dist/config/validate.js.map +0 -1
- package/dist/core/auto-fix.d.ts.map +0 -1
- package/dist/core/auto-fix.js +0 -101
- package/dist/core/auto-fix.js.map +0 -1
- package/dist/core/baseline.d.ts +0 -49
- package/dist/core/baseline.d.ts.map +0 -1
- package/dist/core/baseline.js +0 -0
- package/dist/core/baseline.js.map +0 -1
- package/dist/core/case-preserve.d.ts +0 -46
- package/dist/core/case-preserve.d.ts.map +0 -1
- package/dist/core/case-preserve.js +0 -57
- package/dist/core/case-preserve.js.map +0 -1
- package/dist/core/directives.d.ts.map +0 -1
- package/dist/core/directives.js +0 -73
- package/dist/core/directives.js.map +0 -1
- package/dist/core/files.d.ts +0 -69
- package/dist/core/files.d.ts.map +0 -1
- package/dist/core/files.js +0 -260
- package/dist/core/files.js.map +0 -1
- package/dist/core/inline-code.d.ts +0 -87
- package/dist/core/inline-code.d.ts.map +0 -1
- package/dist/core/inline-code.js +0 -104
- package/dist/core/inline-code.js.map +0 -1
- package/dist/core/line-endings.d.ts +0 -32
- package/dist/core/line-endings.d.ts.map +0 -1
- package/dist/core/line-endings.js +0 -65
- package/dist/core/line-endings.js.map +0 -1
- package/dist/core/markdoc-tags.d.ts +0 -79
- package/dist/core/markdoc-tags.d.ts.map +0 -1
- package/dist/core/markdoc-tags.js +0 -131
- package/dist/core/markdoc-tags.js.map +0 -1
- package/dist/core/prose-extract.d.ts +0 -6
- package/dist/core/prose-extract.d.ts.map +0 -1
- package/dist/core/prose-extract.js +0 -79
- package/dist/core/prose-extract.js.map +0 -1
- package/dist/core/readability.d.ts +0 -17
- package/dist/core/readability.d.ts.map +0 -1
- package/dist/core/readability.js +0 -37
- package/dist/core/readability.js.map +0 -1
- package/dist/core/rule-filters.d.ts +0 -45
- package/dist/core/rule-filters.d.ts.map +0 -1
- package/dist/core/rule-filters.js +0 -118
- package/dist/core/rule-filters.js.map +0 -1
- package/dist/core/runner.d.ts +0 -99
- package/dist/core/runner.d.ts.map +0 -1
- package/dist/core/runner.js +0 -401
- package/dist/core/runner.js.map +0 -1
- package/dist/core/timing.d.ts +0 -24
- package/dist/core/timing.d.ts.map +0 -1
- package/dist/core/timing.js +0 -39
- package/dist/core/timing.js.map +0 -1
- package/dist/data/markdoc-realm-schema.d.ts.map +0 -1
- package/dist/data/markdoc-realm-schema.js +0 -798
- package/dist/data/markdoc-realm-schema.js.map +0 -1
- package/dist/data/proper-nouns.d.ts.map +0 -1
- package/dist/data/proper-nouns.js +0 -47
- package/dist/data/proper-nouns.js.map +0 -1
- package/dist/data/realm-front-matter-schema.d.ts +0 -28
- package/dist/data/realm-front-matter-schema.d.ts.map +0 -1
- package/dist/data/realm-front-matter-schema.js +0 -73
- package/dist/data/realm-front-matter-schema.js.map +0 -1
- package/dist/index.d.ts +0 -90
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -152
- package/dist/index.js.map +0 -1
- package/dist/metrics/formulas.d.ts +0 -17
- package/dist/metrics/formulas.d.ts.map +0 -1
- package/dist/metrics/formulas.js +0 -70
- package/dist/metrics/formulas.js.map +0 -1
- package/dist/metrics/statistics.d.ts +0 -27
- package/dist/metrics/statistics.d.ts.map +0 -1
- package/dist/metrics/statistics.js +0 -56
- package/dist/metrics/statistics.js.map +0 -1
- package/dist/parser/index.d.ts +0 -19
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js +0 -174
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/markdoc/extract-statics.d.ts +0 -45
- package/dist/parser/markdoc/extract-statics.d.ts.map +0 -1
- package/dist/parser/markdoc/extract-statics.js +0 -139
- package/dist/parser/markdoc/extract-statics.js.map +0 -1
- package/dist/parser/markdoc/pairing.d.ts +0 -63
- package/dist/parser/markdoc/pairing.d.ts.map +0 -1
- package/dist/parser/markdoc/pairing.js +0 -94
- package/dist/parser/markdoc/pairing.js.map +0 -1
- package/dist/parser/markdoc/schema.d.ts +0 -85
- package/dist/parser/markdoc/schema.d.ts.map +0 -1
- package/dist/parser/markdoc/schema.js +0 -86
- package/dist/parser/markdoc/schema.js.map +0 -1
- package/dist/parser/markdoc/span.d.ts +0 -64
- package/dist/parser/markdoc/span.d.ts.map +0 -1
- package/dist/parser/markdoc/span.js +0 -729
- package/dist/parser/markdoc/span.js.map +0 -1
- package/dist/parser/markdoc/structure.d.ts +0 -28
- package/dist/parser/markdoc/structure.d.ts.map +0 -1
- package/dist/parser/markdoc/structure.js +0 -153
- package/dist/parser/markdoc/structure.js.map +0 -1
- package/dist/parser/markdoc/syntax.d.ts +0 -44
- package/dist/parser/markdoc/syntax.d.ts.map +0 -1
- package/dist/parser/markdoc/syntax.js +0 -317
- package/dist/parser/markdoc/syntax.js.map +0 -1
- package/dist/parser/types.d.ts.map +0 -1
- package/dist/reporter/fixes.d.ts +0 -3
- package/dist/reporter/fixes.d.ts.map +0 -1
- package/dist/reporter/fixes.js +0 -41
- package/dist/reporter/fixes.js.map +0 -1
- package/dist/reporter/formats/github-actions.d.ts +0 -6
- package/dist/reporter/formats/github-actions.d.ts.map +0 -1
- package/dist/reporter/formats/github-actions.js +0 -20
- package/dist/reporter/formats/github-actions.js.map +0 -1
- package/dist/reporter/formats/json.d.ts +0 -10
- package/dist/reporter/formats/json.d.ts.map +0 -1
- package/dist/reporter/formats/json.js +0 -25
- package/dist/reporter/formats/json.js.map +0 -1
- package/dist/reporter/formats/sarif.d.ts +0 -10
- package/dist/reporter/formats/sarif.d.ts.map +0 -1
- package/dist/reporter/formats/sarif.js +0 -66
- package/dist/reporter/formats/sarif.js.map +0 -1
- package/dist/reporter/formats/table.d.ts +0 -6
- package/dist/reporter/formats/table.d.ts.map +0 -1
- package/dist/reporter/formats/table.js +0 -43
- package/dist/reporter/formats/table.js.map +0 -1
- package/dist/reporter/index.d.ts +0 -10
- package/dist/reporter/index.d.ts.map +0 -1
- package/dist/reporter/index.js +0 -42
- package/dist/reporter/index.js.map +0 -1
- package/dist/reporter/prioritize-problems.d.ts +0 -7
- package/dist/reporter/prioritize-problems.d.ts.map +0 -1
- package/dist/reporter/prioritize-problems.js +0 -29
- package/dist/reporter/prioritize-problems.js.map +0 -1
- package/dist/reporter/statistics.d.ts +0 -10
- package/dist/reporter/statistics.d.ts.map +0 -1
- package/dist/reporter/statistics.js +0 -52
- package/dist/reporter/statistics.js.map +0 -1
- package/dist/reporter/summary.d.ts +0 -10
- package/dist/reporter/summary.d.ts.map +0 -1
- package/dist/reporter/summary.js +0 -49
- package/dist/reporter/summary.js.map +0 -1
- package/dist/rules/registry.d.ts +0 -15
- package/dist/rules/registry.d.ts.map +0 -1
- package/dist/rules/registry.js +0 -81
- package/dist/rules/registry.js.map +0 -1
- package/dist/rules/scope/capitalization.d.ts.map +0 -1
- package/dist/rules/scope/capitalization.js +0 -164
- package/dist/rules/scope/capitalization.js.map +0 -1
- package/dist/rules/scope/conditional.d.ts.map +0 -1
- package/dist/rules/scope/conditional.js +0 -112
- package/dist/rules/scope/conditional.js.map +0 -1
- package/dist/rules/scope/consistency.d.ts.map +0 -1
- package/dist/rules/scope/consistency.js +0 -179
- package/dist/rules/scope/consistency.js.map +0 -1
- package/dist/rules/scope/length.d.ts.map +0 -1
- package/dist/rules/scope/length.js +0 -73
- package/dist/rules/scope/length.js.map +0 -1
- package/dist/rules/scope/max-image-size.d.ts.map +0 -1
- package/dist/rules/scope/max-image-size.js +0 -65
- package/dist/rules/scope/max-image-size.js.map +0 -1
- package/dist/rules/scope/metric.d.ts +0 -5
- package/dist/rules/scope/metric.d.ts.map +0 -1
- package/dist/rules/scope/metric.js +0 -59
- package/dist/rules/scope/metric.js.map +0 -1
- package/dist/rules/scope/occurrence.d.ts.map +0 -1
- package/dist/rules/scope/occurrence.js +0 -48
- package/dist/rules/scope/occurrence.js.map +0 -1
- package/dist/rules/scope/pattern.d.ts.map +0 -1
- package/dist/rules/scope/pattern.js +0 -75
- package/dist/rules/scope/pattern.js.map +0 -1
- package/dist/rules/scope/repetition.d.ts.map +0 -1
- package/dist/rules/scope/repetition.js +0 -139
- package/dist/rules/scope/repetition.js.map +0 -1
- package/dist/rules/scope/semantic-line-breaks.d.ts.map +0 -1
- package/dist/rules/scope/semantic-line-breaks.js +0 -236
- package/dist/rules/scope/semantic-line-breaks.js.map +0 -1
- package/dist/rules/scope/spelling.d.ts +0 -27
- package/dist/rules/scope/spelling.d.ts.map +0 -1
- package/dist/rules/scope/spelling.js +0 -227
- package/dist/rules/scope/spelling.js.map +0 -1
- package/dist/rules/scope/swap.d.ts.map +0 -1
- package/dist/rules/scope/swap.js +0 -149
- package/dist/rules/scope/swap.js.map +0 -1
- package/dist/rules/scope/title-case.d.ts +0 -46
- package/dist/rules/scope/title-case.d.ts.map +0 -1
- package/dist/rules/scope/title-case.js +0 -301
- package/dist/rules/scope/title-case.js.map +0 -1
- package/dist/rules/token/blanks-around-fences.d.ts.map +0 -1
- package/dist/rules/token/blanks-around-fences.js.map +0 -1
- package/dist/rules/token/blanks-around-headings.d.ts.map +0 -1
- package/dist/rules/token/blanks-around-headings.js +0 -108
- package/dist/rules/token/blanks-around-headings.js.map +0 -1
- package/dist/rules/token/blanks-around-lists.d.ts.map +0 -1
- package/dist/rules/token/blanks-around-lists.js +0 -56
- package/dist/rules/token/blanks-around-lists.js.map +0 -1
- package/dist/rules/token/blanks-around-tables.d.ts.map +0 -1
- package/dist/rules/token/blanks-around-tables.js +0 -42
- package/dist/rules/token/blanks-around-tables.js.map +0 -1
- package/dist/rules/token/code-block-style.d.ts.map +0 -1
- package/dist/rules/token/code-block-style.js.map +0 -1
- package/dist/rules/token/code-fence-style.d.ts.map +0 -1
- package/dist/rules/token/code-fence-style.js.map +0 -1
- package/dist/rules/token/commands-show-output.d.ts.map +0 -1
- package/dist/rules/token/commands-show-output.js.map +0 -1
- package/dist/rules/token/descriptive-link-text.d.ts.map +0 -1
- package/dist/rules/token/descriptive-link-text.js +0 -53
- package/dist/rules/token/descriptive-link-text.js.map +0 -1
- package/dist/rules/token/fenced-code-language.d.ts.map +0 -1
- package/dist/rules/token/fenced-code-language.js.map +0 -1
- package/dist/rules/token/first-line-h1.d.ts.map +0 -1
- package/dist/rules/token/first-line-h1.js +0 -107
- package/dist/rules/token/first-line-h1.js.map +0 -1
- package/dist/rules/token/front-matter.d.ts.map +0 -1
- package/dist/rules/token/front-matter.js +0 -177
- package/dist/rules/token/front-matter.js.map +0 -1
- package/dist/rules/token/heading-increment.d.ts.map +0 -1
- package/dist/rules/token/heading-increment.js +0 -27
- package/dist/rules/token/heading-increment.js.map +0 -1
- package/dist/rules/token/heading-start-left.d.ts.map +0 -1
- package/dist/rules/token/heading-start-left.js.map +0 -1
- package/dist/rules/token/heading-style.d.ts.map +0 -1
- package/dist/rules/token/heading-style.js.map +0 -1
- package/dist/rules/token/helpers.d.ts +0 -313
- package/dist/rules/token/helpers.d.ts.map +0 -1
- package/dist/rules/token/helpers.js +0 -746
- package/dist/rules/token/helpers.js.map +0 -1
- package/dist/rules/token/hr-style.d.ts.map +0 -1
- package/dist/rules/token/hr-style.js.map +0 -1
- package/dist/rules/token/index.d.ts +0 -76
- package/dist/rules/token/index.d.ts.map +0 -1
- package/dist/rules/token/index.js +0 -229
- package/dist/rules/token/index.js.map +0 -1
- package/dist/rules/token/line-length.d.ts.map +0 -1
- package/dist/rules/token/line-length.js +0 -120
- package/dist/rules/token/line-length.js.map +0 -1
- package/dist/rules/token/link-fragments.d.ts.map +0 -1
- package/dist/rules/token/link-fragments.js +0 -393
- package/dist/rules/token/link-fragments.js.map +0 -1
- package/dist/rules/token/link-image-reference-definitions.d.ts.map +0 -1
- package/dist/rules/token/link-image-reference-definitions.js.map +0 -1
- package/dist/rules/token/link-image-style.d.ts.map +0 -1
- package/dist/rules/token/link-image-style.js +0 -131
- package/dist/rules/token/link-image-style.js.map +0 -1
- package/dist/rules/token/list-indent.d.ts.map +0 -1
- package/dist/rules/token/list-indent.js.map +0 -1
- package/dist/rules/token/list-length.d.ts.map +0 -1
- package/dist/rules/token/list-length.js +0 -55
- package/dist/rules/token/list-length.js.map +0 -1
- package/dist/rules/token/list-marker-space.d.ts.map +0 -1
- package/dist/rules/token/list-marker-space.js.map +0 -1
- package/dist/rules/token/markdoc-attributes.d.ts.map +0 -1
- package/dist/rules/token/markdoc-attributes.js +0 -269
- package/dist/rules/token/markdoc-attributes.js.map +0 -1
- package/dist/rules/token/markdoc-pairing.d.ts.map +0 -1
- package/dist/rules/token/markdoc-pairing.js +0 -73
- package/dist/rules/token/markdoc-pairing.js.map +0 -1
- package/dist/rules/token/markdoc-syntax.d.ts.map +0 -1
- package/dist/rules/token/markdoc-syntax.js +0 -119
- package/dist/rules/token/markdoc-syntax.js.map +0 -1
- package/dist/rules/token/markdoc-unknown-tag.d.ts.map +0 -1
- package/dist/rules/token/markdoc-unknown-tag.js +0 -64
- package/dist/rules/token/markdoc-unknown-tag.js.map +0 -1
- package/dist/rules/token/no-alt-text.d.ts.map +0 -1
- package/dist/rules/token/no-alt-text.js +0 -47
- package/dist/rules/token/no-alt-text.js.map +0 -1
- package/dist/rules/token/no-bare-urls.d.ts.map +0 -1
- package/dist/rules/token/no-bare-urls.js +0 -88
- package/dist/rules/token/no-bare-urls.js.map +0 -1
- package/dist/rules/token/no-blanks-blockquote.d.ts.map +0 -1
- package/dist/rules/token/no-blanks-blockquote.js.map +0 -1
- package/dist/rules/token/no-duplicate-heading.d.ts.map +0 -1
- package/dist/rules/token/no-duplicate-heading.js +0 -101
- package/dist/rules/token/no-duplicate-heading.js.map +0 -1
- package/dist/rules/token/no-duplicate-link-destinations.d.ts.map +0 -1
- package/dist/rules/token/no-duplicate-link-destinations.js +0 -65
- package/dist/rules/token/no-duplicate-link-destinations.js.map +0 -1
- package/dist/rules/token/no-emphasis-as-heading.d.ts.map +0 -1
- package/dist/rules/token/no-emphasis-as-heading.js +0 -44
- package/dist/rules/token/no-emphasis-as-heading.js.map +0 -1
- package/dist/rules/token/no-empty-headings.d.ts.map +0 -1
- package/dist/rules/token/no-empty-headings.js +0 -28
- package/dist/rules/token/no-empty-headings.js.map +0 -1
- package/dist/rules/token/no-empty-links.d.ts.map +0 -1
- package/dist/rules/token/no-empty-links.js.map +0 -1
- package/dist/rules/token/no-hard-tabs.d.ts.map +0 -1
- package/dist/rules/token/no-hard-tabs.js.map +0 -1
- package/dist/rules/token/no-inline-html.d.ts.map +0 -1
- package/dist/rules/token/no-inline-html.js +0 -45
- package/dist/rules/token/no-inline-html.js.map +0 -1
- package/dist/rules/token/no-multiple-blanks.d.ts.map +0 -1
- package/dist/rules/token/no-multiple-blanks.js.map +0 -1
- package/dist/rules/token/no-multiple-space-atx.d.ts +0 -13
- package/dist/rules/token/no-multiple-space-atx.d.ts.map +0 -1
- package/dist/rules/token/no-multiple-space-atx.js +0 -50
- package/dist/rules/token/no-multiple-space-atx.js.map +0 -1
- package/dist/rules/token/no-multiple-space-closed-atx.d.ts.map +0 -1
- package/dist/rules/token/no-multiple-space-closed-atx.js.map +0 -1
- package/dist/rules/token/no-reversed-links.d.ts.map +0 -1
- package/dist/rules/token/no-reversed-links.js.map +0 -1
- package/dist/rules/token/no-space-in-code.d.ts.map +0 -1
- package/dist/rules/token/no-space-in-code.js.map +0 -1
- package/dist/rules/token/no-space-in-emphasis.d.ts.map +0 -1
- package/dist/rules/token/no-space-in-emphasis.js +0 -79
- package/dist/rules/token/no-space-in-emphasis.js.map +0 -1
- package/dist/rules/token/no-space-in-links.d.ts.map +0 -1
- package/dist/rules/token/no-space-in-links.js.map +0 -1
- package/dist/rules/token/no-trailing-punctuation.d.ts.map +0 -1
- package/dist/rules/token/no-trailing-punctuation.js.map +0 -1
- package/dist/rules/token/no-trailing-spaces.d.ts.map +0 -1
- package/dist/rules/token/no-trailing-spaces.js.map +0 -1
- package/dist/rules/token/ol-prefix.d.ts.map +0 -1
- package/dist/rules/token/ol-prefix.js.map +0 -1
- package/dist/rules/token/proper-names.d.ts.map +0 -1
- package/dist/rules/token/proper-names.js +0 -93
- package/dist/rules/token/proper-names.js.map +0 -1
- package/dist/rules/token/reference-links-images.d.ts.map +0 -1
- package/dist/rules/token/reference-links-images.js.map +0 -1
- package/dist/rules/token/required-headings.d.ts.map +0 -1
- package/dist/rules/token/required-headings.js +0 -83
- package/dist/rules/token/required-headings.js.map +0 -1
- package/dist/rules/token/single-h1.d.ts.map +0 -1
- package/dist/rules/token/single-h1.js +0 -56
- package/dist/rules/token/single-h1.js.map +0 -1
- package/dist/rules/token/table-column-count.d.ts.map +0 -1
- package/dist/rules/token/table-column-count.js.map +0 -1
- package/dist/rules/token/table-column-style.d.ts.map +0 -1
- package/dist/rules/token/table-column-style.js +0 -179
- package/dist/rules/token/table-column-style.js.map +0 -1
- package/dist/rules/token/table-pipe-style.d.ts.map +0 -1
- package/dist/rules/token/table-pipe-style.js.map +0 -1
- package/dist/rules/token/ul-indent.d.ts.map +0 -1
- package/dist/rules/token/ul-indent.js.map +0 -1
- package/dist/rules/token/ul-style.d.ts.map +0 -1
- package/dist/rules/token/ul-style.js +0 -80
- package/dist/rules/token/ul-style.js.map +0 -1
- package/dist/rules/types.d.ts +0 -83
- package/dist/rules/types.d.ts.map +0 -1
- package/dist/rules/utils.d.ts +0 -31
- package/dist/rules/utils.d.ts.map +0 -1
- package/dist/rules/utils.js +0 -90
- package/dist/rules/utils.js.map +0 -1
- package/dist/scopes/extractor.d.ts +0 -7
- package/dist/scopes/extractor.d.ts.map +0 -1
- package/dist/scopes/extractor.js +0 -536
- package/dist/scopes/extractor.js.map +0 -1
- package/dist/scopes/selector.d.ts +0 -51
- package/dist/scopes/selector.d.ts.map +0 -1
- package/dist/scopes/selector.js +0 -121
- package/dist/scopes/selector.js.map +0 -1
- package/dist/scopes/sentences.d.ts +0 -15
- package/dist/scopes/sentences.d.ts.map +0 -1
- package/dist/scopes/sentences.js +0 -202
- package/dist/scopes/sentences.js.map +0 -1
- package/dist/scopes/types.d.ts +0 -46
- package/dist/scopes/types.d.ts.map +0 -1
- package/dist/scopes/vocabulary.d.ts +0 -16
- package/dist/scopes/vocabulary.d.ts.map +0 -1
- package/dist/scopes/vocabulary.js +0 -70
- package/dist/scopes/vocabulary.js.map +0 -1
- package/dist/types/assertions.d.ts +0 -119
- package/dist/types/assertions.d.ts.map +0 -1
- package/dist/types/reporting.d.ts +0 -32
- package/dist/types/reporting.d.ts.map +0 -1
- package/dist/types/rules.d.ts +0 -41
- package/dist/types/rules.d.ts.map +0 -1
- package/dist/types/validation.d.ts +0 -6
- package/dist/types/validation.d.ts.map +0 -1
- /package/{dist → lib}/core/auto-fix.d.ts +0 -0
- /package/{dist → lib}/core/directives.d.ts +0 -0
- /package/{dist → lib}/data/markdoc-realm-schema.d.ts +0 -0
- /package/{dist → lib}/data/proper-nouns.d.ts +0 -0
- /package/{dist → lib}/metrics/index.d.ts +0 -0
- /package/{dist → lib}/metrics/index.d.ts.map +0 -0
- /package/{dist → lib}/metrics/index.js +0 -0
- /package/{dist → lib}/metrics/index.js.map +0 -0
- /package/{dist → lib}/parser/types.d.ts +0 -0
- /package/{dist → lib}/parser/types.js +0 -0
- /package/{dist → lib}/parser/types.js.map +0 -0
- /package/{dist → lib}/rules/scope/capitalization.d.ts +0 -0
- /package/{dist → lib}/rules/scope/conditional.d.ts +0 -0
- /package/{dist → lib}/rules/scope/consistency.d.ts +0 -0
- /package/{dist → lib}/rules/scope/length.d.ts +0 -0
- /package/{dist → lib}/rules/scope/max-image-size.d.ts +0 -0
- /package/{dist → lib}/rules/scope/occurrence.d.ts +0 -0
- /package/{dist → lib}/rules/scope/pattern.d.ts +0 -0
- /package/{dist → lib}/rules/scope/repetition.d.ts +0 -0
- /package/{dist → lib}/rules/scope/semantic-line-breaks.d.ts +0 -0
- /package/{dist → lib}/rules/scope/swap.d.ts +0 -0
- /package/{dist → lib}/rules/token/blanks-around-fences.d.ts +0 -0
- /package/{dist → lib}/rules/token/blanks-around-fences.js +0 -0
- /package/{dist → lib}/rules/token/blanks-around-headings.d.ts +0 -0
- /package/{dist → lib}/rules/token/blanks-around-lists.d.ts +0 -0
- /package/{dist → lib}/rules/token/blanks-around-tables.d.ts +0 -0
- /package/{dist → lib}/rules/token/code-block-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/code-block-style.js +0 -0
- /package/{dist → lib}/rules/token/code-fence-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/code-fence-style.js +0 -0
- /package/{dist → lib}/rules/token/commands-show-output.d.ts +0 -0
- /package/{dist → lib}/rules/token/commands-show-output.js +0 -0
- /package/{dist → lib}/rules/token/descriptive-link-text.d.ts +0 -0
- /package/{dist → lib}/rules/token/emphasis-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/emphasis-style.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/emphasis-style.js +0 -0
- /package/{dist → lib}/rules/token/emphasis-style.js.map +0 -0
- /package/{dist → lib}/rules/token/fenced-code-language.d.ts +0 -0
- /package/{dist → lib}/rules/token/fenced-code-language.js +0 -0
- /package/{dist → lib}/rules/token/first-line-h1.d.ts +0 -0
- /package/{dist → lib}/rules/token/front-matter.d.ts +0 -0
- /package/{dist → lib}/rules/token/heading-increment.d.ts +0 -0
- /package/{dist → lib}/rules/token/heading-start-left.d.ts +0 -0
- /package/{dist → lib}/rules/token/heading-start-left.js +0 -0
- /package/{dist → lib}/rules/token/heading-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/heading-style.js +0 -0
- /package/{dist → lib}/rules/token/hr-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/hr-style.js +0 -0
- /package/{dist → lib}/rules/token/line-length.d.ts +0 -0
- /package/{dist → lib}/rules/token/link-fragments.d.ts +0 -0
- /package/{dist → lib}/rules/token/link-image-reference-definitions.d.ts +0 -0
- /package/{dist → lib}/rules/token/link-image-reference-definitions.js +0 -0
- /package/{dist → lib}/rules/token/link-image-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/list-indent.d.ts +0 -0
- /package/{dist → lib}/rules/token/list-indent.js +0 -0
- /package/{dist → lib}/rules/token/list-length.d.ts +0 -0
- /package/{dist → lib}/rules/token/list-marker-space.d.ts +0 -0
- /package/{dist → lib}/rules/token/list-marker-space.js +0 -0
- /package/{dist → lib}/rules/token/markdoc-attributes.d.ts +0 -0
- /package/{dist → lib}/rules/token/markdoc-pairing.d.ts +0 -0
- /package/{dist → lib}/rules/token/markdoc-syntax.d.ts +0 -0
- /package/{dist → lib}/rules/token/markdoc-unknown-tag.d.ts +0 -0
- /package/{dist → lib}/rules/token/messages.d.ts +0 -0
- /package/{dist → lib}/rules/token/messages.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/messages.js +0 -0
- /package/{dist → lib}/rules/token/messages.js.map +0 -0
- /package/{dist → lib}/rules/token/no-alt-text.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-bare-urls.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-blanks-blockquote.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-blanks-blockquote.js +0 -0
- /package/{dist → lib}/rules/token/no-duplicate-heading.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-duplicate-link-destinations.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-emphasis-as-heading.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-empty-headings.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-empty-links.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-empty-links.js +0 -0
- /package/{dist → lib}/rules/token/no-hard-tabs.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-hard-tabs.js +0 -0
- /package/{dist → lib}/rules/token/no-inline-html.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-atx.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-atx.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-atx.js +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-atx.js.map +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-closed-atx.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-closed-atx.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-closed-atx.js +0 -0
- /package/{dist → lib}/rules/token/no-missing-space-closed-atx.js.map +0 -0
- /package/{dist → lib}/rules/token/no-multiple-blanks.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-multiple-blanks.js +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-blockquote.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-blockquote.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-blockquote.js +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-blockquote.js.map +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-closed-atx.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-multiple-space-closed-atx.js +0 -0
- /package/{dist → lib}/rules/token/no-reversed-links.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-reversed-links.js +0 -0
- /package/{dist → lib}/rules/token/no-space-in-code.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-space-in-code.js +0 -0
- /package/{dist → lib}/rules/token/no-space-in-emphasis.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-space-in-links.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-space-in-links.js +0 -0
- /package/{dist → lib}/rules/token/no-trailing-punctuation.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-trailing-punctuation.js +0 -0
- /package/{dist → lib}/rules/token/no-trailing-spaces.d.ts +0 -0
- /package/{dist → lib}/rules/token/no-trailing-spaces.js +0 -0
- /package/{dist → lib}/rules/token/ol-prefix.d.ts +0 -0
- /package/{dist → lib}/rules/token/ol-prefix.js +0 -0
- /package/{dist → lib}/rules/token/proper-names.d.ts +0 -0
- /package/{dist → lib}/rules/token/reference-links-images.d.ts +0 -0
- /package/{dist → lib}/rules/token/reference-links-images.js +0 -0
- /package/{dist → lib}/rules/token/required-headings.d.ts +0 -0
- /package/{dist → lib}/rules/token/single-h1.d.ts +0 -0
- /package/{dist → lib}/rules/token/single-trailing-newline.d.ts +0 -0
- /package/{dist → lib}/rules/token/single-trailing-newline.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/single-trailing-newline.js +0 -0
- /package/{dist → lib}/rules/token/single-trailing-newline.js.map +0 -0
- /package/{dist → lib}/rules/token/strong-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/strong-style.d.ts.map +0 -0
- /package/{dist → lib}/rules/token/strong-style.js +0 -0
- /package/{dist → lib}/rules/token/strong-style.js.map +0 -0
- /package/{dist → lib}/rules/token/table-column-count.d.ts +0 -0
- /package/{dist → lib}/rules/token/table-column-count.js +0 -0
- /package/{dist → lib}/rules/token/table-column-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/table-pipe-style.d.ts +0 -0
- /package/{dist → lib}/rules/token/table-pipe-style.js +0 -0
- /package/{dist → lib}/rules/token/ul-indent.d.ts +0 -0
- /package/{dist → lib}/rules/token/ul-indent.js +0 -0
- /package/{dist → lib}/rules/token/ul-style.d.ts +0 -0
- /package/{dist → lib}/rules/types.js +0 -0
- /package/{dist → lib}/rules/types.js.map +0 -0
- /package/{dist → lib}/scopes/types.js +0 -0
- /package/{dist → lib}/scopes/types.js.map +0 -0
- /package/{dist → lib}/types/assertions.js +0 -0
- /package/{dist → lib}/types/assertions.js.map +0 -0
- /package/{dist → lib}/types/index.d.ts +0 -0
- /package/{dist → lib}/types/index.d.ts.map +0 -0
- /package/{dist → lib}/types/index.js +0 -0
- /package/{dist → lib}/types/index.js.map +0 -0
- /package/{dist → lib}/types/problems.d.ts +0 -0
- /package/{dist → lib}/types/problems.d.ts.map +0 -0
- /package/{dist → lib}/types/problems.js +0 -0
- /package/{dist → lib}/types/problems.js.map +0 -0
- /package/{dist → lib}/types/reporting.js +0 -0
- /package/{dist → lib}/types/reporting.js.map +0 -0
- /package/{dist → lib}/types/rules.js +0 -0
- /package/{dist → lib}/types/rules.js.map +0 -0
- /package/{dist → lib}/types/validation.js +0 -0
- /package/{dist → lib}/types/validation.js.map +0 -0
|
@@ -1,746 +0,0 @@
|
|
|
1
|
-
// Ported from markdownlint's helpers/micromark-helpers.cjs
|
|
2
|
-
// (https://github.com/DavidAnson/markdownlint, MIT © David Anson).
|
|
3
|
-
// `isBlankLine` is ported from markdownlint's helpers/helpers.cjs (same
|
|
4
|
-
// project/license) since markdownlint splits its token helpers and its
|
|
5
|
-
// generic string helpers across two files; Recheck keeps both here because
|
|
6
|
-
// every ported rule needs both.
|
|
7
|
-
import { newLineRe } from '../../core/line-endings.js';
|
|
8
|
-
import { filterByTypes } from '../../parser/index.js';
|
|
9
|
-
/**
|
|
10
|
-
* Adds a range of numbers (inclusive of both bounds) to a set.
|
|
11
|
-
*/
|
|
12
|
-
export function addRangeToSet(set, start, end) {
|
|
13
|
-
for (let i = start; i <= end; i++) {
|
|
14
|
-
set.add(i);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function positionLessThanOrEqual(lineA, columnA, lineB, columnB) {
|
|
18
|
-
return lineA < lineB || (lineA === lineB && columnA <= columnB);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Returns whether two ranges (or Tokens) overlap anywhere. Ported from
|
|
22
|
-
* markdownlint's helpers/helpers.cjs `hasOverlap`.
|
|
23
|
-
*/
|
|
24
|
-
export function hasOverlap(rangeA, rangeB) {
|
|
25
|
-
const lte = positionLessThanOrEqual(rangeA.startLine, rangeA.startColumn, rangeB.startLine, rangeB.startColumn);
|
|
26
|
-
const first = lte ? rangeA : rangeB;
|
|
27
|
-
const second = lte ? rangeB : rangeA;
|
|
28
|
-
return positionLessThanOrEqual(second.startLine, second.startColumn, first.endLine, first.endColumn);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Filter a token tree, or an arbitrary token array (accepted so
|
|
32
|
-
* `blanksAroundLists`/MD032 can start the walk from `list.children`
|
|
33
|
-
* instead of the whole tree), by predicate — walking depth-first. Ported
|
|
34
|
-
* from upstream's `filterByPredicate(tokens, allowed, transformChildren)`:
|
|
35
|
-
* `transformChildren`, when given, replaces a token's own `children` array
|
|
36
|
-
* for traversal purposes only (the returned `result` array is unaffected) —
|
|
37
|
-
* upstream uses this to redirect traversal into htmlFlow subtokens, and
|
|
38
|
-
* MD032 uses it to stop descending into nested lists (so only *top-level*
|
|
39
|
-
* lists are returned) and to skip "non-content" token subtrees entirely.
|
|
40
|
-
* Omitting `transformChildren` walks every real child, matching every
|
|
41
|
-
* batch 1/2 caller's usage (none needed it before MD032).
|
|
42
|
-
*/
|
|
43
|
-
export function filterByPredicate(tree, predicate, transformChildren) {
|
|
44
|
-
const result = [];
|
|
45
|
-
const startArray = Array.isArray(tree) ? tree : tree.children;
|
|
46
|
-
const queue = [{ array: startArray, index: 0 }];
|
|
47
|
-
while (queue.length > 0) {
|
|
48
|
-
const current = queue[queue.length - 1];
|
|
49
|
-
const { array } = current;
|
|
50
|
-
if (current.index < array.length) {
|
|
51
|
-
const token = array[current.index++];
|
|
52
|
-
if (predicate(token)) {
|
|
53
|
-
result.push(token);
|
|
54
|
-
}
|
|
55
|
-
if (token.children.length > 0) {
|
|
56
|
-
const transformed = transformChildren ? transformChildren(token) : token.children;
|
|
57
|
-
queue.push({ array: transformed, index: 0 });
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
queue.pop();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Gets a list of nested token descendants by type path. Each path element
|
|
68
|
-
* matches one depth of descent and may be a single type or (per upstream's
|
|
69
|
-
* own signature, `helpers/helpers.cjs`'s shared `getDescendantsByType`) an
|
|
70
|
-
* array of alternative types to match at that depth — used by batch 5's
|
|
71
|
-
* `link-image-style` (MD054) for `resourceDestination`'s
|
|
72
|
-
* literal/raw-destination split and `autolink`'s email/protocol split.
|
|
73
|
-
* Earlier batches (see `getHeadingText` below) predate this and call once
|
|
74
|
-
* per alternative instead, merging results themselves; both styles coexist
|
|
75
|
-
* since neither is wrong, but new callers needing an alternation can now
|
|
76
|
-
* use a single call.
|
|
77
|
-
*/
|
|
78
|
-
export function getDescendantsByType(token, typePath) {
|
|
79
|
-
let tokens = [token];
|
|
80
|
-
for (const type of typePath) {
|
|
81
|
-
const matches = Array.isArray(type)
|
|
82
|
-
? (child) => type.includes(child.type)
|
|
83
|
-
: (child) => child.type === type;
|
|
84
|
-
tokens = tokens.flatMap((t) => t.children.filter(matches));
|
|
85
|
-
}
|
|
86
|
-
return tokens;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Gets the nearest parent of one of the specified types for a token.
|
|
90
|
-
*/
|
|
91
|
-
export function getParentOfType(token, types) {
|
|
92
|
-
let current = token;
|
|
93
|
-
while ((current = current.parent) && !types.includes(current.type)) {
|
|
94
|
-
// Empty
|
|
95
|
-
}
|
|
96
|
-
return current;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Gets the heading level of an atx or setext heading token. Matches
|
|
100
|
-
* upstream: looks for a direct child of type `atxHeadingSequence` or
|
|
101
|
-
* `setextHeadingLine` (the setext underline is a direct child of
|
|
102
|
-
* `setextHeading`, not nested further) and reads its level from the text.
|
|
103
|
-
*/
|
|
104
|
-
export function getHeadingLevel(heading) {
|
|
105
|
-
let level = 1;
|
|
106
|
-
const headingSequence = heading.children.find((child) => ['atxHeadingSequence', 'setextHeadingLine'].includes(child.type));
|
|
107
|
-
const text = headingSequence?.text ?? '';
|
|
108
|
-
if (text[0] === '#') {
|
|
109
|
-
level = Math.min(text.length, 6);
|
|
110
|
-
}
|
|
111
|
-
else if (text[0] === '-') {
|
|
112
|
-
level = 2;
|
|
113
|
-
}
|
|
114
|
-
return level;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Gets the heading style of an atx or setext heading token: `'setext'` for
|
|
118
|
-
* setext headings, `'atx'` for a plain atx heading (one `atxHeadingSequence`
|
|
119
|
-
* child), or `'atx_closed'` for a closed atx heading (a trailing
|
|
120
|
-
* `atxHeadingSequence` closing marker as a second direct-child sequence).
|
|
121
|
-
*/
|
|
122
|
-
export function getHeadingStyle(heading) {
|
|
123
|
-
if (heading.type === 'setextHeading') {
|
|
124
|
-
return 'setext';
|
|
125
|
-
}
|
|
126
|
-
const atxHeadingSequenceLength = heading.children.filter((child) => child.type === 'atxHeadingSequence').length;
|
|
127
|
-
return atxHeadingSequenceLength === 1 ? 'atx' : 'atx_closed';
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Gets the heading text of an atx or setext heading token. Descends into
|
|
131
|
-
* `atxHeadingText`/`setextHeadingText` (nested arbitrarily deep under the
|
|
132
|
-
* heading, e.g. inside inline containers) and concatenates all non-htmlText
|
|
133
|
-
* descendant text, collapsing internal newlines (setext headings can span
|
|
134
|
-
* multiple lines) to single spaces.
|
|
135
|
-
*/
|
|
136
|
-
export function getHeadingText(heading) {
|
|
137
|
-
const textTokens = [
|
|
138
|
-
...getDescendantsByType(heading, ['atxHeadingText']),
|
|
139
|
-
...getDescendantsByType(heading, ['setextHeadingText']),
|
|
140
|
-
];
|
|
141
|
-
return textTokens
|
|
142
|
-
.flatMap((descendant) => descendant.children.filter((child) => child.type !== 'htmlText'))
|
|
143
|
-
.map((data) => data.text)
|
|
144
|
-
.join('')
|
|
145
|
-
.replace(newLineRe, ' ');
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Gets the blockquote prefix text (if any) for the specified line number,
|
|
149
|
-
* e.g. `"> "` for a line inside a single-level blockquote. Upstream filters
|
|
150
|
-
* a flat token list by type via `filterByTypes`; Recheck's `TokenTree`
|
|
151
|
-
* already carries a flat list (`tree.flat`), so this takes the tree
|
|
152
|
-
* directly rather than a pre-filtered token array.
|
|
153
|
-
*/
|
|
154
|
-
export function getBlockQuotePrefixText(tree, lineNumber, count = 1) {
|
|
155
|
-
return tree.flat
|
|
156
|
-
.filter((token) => token.type === 'blockQuotePrefix' || token.type === 'linePrefix')
|
|
157
|
-
.filter((prefix) => prefix.startLine === lineNumber)
|
|
158
|
-
.map((prefix) => prefix.text)
|
|
159
|
-
.join('')
|
|
160
|
-
.trimEnd()
|
|
161
|
-
.concat('\n')
|
|
162
|
-
.repeat(count);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Returns true iff the input line is blank (contains nothing, whitespace,
|
|
166
|
-
* blockquote markers, or HTML comments (unclosed start/end comments
|
|
167
|
-
* allowed)). Ported from markdownlint's helpers/helpers.cjs `isBlankLine`.
|
|
168
|
-
*/
|
|
169
|
-
export function isBlankLine(line) {
|
|
170
|
-
const startComment = '<!--';
|
|
171
|
-
const endComment = '-->';
|
|
172
|
-
const removeComments = (s) => {
|
|
173
|
-
for (;;) {
|
|
174
|
-
const start = s.indexOf(startComment);
|
|
175
|
-
const end = s.indexOf(endComment);
|
|
176
|
-
if (end !== -1 && (start === -1 || end < start)) {
|
|
177
|
-
// Unmatched end comment is first
|
|
178
|
-
s = s.slice(end + endComment.length);
|
|
179
|
-
}
|
|
180
|
-
else if (start !== -1 && end !== -1) {
|
|
181
|
-
// Start comment is before end comment
|
|
182
|
-
s = s.slice(0, start) + s.slice(end + endComment.length);
|
|
183
|
-
}
|
|
184
|
-
else if (start !== -1 && end === -1) {
|
|
185
|
-
// Unmatched start comment is last
|
|
186
|
-
s = s.slice(0, start);
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
// No more comments to remove
|
|
190
|
-
return s;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
return !line || !line.trim() || !removeComments(line).replace(/>/g, '').trim();
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Set of token types that do not contain document content (used to skip
|
|
198
|
-
* over "non-content" tokens — indentation, blank lines, container prefixes
|
|
199
|
-
* — when scanning for a document's first meaningful token). Ported from
|
|
200
|
-
* markdownlint's helpers/micromark-helpers.cjs `nonContentTokens`.
|
|
201
|
-
*/
|
|
202
|
-
export const nonContentTokens = new Set([
|
|
203
|
-
'blockQuoteMarker',
|
|
204
|
-
'blockQuotePrefix',
|
|
205
|
-
'blockQuotePrefixWhitespace',
|
|
206
|
-
'gfmFootnoteDefinitionIndent',
|
|
207
|
-
'lineEnding',
|
|
208
|
-
'lineEndingBlank',
|
|
209
|
-
'linePrefix',
|
|
210
|
-
'listItemIndent',
|
|
211
|
-
'undefinedReference',
|
|
212
|
-
'undefinedReferenceCollapsed',
|
|
213
|
-
'undefinedReferenceFull',
|
|
214
|
-
'undefinedReferenceShortcut',
|
|
215
|
-
]);
|
|
216
|
-
/**
|
|
217
|
-
* Returns the last line number (1-based, inclusive) of the document's YAML
|
|
218
|
-
* frontmatter block, or 0 if there is none.
|
|
219
|
-
*
|
|
220
|
-
* Upstream markdownlint slices frontmatter out of `content` entirely
|
|
221
|
-
* before tokenizing (see markdownlint's `removeFrontMatter`) — every
|
|
222
|
-
* rule's `params.lines`/token stream is already frontmatter-free, with
|
|
223
|
-
* `frontMatterLines.length` added back only when reporting an error's line
|
|
224
|
-
* number. Recheck's parser instead keeps a `yaml` token (and all its
|
|
225
|
-
* descendant tokens — `yamlFence`, `yamlValue`, etc. — individually
|
|
226
|
-
* present in `tree.flat`, a full depth-first flattening) as real content.
|
|
227
|
-
* Rules that scan `ctx.lines` by index, or walk `ctx.tree.flat` from the
|
|
228
|
-
* top of the document looking for the first "real" token, must skip every
|
|
229
|
-
* line up to and including this one to match upstream's behavior — see
|
|
230
|
-
* first-line-h1.ts, single-h1.ts, and line-length.ts for call sites.
|
|
231
|
-
*/
|
|
232
|
-
export function getFrontmatterEndLine(tree) {
|
|
233
|
-
const frontmatter = tree.flat.find((token) => token.type === 'yaml');
|
|
234
|
-
return frontmatter?.endLine ?? 0;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Returns true iff the document's YAML front matter contains a title — i.e.
|
|
238
|
-
* the `pattern` regex matches at least one of the front matter block's lines.
|
|
239
|
-
*
|
|
240
|
-
* WHY THIS EXISTS: it ports upstream markdownlint's `front_matter_title`
|
|
241
|
-
* rule option (implemented there by helpers/helpers.cjs's own
|
|
242
|
-
* `frontMatterHasTitle`), which exists on exactly three upstream rules —
|
|
243
|
-
* MD001 (our heading-increment), MD025 (single-h1), and MD041
|
|
244
|
-
* (first-line-h1); see
|
|
245
|
-
* https://github.com/DavidAnson/markdownlint/blob/main/doc/md001.md.
|
|
246
|
-
* When the front matter declares a title, it counts as the document's
|
|
247
|
-
* implicit top-level (h1) heading:
|
|
248
|
-
* - heading-increment then expects the first body heading to be an h2;
|
|
249
|
-
* - single-h1 treats it as the document's one H1, so EVERY body h1 is a
|
|
250
|
-
* violation;
|
|
251
|
-
* - first-line-h1 is satisfied by it outright and checks nothing else.
|
|
252
|
-
*
|
|
253
|
-
* The default pattern is `^\s*"?title"?\s*[:=]`: a `title` key, optionally
|
|
254
|
-
* double-quoted, followed by `:` (YAML) or `=` (TOML-style front matter),
|
|
255
|
-
* matched case-insensitively. Each of the three rules declares that default
|
|
256
|
-
* in its own `defaults` object — exactly as each upstream rule declares its
|
|
257
|
-
* own default — and this helper only encapsulates the matching.
|
|
258
|
-
*
|
|
259
|
-
* CONTRACT: `pattern` is the raw config value (`ctx.config.frontMatterTitle`);
|
|
260
|
-
* configuring the empty string `''` (or a nullish value) disables the
|
|
261
|
-
* behavior entirely — this helper then always returns false — matching
|
|
262
|
-
* upstream's documented "specify `""` for `front_matter_title`" opt-out.
|
|
263
|
-
*
|
|
264
|
-
* Upstream builds the regex with the `i` flag only and tests it against each
|
|
265
|
-
* front matter LINE individually (`frontMatterLines.some(...)`), where
|
|
266
|
-
* `frontMatterLines` is the whole regex-matched front matter block —
|
|
267
|
-
* INCLUDING both delimiter fence lines — split on line endings (see
|
|
268
|
-
* markdownlint's `removeFrontMatter`). Recheck's parser keeps that same
|
|
269
|
-
* block as one `yaml` token (see getFrontmatterEndLine's doc comment above)
|
|
270
|
-
* whose text spans opening fence through closing fence with no trailing
|
|
271
|
-
* newline, so splitting it on `newLineRe` reproduces upstream's lines
|
|
272
|
-
* exactly, and the regex is tested per line here too. (Testing the whole
|
|
273
|
-
* block with `im` instead is NOT equivalent: a custom pattern containing a
|
|
274
|
-
* literal `\n`, or one where `\s*`/`[\s\S]*` can absorb a line ending —
|
|
275
|
-
* e.g. `author:.*\s*title` — would match across lines, which upstream
|
|
276
|
-
* never does.)
|
|
277
|
-
*/
|
|
278
|
-
export function frontMatterHasTitle(tree, pattern) {
|
|
279
|
-
const frontMatterTitle = String(pattern ?? '');
|
|
280
|
-
if (!frontMatterTitle)
|
|
281
|
-
return false;
|
|
282
|
-
const frontmatter = tree.flat.find((token) => token.type === 'yaml');
|
|
283
|
-
if (frontmatter === undefined)
|
|
284
|
-
return false;
|
|
285
|
-
const frontMatterTitleRe = new RegExp(frontMatterTitle, 'i');
|
|
286
|
-
return frontmatter.text.split(newLineRe).some((line) => frontMatterTitleRe.test(line));
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Returns true iff the token is an HTML comment (`<!-- ... -->`) that is
|
|
290
|
-
* valid per the CommonMark spec (comment body doesn't start with `>` or
|
|
291
|
-
* `->`, and doesn't end with `-`). Ported from markdownlint's
|
|
292
|
-
* helpers/micromark-helpers.cjs `isHtmlFlowComment`.
|
|
293
|
-
*/
|
|
294
|
-
export function isHtmlFlowComment(token) {
|
|
295
|
-
const { text, type } = token;
|
|
296
|
-
if (type === 'htmlFlow' && text.startsWith('<!--') && text.endsWith('-->')) {
|
|
297
|
-
const comment = text.slice(4, -3);
|
|
298
|
-
return !comment.startsWith('>') && !comment.startsWith('->') && !comment.endsWith('-');
|
|
299
|
-
}
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
const htmlCommentBegin = '<!--';
|
|
303
|
-
const htmlCommentEnd = '-->';
|
|
304
|
-
const safeCommentCharacter = '.';
|
|
305
|
-
const startsWithPipeRe = /^ *\|/;
|
|
306
|
-
const notCrLfRe = /[^\r\n]/g;
|
|
307
|
-
const notSpaceCrLfRe = /[^ \r\n]/g;
|
|
308
|
-
const trailingSpaceRe = / +[\r\n]/g;
|
|
309
|
-
const replaceTrailingSpace = (s) => s.replace(notCrLfRe, safeCommentCharacter);
|
|
310
|
-
/**
|
|
311
|
-
* Replaces the content of valid CommonMark HTML comments with the `.`
|
|
312
|
-
* "safe" character, preserving every line/column position in the rest of
|
|
313
|
-
* the document (never removes characters, never touches `\r`/`\n`).
|
|
314
|
-
* Ported from markdownlint's helpers/helpers.cjs `clearHtmlCommentText`.
|
|
315
|
-
*
|
|
316
|
-
* This is upstream's OWN pre-processing pass -- run once, globally, before
|
|
317
|
-
* `params.lines` is computed -- so that rules doing plain text/line
|
|
318
|
-
* scanning (as opposed to token-tree scanning) never see real content
|
|
319
|
-
* inside an HTML comment: trailing whitespace inside a comment isn't
|
|
320
|
-
* "trailing whitespace" (MD009), a tab inside a comment isn't a "hard
|
|
321
|
-
* tab" (MD010), reversed-link syntax inside a comment isn't a broken link
|
|
322
|
-
* (MD011), etc. Token-tree-based scanning (e.g. MD033/MD037, which read
|
|
323
|
-
* `params.parsers.micromark.tokens`) is unaffected -- those tokens are
|
|
324
|
-
* built from the ORIGINAL, uncleared content upstream, matching how
|
|
325
|
-
* recheck's own token tree (`ctx.tree`) is never cleared either; only
|
|
326
|
-
* `ctx.lines` (see core/runner.ts) uses this cleared text.
|
|
327
|
-
*/
|
|
328
|
-
export function clearHtmlCommentText(text) {
|
|
329
|
-
let i = 0;
|
|
330
|
-
while ((i = text.indexOf(htmlCommentBegin, i)) !== -1) {
|
|
331
|
-
const j = text.indexOf(htmlCommentEnd, i + 2);
|
|
332
|
-
if (j === -1) {
|
|
333
|
-
// Unterminated comments are treated as text.
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
336
|
-
if (j > i + htmlCommentBegin.length) {
|
|
337
|
-
const content = text.slice(i + htmlCommentBegin.length, j);
|
|
338
|
-
const lastLf = text.lastIndexOf('\n', i) + 1;
|
|
339
|
-
const preText = text.slice(lastLf, i);
|
|
340
|
-
const isBlock = preText.trim().length === 0;
|
|
341
|
-
const couldBeTable = startsWithPipeRe.test(preText);
|
|
342
|
-
const spansTableCells = couldBeTable && content.includes('\n');
|
|
343
|
-
const isValid = isBlock ||
|
|
344
|
-
!(spansTableCells ||
|
|
345
|
-
content.startsWith('>') ||
|
|
346
|
-
content.startsWith('->') ||
|
|
347
|
-
content.endsWith('-') ||
|
|
348
|
-
content.includes('--'));
|
|
349
|
-
if (isValid) {
|
|
350
|
-
const clearedContent = content
|
|
351
|
-
.replace(notSpaceCrLfRe, safeCommentCharacter)
|
|
352
|
-
.replace(trailingSpaceRe, replaceTrailingSpace);
|
|
353
|
-
text = text.slice(0, i + htmlCommentBegin.length) + clearedContent + text.slice(j);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
i = j + htmlCommentEnd.length;
|
|
357
|
-
}
|
|
358
|
-
return text;
|
|
359
|
-
}
|
|
360
|
-
const docfxTabSyntaxRe = /^#tab\//;
|
|
361
|
-
/**
|
|
362
|
-
* Returns true iff the heading is a DocFX tab heading (an atx heading whose
|
|
363
|
-
* entire text is a single link with a `#tab/...` destination) — see
|
|
364
|
-
* https://dotnet.github.io/docfx/docs/markdown.html?tabs=linux%2Cdotnet#tabs.
|
|
365
|
-
* Ported from markdownlint's helpers/micromark-helpers.cjs `isDocfxTab`.
|
|
366
|
-
*/
|
|
367
|
-
// Regular expression for identifying an HTML entity at the end of a line.
|
|
368
|
-
// Ported from markdownlint's helpers/helpers.cjs `endOfLineHtmlEntityRe`.
|
|
369
|
-
export const endOfLineHtmlEntityRe = /&(?:#\d+|#[xX][\da-fA-F]+|[a-zA-Z]{2,31}|blk\d{2}|emsp1[34]|frac\d{2}|sup\d|there4);$/;
|
|
370
|
-
// Regular expression for identifying a GitHub emoji code at the end of a
|
|
371
|
-
// line. Ported from markdownlint's helpers/helpers.cjs `endOfLineGemojiCodeRe`.
|
|
372
|
-
export const endOfLineGemojiCodeRe = /:(?:[abmovx]|[-+]1|100|1234|(?:1st|2nd|3rd)_place_medal|8ball|clock\d{1,4}|e-mail|non-potable_water|o2|t-rex|u5272|u5408|u55b6|u6307|u6708|u6709|u6e80|u7121|u7533|u7981|u7a7a|[a-z]{2,15}2?|[a-z]{1,14}(?:_[a-z\d]{1,16})+):$/;
|
|
373
|
-
// All punctuation characters (normal and full-width). Ported from
|
|
374
|
-
// markdownlint's helpers/helpers.cjs `allPunctuation`.
|
|
375
|
-
export const allPunctuation = '.,;:!?。,;:!?';
|
|
376
|
-
// All punctuation characters without question mark (normal and
|
|
377
|
-
// full-width). Ported from markdownlint's helpers/helpers.cjs
|
|
378
|
-
// `allPunctuationNoQuestion`.
|
|
379
|
-
export const allPunctuationNoQuestion = allPunctuation.replace(/[??]/gu, '');
|
|
380
|
-
/**
|
|
381
|
-
* Escapes a string for safe use inside a RegExp character class/pattern.
|
|
382
|
-
* Ported from markdownlint's helpers/helpers.cjs `escapeForRegExp`.
|
|
383
|
-
*/
|
|
384
|
-
export function escapeForRegExp(str) {
|
|
385
|
-
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
386
|
-
}
|
|
387
|
-
const loneSurrogateRe = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
|
|
388
|
-
/**
|
|
389
|
-
* Replaces lone (unpaired) surrogate code units with U+FFFD, matching the
|
|
390
|
-
* behavior of `String.prototype.toWellFormed()` (ES2024). Recheck's
|
|
391
|
-
* `tsconfig.json` targets ES2021 (shared across the whole package, not
|
|
392
|
-
* something this rule port should widen), so `link-fragments` (MD051) —
|
|
393
|
-
* the only upstream rule using `.toWellFormed()` (on heading/fragment text
|
|
394
|
-
* before `encodeURIComponent`, which throws on lone surrogates) — calls
|
|
395
|
-
* this instead of the native method.
|
|
396
|
-
*/
|
|
397
|
-
export function toWellFormedString(str) {
|
|
398
|
-
return str.replace(loneSurrogateRe, '�');
|
|
399
|
-
}
|
|
400
|
-
const htmlTagNameRe = /^<([^!>][^/\s>]*)/;
|
|
401
|
-
/**
|
|
402
|
-
* Gets information about the tag in an HTML token (an `htmlText` token's
|
|
403
|
-
* opening `<tag ...>` or closing `</tag>`), or `null` if the token's text
|
|
404
|
-
* doesn't start with a recognizable tag (e.g. an HTML comment). Ported from
|
|
405
|
-
* markdownlint's helpers/micromark-helpers.cjs `getHtmlTagInfo`.
|
|
406
|
-
*/
|
|
407
|
-
export function getHtmlTagInfo(token) {
|
|
408
|
-
if (token.type === 'htmlText') {
|
|
409
|
-
const match = htmlTagNameRe.exec(token.text);
|
|
410
|
-
if (match) {
|
|
411
|
-
const name = match[1];
|
|
412
|
-
const close = name.startsWith('/');
|
|
413
|
-
return { close, name: close ? name.slice(1) : name };
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
return null;
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* Builds a RegExp for matching the specified HTML attribute (e.g. `alt=`,
|
|
420
|
-
* `id=`) within a raw HTML tag's text, capturing its (optionally quoted)
|
|
421
|
-
* value. Ported from markdownlint's helpers/helpers.cjs `getHtmlAttributeRe`.
|
|
422
|
-
*/
|
|
423
|
-
export function getHtmlAttributeRe(name) {
|
|
424
|
-
return new RegExp(`\\s${name}\\s*=\\s*['"]?([^'"\\s>]*)`, 'iu');
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Truncates long text for use in error context, keeping the start, end, or
|
|
428
|
-
* both ends depending on which end(s) matter. Ported from markdownlint's
|
|
429
|
-
* helpers/helpers.cjs `ellipsify`.
|
|
430
|
-
*/
|
|
431
|
-
export function ellipsify(text, start, end) {
|
|
432
|
-
if (text.length <= 30) {
|
|
433
|
-
// Nothing to do
|
|
434
|
-
}
|
|
435
|
-
else if (start && end) {
|
|
436
|
-
text = text.slice(0, 15) + '...' + text.slice(-15);
|
|
437
|
-
}
|
|
438
|
-
else if (end) {
|
|
439
|
-
text = '...' + text.slice(-30);
|
|
440
|
-
}
|
|
441
|
-
else {
|
|
442
|
-
text = text.slice(0, 30) + '...';
|
|
443
|
-
}
|
|
444
|
-
return text;
|
|
445
|
-
}
|
|
446
|
-
export function isDocfxTab(heading) {
|
|
447
|
-
if (heading?.type === 'atxHeading') {
|
|
448
|
-
const headingTexts = getDescendantsByType(heading, ['atxHeadingText']);
|
|
449
|
-
if (headingTexts.length === 1 &&
|
|
450
|
-
headingTexts[0].children.length === 1 &&
|
|
451
|
-
headingTexts[0].children[0].type === 'link') {
|
|
452
|
-
// `resourceDestinationString` nests several levels deep under the
|
|
453
|
-
// link (link > resource > resourceDestination >
|
|
454
|
-
// resourceDestinationRaw/Literal > resourceDestinationString), not
|
|
455
|
-
// as a direct child of the link -- matches upstream's own
|
|
456
|
-
// `filterByTypes(..., ["resourceDestinationString"])`, which walks
|
|
457
|
-
// to any depth, so this must use the recursive descendant helper
|
|
458
|
-
// (`filterByPredicate`) rather than a direct `.children.filter(...)`.
|
|
459
|
-
const resourceDestinationStrings = filterByPredicate(headingTexts[0].children[0].children, (child) => child.type === 'resourceDestinationString');
|
|
460
|
-
return (resourceDestinationStrings.length === 1 &&
|
|
461
|
-
docfxTabSyntaxRe.test(resourceDestinationStrings[0].text));
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return false;
|
|
465
|
-
}
|
|
466
|
-
export function normalizeReference(s) {
|
|
467
|
-
return s.toLowerCase().trim().replace(/\s+/g, ' ');
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Returns information about reference-style links/images and their
|
|
471
|
-
* definitions across the whole document: which labels are defined, which
|
|
472
|
-
* are used (split into "full/collapsed" `references` vs "shortcut"
|
|
473
|
-
* `shortcuts`, since shortcut syntax is ambiguous with plain bracketed
|
|
474
|
-
* text), and which definitions are duplicates. Ported from markdownlint's
|
|
475
|
-
* helpers/helpers.cjs `getReferenceLinkImageData` (there, cached per-lint-
|
|
476
|
-
* run by lib/cache.mjs; Recheck's token rules have no shared per-run cache
|
|
477
|
-
* — see no-empty-links.ts's doc comment for the established precedent — so
|
|
478
|
-
* each of MD051/052/053/054 calls this fresh over the same tree).
|
|
479
|
-
*
|
|
480
|
-
* DEVIATION: upstream additionally detects reference syntax that fails to
|
|
481
|
-
* resolve to any definition at all (`undefinedReferenceShortcut/Collapsed/
|
|
482
|
-
* Full`) by monkeypatching micromark's internal `labelEnd` tokenizer
|
|
483
|
-
* (lib/micromark-parse.mjs) to synthesize tokens when label resolution
|
|
484
|
-
* backtracks to failure. Recheck's parser (src/parser/index.ts) is a much
|
|
485
|
-
* thinner micromark wrapper with no equivalent hook, and reproducing that
|
|
486
|
-
* shim correctly is a parser-level change out of scope for a rule port.
|
|
487
|
-
* Without it, an *undefined* reference/shortcut never becomes a `link`/
|
|
488
|
-
* `image`/`gfmFootnoteCall` token in Recheck's tree in the first place —
|
|
489
|
-
* it decomposes into plain `data` tokens — so there is no token for this
|
|
490
|
-
* function to inspect for that case via the token-shape path alone.
|
|
491
|
-
* `scanUndefinedReferences` below is a conservative, best-effort text-scan
|
|
492
|
-
* fallback (restricted to direct `data`/`lineEnding` children of a single
|
|
493
|
-
* container, requiring non-nested single-bracket-depth text with no `]`
|
|
494
|
-
* inside — mirroring the upstream shim's own `!text.includes("]")` guard)
|
|
495
|
-
* so MD052 (whose entire purpose is detecting undefined references) is not
|
|
496
|
-
* a permanent no-op; it is not a byte-for-byte port of the shim and may
|
|
497
|
-
* miss or mis-slice pathological/multi-line cases the real shim handles
|
|
498
|
-
* via micromark's own backtracking state. MD053's `duplicateDefinitions`/
|
|
499
|
-
* `definitions` and MD054's `definitions` lookups don't depend on this
|
|
500
|
-
* fallback at all (they only need successfully-resolved usages), so this
|
|
501
|
-
* deviation is fully scoped to MD052.
|
|
502
|
-
*/
|
|
503
|
-
export function getReferenceLinkImageData(tree) {
|
|
504
|
-
const references = new Map();
|
|
505
|
-
const shortcuts = new Map();
|
|
506
|
-
const definitions = new Map();
|
|
507
|
-
const duplicateDefinitions = [];
|
|
508
|
-
const addReferenceToDictionary = (token, label, isShortcut) => {
|
|
509
|
-
const datum = [token.startLine - 1, token.startColumn - 1, token.text.length];
|
|
510
|
-
const dictionary = isShortcut ? shortcuts : references;
|
|
511
|
-
const reference = normalizeReference(label);
|
|
512
|
-
const existing = dictionary.get(reference) ?? [];
|
|
513
|
-
existing.push(datum);
|
|
514
|
-
dictionary.set(reference, existing);
|
|
515
|
-
};
|
|
516
|
-
// Matches upstream's own token text, filtering out blockQuotePrefix
|
|
517
|
-
// children (a label can span blockquote-prefixed lines).
|
|
518
|
-
const getText = (token) => token?.children
|
|
519
|
-
.filter((c) => c.type !== 'blockQuotePrefix')
|
|
520
|
-
.map((c) => c.text)
|
|
521
|
-
.join('') ?? '';
|
|
522
|
-
for (const token of tree.flat) {
|
|
523
|
-
switch (token.type) {
|
|
524
|
-
case 'definitionLabelString':
|
|
525
|
-
case 'gfmFootnoteDefinitionLabelString': {
|
|
526
|
-
const labelPrefix = token.type === 'gfmFootnoteDefinitionLabelString' ? '^' : '';
|
|
527
|
-
const reference = normalizeReference(`${labelPrefix}${token.text}`);
|
|
528
|
-
if (definitions.has(reference)) {
|
|
529
|
-
duplicateDefinitions.push([reference, token.startLine - 1]);
|
|
530
|
-
}
|
|
531
|
-
else {
|
|
532
|
-
const parent = getParentOfType(token, ['definition', 'gfmFootnoteDefinition']);
|
|
533
|
-
const destinationStringRaw = parent
|
|
534
|
-
? getDescendantsByType(parent, [
|
|
535
|
-
'definitionDestination',
|
|
536
|
-
'definitionDestinationRaw',
|
|
537
|
-
'definitionDestinationString',
|
|
538
|
-
])[0]
|
|
539
|
-
: undefined;
|
|
540
|
-
const destinationStringLiteral = parent
|
|
541
|
-
? getDescendantsByType(parent, [
|
|
542
|
-
'definitionDestination',
|
|
543
|
-
'definitionDestinationLiteral',
|
|
544
|
-
'definitionDestinationString',
|
|
545
|
-
])[0]
|
|
546
|
-
: undefined;
|
|
547
|
-
definitions.set(reference, [
|
|
548
|
-
token.startLine - 1,
|
|
549
|
-
(destinationStringRaw ?? destinationStringLiteral)?.text ?? '',
|
|
550
|
-
]);
|
|
551
|
-
}
|
|
552
|
-
break;
|
|
553
|
-
}
|
|
554
|
-
case 'gfmFootnoteCall':
|
|
555
|
-
case 'image':
|
|
556
|
-
case 'link': {
|
|
557
|
-
const isShortcut = token.children.length === 1;
|
|
558
|
-
const isFullOrCollapsed = token.children.length === 2 && !token.children.some((t) => t.type === 'resource');
|
|
559
|
-
const labelText = getDescendantsByType(token, ['label', 'labelText'])[0];
|
|
560
|
-
const referenceString = getDescendantsByType(token, ['reference', 'referenceString'])[0];
|
|
561
|
-
let label = getText(labelText);
|
|
562
|
-
let shortcut = isShortcut;
|
|
563
|
-
if (!isShortcut && !isFullOrCollapsed) {
|
|
564
|
-
const footnoteCallMarker = token.children.find((t) => t.type === 'gfmFootnoteCallMarker');
|
|
565
|
-
const footnoteCallString = token.children.find((t) => t.type === 'gfmFootnoteCallString');
|
|
566
|
-
if (footnoteCallMarker && footnoteCallString) {
|
|
567
|
-
label = `${footnoteCallMarker.text}${footnoteCallString.text}`;
|
|
568
|
-
shortcut = true;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
if (shortcut || isFullOrCollapsed) {
|
|
572
|
-
addReferenceToDictionary(token, getText(referenceString) || label, shortcut);
|
|
573
|
-
}
|
|
574
|
-
break;
|
|
575
|
-
}
|
|
576
|
-
default:
|
|
577
|
-
break;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
scanUndefinedReferences(tree, addReferenceToDictionary);
|
|
581
|
-
return { references, shortcuts, definitions, duplicateDefinitions };
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Resolves every `image` token in the tree to its destination path/URL —
|
|
585
|
-
* both inline syntax (``, including angle-bracket
|
|
586
|
-
* literal destinations) and reference syntax (`![alt][ref]`, `![alt][]`,
|
|
587
|
-
* `![alt]`), the latter resolved through `getReferenceLinkImageData`'s
|
|
588
|
-
* `definitions` map the same way `link-image-style.ts` (MD054) resolves a
|
|
589
|
-
* reference link/image's destination for its autolink-eligibility check.
|
|
590
|
-
* An image whose reference never resolves to a definition never becomes an
|
|
591
|
-
* `image` token in the first place (see `getReferenceLinkImageData`'s
|
|
592
|
-
* DEVIATION note above) — there's no token to report for those here,
|
|
593
|
-
* matching every other AST-based rule's treatment of the same tree.
|
|
594
|
-
*
|
|
595
|
-
* Shared by `rules/scope/max-image-size.ts` (the rule that flags oversized
|
|
596
|
-
* images) and `core/files.ts`'s `extractImageReferences` (the on-disk
|
|
597
|
-
* metadata loader): a single extraction pass so both sides always agree on
|
|
598
|
-
* exactly which destination string keys a given image's on-disk stats in
|
|
599
|
-
* `ScopeRuleContext.fileMetadata.images`.
|
|
600
|
-
*/
|
|
601
|
-
export function getImageDestinations(tree) {
|
|
602
|
-
const { definitions } = getReferenceLinkImageData(tree);
|
|
603
|
-
const results = [];
|
|
604
|
-
for (const image of filterByTypes(tree, ['image'])) {
|
|
605
|
-
const inlineDestination = getDescendantsByType(image, [
|
|
606
|
-
'resource',
|
|
607
|
-
'resourceDestination',
|
|
608
|
-
['resourceDestinationLiteral', 'resourceDestinationRaw'],
|
|
609
|
-
'resourceDestinationString',
|
|
610
|
-
])[0]?.text;
|
|
611
|
-
let destination = inlineDestination;
|
|
612
|
-
if (destination === undefined) {
|
|
613
|
-
const label = getDescendantsByType(image, ['label', 'labelText'])[0]?.text ?? '';
|
|
614
|
-
const referenceString = getDescendantsByType(image, ['reference', 'referenceString'])[0]
|
|
615
|
-
?.text;
|
|
616
|
-
destination = definitions.get(normalizeReference(referenceString || label))?.[1];
|
|
617
|
-
}
|
|
618
|
-
if (destination) {
|
|
619
|
-
results.push({ token: image, destination });
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
return results;
|
|
623
|
-
}
|
|
624
|
-
const undefinedReferenceTextChildTypes = new Set(['data', 'lineEnding']);
|
|
625
|
-
// Matches a single bracket-depth-1 span with no embedded `]`, optionally
|
|
626
|
-
// immediately followed by a second such span (the "full"/"collapsed"
|
|
627
|
-
// reference's own label) -- e.g. `[text][label]`, `[label][]`, `[label]`.
|
|
628
|
-
// Mirrors upstream's shim constraints (`!text.includes("]")`,
|
|
629
|
-
// adjacency-only pairing) closely enough for ordinary single-line prose.
|
|
630
|
-
const undefinedReferenceRe = /\[([^[\]]*)\](?:\[([^[\]]*)\])?/g;
|
|
631
|
-
/**
|
|
632
|
-
* Best-effort fallback (see `getReferenceLinkImageData`'s DEVIATION note)
|
|
633
|
-
* for finding bracket-delimited text that *looks like* a reference or
|
|
634
|
-
* shortcut link/image but didn't resolve to a real `link`/`image`/
|
|
635
|
-
* `gfmFootnoteCall` token (no matching definition, or no definition at
|
|
636
|
-
* all) -- so there is no such token in Recheck's tree to inspect directly.
|
|
637
|
-
* Reconstructs each inline container's (paragraph, heading text, table
|
|
638
|
-
* cell, etc.) *plain-text* content by concatenating runs of its direct
|
|
639
|
-
* `data`/`lineEnding` children, breaking a run whenever a non-text child
|
|
640
|
-
* (a real `link`/`image`/`gfmFootnoteCall`, a code span, emphasis, an
|
|
641
|
-
* escape, etc.) is encountered -- so a real link/image token no longer
|
|
642
|
-
* hides the plain text around it (see FINDING 2 below), but text is never
|
|
643
|
-
* bridged *across* one of those tokens either, since that would splice
|
|
644
|
-
* unrelated brackets together. Each run is regex-scanned independently,
|
|
645
|
-
* mapping match offsets back to line/column via each source token's own
|
|
646
|
-
* span. This intentionally never looks *inside* a non-text child itself --
|
|
647
|
-
* exactly the cases upstream's own `!text.includes("]")` / bracket-depth-1
|
|
648
|
-
* guards are built to approximate -- so escaped brackets, code-span
|
|
649
|
-
* brackets, and brackets inside a resolved link's title are never
|
|
650
|
-
* revisited here (they already live inside a different token type
|
|
651
|
-
* entirely, see helpers.ts's `getReferenceLinkImageData` module doc for
|
|
652
|
-
* confirmed parser shapes).
|
|
653
|
-
*
|
|
654
|
-
* FINDING 1: a candidate label that trims to empty (e.g. the `" "` between
|
|
655
|
-
* a task-list checkbox's brackets, `[ ]`) is never a real reference or
|
|
656
|
-
* shortcut -- mirrors upstream's own `labelEnd` tokenizer shim, which only
|
|
657
|
-
* synthesizes an `undefinedReference*` token when
|
|
658
|
-
* `text.trim().length > 0` (see markdownlint's lib/micromark-parse.mjs).
|
|
659
|
-
* Skipping these also means `reference-links-images`' `ignoredLabels`
|
|
660
|
-
* flow is unaffected: an empty label is discarded before it ever reaches
|
|
661
|
-
* `addReferenceToDictionary`, so it can never collide with (or need) an
|
|
662
|
-
* ignored-label entry.
|
|
663
|
-
*
|
|
664
|
-
* FINDING 2: previously this function required a container's *entire*
|
|
665
|
-
* child list to be `data`/`lineEnding` before scanning it at all, so a
|
|
666
|
-
* paragraph mixing plain bracket text with so much as one real link (e.g.
|
|
667
|
-
* `[undef] and [real](url)`) was skipped in full -- silently dropping the
|
|
668
|
-
* plain-text `[undef]` alongside it. Segmenting into runs (rather than
|
|
669
|
-
* requiring whole-container purity) fixes this while still never reading
|
|
670
|
-
* through a real inline token.
|
|
671
|
-
*/
|
|
672
|
-
function scanUndefinedReferences(tree, addReferenceToDictionary) {
|
|
673
|
-
const containers = filterByPredicate(tree, (token) => token.children.some((child) => undefinedReferenceTextChildTypes.has(child.type)));
|
|
674
|
-
for (const container of containers) {
|
|
675
|
-
// Split the container's children into runs of contiguous `data`/
|
|
676
|
-
// `lineEnding` children, broken by any other (non-text) child -- each
|
|
677
|
-
// run is scanned independently so text never bridges across a real
|
|
678
|
-
// link/image/code-span/etc. token.
|
|
679
|
-
let run = [];
|
|
680
|
-
const runs = [];
|
|
681
|
-
for (const child of container.children) {
|
|
682
|
-
if (undefinedReferenceTextChildTypes.has(child.type)) {
|
|
683
|
-
run.push(child);
|
|
684
|
-
}
|
|
685
|
-
else if (run.length > 0) {
|
|
686
|
-
runs.push(run);
|
|
687
|
-
run = [];
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
if (run.length > 0)
|
|
691
|
-
runs.push(run);
|
|
692
|
-
for (const textRun of runs) {
|
|
693
|
-
// Build the run's full text plus a per-character line/column map (a
|
|
694
|
-
// `lineEnding` child contributes a single `\n` to the text so
|
|
695
|
-
// offsets stay aligned).
|
|
696
|
-
const positions = [];
|
|
697
|
-
let text = '';
|
|
698
|
-
for (const child of textRun) {
|
|
699
|
-
if (child.type === 'lineEnding') {
|
|
700
|
-
positions.push({ line: child.startLine, column: child.startColumn });
|
|
701
|
-
text += '\n';
|
|
702
|
-
continue;
|
|
703
|
-
}
|
|
704
|
-
for (let i = 0; i < child.text.length; i++) {
|
|
705
|
-
positions.push({ line: child.startLine, column: child.startColumn + i });
|
|
706
|
-
}
|
|
707
|
-
text += child.text;
|
|
708
|
-
}
|
|
709
|
-
undefinedReferenceRe.lastIndex = 0;
|
|
710
|
-
let match;
|
|
711
|
-
while ((match = undefinedReferenceRe.exec(text)) !== null) {
|
|
712
|
-
const [full, firstText, secondText] = match;
|
|
713
|
-
const { line, column } = positions[match.index];
|
|
714
|
-
const spanToken = {
|
|
715
|
-
type: 'synthetic-reference-span',
|
|
716
|
-
startLine: line,
|
|
717
|
-
startColumn: column,
|
|
718
|
-
endLine: line,
|
|
719
|
-
endColumn: column + full.length,
|
|
720
|
-
text: full,
|
|
721
|
-
children: [],
|
|
722
|
-
parent: null,
|
|
723
|
-
};
|
|
724
|
-
if (secondText === undefined) {
|
|
725
|
-
// Shortcut: [label]
|
|
726
|
-
if (firstText.trim().length > 0) {
|
|
727
|
-
addReferenceToDictionary(spanToken, firstText.trim(), true);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
else if (secondText.length === 0) {
|
|
731
|
-
// Collapsed: [label][]
|
|
732
|
-
if (firstText.trim().length > 0) {
|
|
733
|
-
addReferenceToDictionary(spanToken, firstText.trim(), false);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
else {
|
|
737
|
-
// Full: [text][label]
|
|
738
|
-
if (secondText.trim().length > 0) {
|
|
739
|
-
addReferenceToDictionary(spanToken, secondText.trim(), false);
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
//# sourceMappingURL=helpers.js.map
|