@redocly/recheck 0.15.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 -1886
- 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 -1315
- 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 -98
- 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 -74
- 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 -121
- 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
package/dist/core/files.js
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs/promises';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import picomatch from 'picomatch';
|
|
4
|
-
import { parseMarkdown } from '../parser/index.js';
|
|
5
|
-
import { getImageDestinations } from '../rules/token/helpers.js';
|
|
6
|
-
const SKIP_DIRS = ['node_modules', 'dist', 'build'];
|
|
7
|
-
export async function discoverMarkdownFiles(inputPath) {
|
|
8
|
-
async function walkDir(dir) {
|
|
9
|
-
const files = [];
|
|
10
|
-
try {
|
|
11
|
-
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
12
|
-
for (const entry of entries) {
|
|
13
|
-
const fullPath = path.join(dir, entry.name);
|
|
14
|
-
if (entry.isDirectory()) {
|
|
15
|
-
if (entry.name.startsWith('.') || SKIP_DIRS.includes(entry.name)) {
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
files.push(...(await walkDir(fullPath)));
|
|
19
|
-
}
|
|
20
|
-
else if (entry.isFile() &&
|
|
21
|
-
picomatch.isMatch(entry.name, '*.{md,markdown}', { nocase: true })) {
|
|
22
|
-
files.push(fullPath);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
29
|
-
return files;
|
|
30
|
-
}
|
|
31
|
-
const stat = await fs.stat(inputPath);
|
|
32
|
-
if (stat.isFile()) {
|
|
33
|
-
return [inputPath];
|
|
34
|
-
}
|
|
35
|
-
else if (stat.isDirectory()) {
|
|
36
|
-
return walkDir(inputPath);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Load list of changed files from either a file path or stdin
|
|
44
|
-
*/
|
|
45
|
-
export async function loadChangedFiles(changedListPath) {
|
|
46
|
-
// 1) Prefer explicit file path
|
|
47
|
-
if (changedListPath && changedListPath.length > 0) {
|
|
48
|
-
try {
|
|
49
|
-
const content = await fs.readFile(changedListPath, 'utf8');
|
|
50
|
-
return content
|
|
51
|
-
.split(/\r?\n/)
|
|
52
|
-
.map((s) => s.trim())
|
|
53
|
-
.filter(Boolean);
|
|
54
|
-
}
|
|
55
|
-
catch (_err) {
|
|
56
|
-
return [];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// 2) Otherwise try to read from stdin if piped
|
|
60
|
-
if (process.stdin.isTTY)
|
|
61
|
-
return [];
|
|
62
|
-
const chunks = [];
|
|
63
|
-
return await new Promise((resolve) => {
|
|
64
|
-
process.stdin.setEncoding('utf8');
|
|
65
|
-
process.stdin.on('data', (d) => chunks.push(String(d)));
|
|
66
|
-
process.stdin.on('end', () => {
|
|
67
|
-
const text = chunks.join('');
|
|
68
|
-
const lines = text
|
|
69
|
-
.split(/\r?\n/)
|
|
70
|
-
.map((s) => s.trim())
|
|
71
|
-
.filter(Boolean);
|
|
72
|
-
resolve(lines);
|
|
73
|
-
});
|
|
74
|
-
process.stdin.resume();
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Runs `fn` over `items` with at most `limit` calls in flight at once,
|
|
79
|
-
* returning results in the same order as `items` regardless of completion
|
|
80
|
-
* order. Used to bound concurrency for disk I/O (e.g. lintFiles' reads)
|
|
81
|
-
* without pulling in a workspace dependency — recheck is published
|
|
82
|
-
* independently, so it can't depend on @redocly/shared's promiseMapLimit.
|
|
83
|
-
*/
|
|
84
|
-
export async function mapLimit(items, limit, fn) {
|
|
85
|
-
const results = new Array(items.length);
|
|
86
|
-
let next = 0;
|
|
87
|
-
async function worker() {
|
|
88
|
-
while (next < items.length) {
|
|
89
|
-
const index = next++;
|
|
90
|
-
results[index] = await fn(items[index], index);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
94
|
-
return results;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Whether any of the given rules use the max-image-size assertion, which
|
|
98
|
-
* requires loading image metadata (file size, existence) from disk.
|
|
99
|
-
*/
|
|
100
|
-
export function needsImageMetadata(rules) {
|
|
101
|
-
return rules.some((rule) => Object.keys(rule.assertions).includes('max-image-size'));
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Extracts every local (non-`http(s)://`) image destination referenced in
|
|
105
|
-
* `content` — both inline (``) and reference-style
|
|
106
|
-
* (`![alt][ref]`, `![alt][]`, `![alt]`) syntax — via `getImageDestinations`
|
|
107
|
-
* (rules/token/helpers.ts), the SAME AST-based extraction
|
|
108
|
-
* `rules/scope/max-image-size.ts` uses to look images up in
|
|
109
|
-
* `ScopeRuleContext.fileMetadata.images`. Sharing one extraction pass is
|
|
110
|
-
* load-bearing, not just tidy: the strings returned here become the exact
|
|
111
|
-
* Map keys `loadImageMetadata` below stores on-disk stats under, and
|
|
112
|
-
* max-image-size looks metadata up by the identical destination string it
|
|
113
|
-
* resolves from the same tree shape — a second, independently-written
|
|
114
|
-
* extraction (even an AST-based one) could subtly disagree on edge cases
|
|
115
|
-
* (e.g. angle-bracket literal destinations, reference normalization) and
|
|
116
|
-
* silently break that lookup.
|
|
117
|
-
*
|
|
118
|
-
* Parses `content` itself rather than accepting a pre-built tree: neither
|
|
119
|
-
* of this function's current callers (`lintFiles` in src/index.ts,
|
|
120
|
-
* `runCommand` in src/commands/run.ts) has already parsed the file at the
|
|
121
|
-
* point they call this — both read raw file content and call this
|
|
122
|
-
* immediately after, before the runner's own `parseMarkdown` pass — so
|
|
123
|
-
* there is no cheap existing tree to thread through. This parse only runs
|
|
124
|
-
* at all when `needsImageMetadata` finds `max-image-size` configured (see
|
|
125
|
-
* below), bounding the extra cost to that case.
|
|
126
|
-
*
|
|
127
|
-
* Deliberately parsed without `{ markdoc: true }`, even when the caller's
|
|
128
|
-
* config has the flag on. `getImageDestinations` only reads `image` tokens
|
|
129
|
-
* (from ``/`![alt][ref]`) and link-reference definitions, and the
|
|
130
|
-
* Markdoc syntax extension hooks only on `{`, so it cannot affect where
|
|
131
|
-
* `!`/`[`/`]`/`(` constructs start, end, or resolve. The set of destinations is
|
|
132
|
-
* the same either way, and threading the flag through would add a parameter
|
|
133
|
-
* here and to two public signatures to preserve something already true by
|
|
134
|
-
* construction.
|
|
135
|
-
*/
|
|
136
|
-
function extractImageReferences(content) {
|
|
137
|
-
return getImageDestinations(parseMarkdown(content))
|
|
138
|
-
.map(({ destination }) => destination)
|
|
139
|
-
.filter((destination) => !destination.startsWith('http://') && !destination.startsWith('https://'));
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Cap on unique image refs processed per file by `loadImageMetadata`. Each
|
|
143
|
-
* ref costs an `fs.stat`, so without a bound a pathological file (hundreds
|
|
144
|
-
* of thousands of image refs) turns one lint into an unbounded stat storm.
|
|
145
|
-
* 1,000 is far above any real document's image count. Refs beyond the cap
|
|
146
|
-
* are OMITTED from the metadata map entirely — see the doc comment below
|
|
147
|
-
* for why omission (not a fabricated `exists: false`) is the honest shape.
|
|
148
|
-
*/
|
|
149
|
-
export const MAX_IMAGE_REFS_PER_FILE = 1000;
|
|
150
|
-
/** Whether `resolved` (an absolute path) is `root` itself or inside it. */
|
|
151
|
-
function isInsideRoot(root, resolved) {
|
|
152
|
-
const relative = path.relative(root, resolved);
|
|
153
|
-
return (relative === '' ||
|
|
154
|
-
(relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative)));
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Loads on-disk metadata (size, existence) for images referenced in a markdown
|
|
158
|
-
* file's content, keyed by the image path as written in the source.
|
|
159
|
-
*
|
|
160
|
-
* Refs are confined to `root` (default: `process.cwd()`): a ref whose
|
|
161
|
-
* resolved path escapes the root — `../` traversal above it, or an absolute
|
|
162
|
-
* path like `/etc/passwd` — is recorded as `exists: false` WITHOUT being
|
|
163
|
-
* stat'ed, so a hostile document can't use the linter to probe existence or
|
|
164
|
-
* size of arbitrary files (both would otherwise leak into lint output).
|
|
165
|
-
* Site-absolute doc refs like `/images/foo.png` land in the same bucket,
|
|
166
|
-
* which matches the previous behavior for them observably: they used to be
|
|
167
|
-
* stat'ed against the FILESYSTEM root, fail, and come back `exists: false`
|
|
168
|
-
* anyway. Callers linting files outside their cwd should pass the lint root
|
|
169
|
-
* explicitly (`lintFiles` threads its `root` option here).
|
|
170
|
-
*
|
|
171
|
-
* Confinement is physical, not just lexical: after the string-level check,
|
|
172
|
-
* each surviving ref is `fs.realpath`'d and its REAL path must sit inside
|
|
173
|
-
* the REAL root (the root's own realpath, resolved once per call). Without
|
|
174
|
-
* this, a symlink planted INSIDE the root (`root/docs/evil.png ->
|
|
175
|
-
* /etc/passwd`, or a symlinked directory escaping the root) passes the
|
|
176
|
-
* lexical check and `fs.stat` follows it, leaking the target's existence
|
|
177
|
-
* and size. Symlinks that RESOLVE inside the root keep working — legit repo
|
|
178
|
-
* layouts symlink shared asset dirs around within the checkout. When
|
|
179
|
-
* `realpath` throws (ENOENT for a missing file or dangling link — the
|
|
180
|
-
* common case — or any other resolution failure), the ref falls through to
|
|
181
|
-
* the same `fs.stat` try/catch as before: `stat` performs the identical
|
|
182
|
-
* full path resolution, so it fails the same way and the ref reads
|
|
183
|
-
* `exists: false` exactly as missing files always have. Cost: one extra
|
|
184
|
-
* realpath per stat'ed image, only on the max-image-size code path.
|
|
185
|
-
*
|
|
186
|
-
* At most `MAX_IMAGE_REFS_PER_FILE` unique refs are processed; overflow refs
|
|
187
|
-
* are omitted from the map rather than recorded. An absent key means "no
|
|
188
|
-
* metadata loaded" to consumers — `max-image-size` skips refs it finds no
|
|
189
|
-
* entry for, exactly as it skips `exists: false` entries — so omission never
|
|
190
|
-
* fabricates a "this image is missing" fact for a ref that was simply never
|
|
191
|
-
* checked. Duplicate refs share one entry (and one stat) and don't consume
|
|
192
|
-
* extra cap slots.
|
|
193
|
-
*/
|
|
194
|
-
export async function loadImageMetadata(file, content, root = process.cwd()) {
|
|
195
|
-
const images = new Map();
|
|
196
|
-
const baseDir = path.dirname(file);
|
|
197
|
-
const resolvedRoot = path.resolve(root);
|
|
198
|
-
const imageReferences = extractImageReferences(content);
|
|
199
|
-
// The root's physical identity, resolved once per call (not per ref).
|
|
200
|
-
// `undefined` when the root itself can't be resolved (e.g. doesn't
|
|
201
|
-
// exist) — nothing lexically inside a nonexistent root can stat
|
|
202
|
-
// successfully anyway, so the per-ref physical check is skipped and the
|
|
203
|
-
// stat below reports `exists: false` on its own.
|
|
204
|
-
let realRoot;
|
|
205
|
-
try {
|
|
206
|
-
realRoot = await fs.realpath(resolvedRoot);
|
|
207
|
-
}
|
|
208
|
-
catch {
|
|
209
|
-
realRoot = undefined;
|
|
210
|
-
}
|
|
211
|
-
for (const imagePath of imageReferences) {
|
|
212
|
-
if (images.has(imagePath)) {
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
if (images.size >= MAX_IMAGE_REFS_PER_FILE) {
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
const fullPath = path.resolve(baseDir, imagePath);
|
|
219
|
-
if (!isInsideRoot(resolvedRoot, fullPath)) {
|
|
220
|
-
images.set(imagePath, { path: imagePath, size: 0, exists: false });
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
// Physical confinement: a symlink inside the root must also RESOLVE
|
|
224
|
-
// inside the (real) root, or stat would follow it out and leak the
|
|
225
|
-
// target's existence/size. A realpath failure (ENOENT for missing
|
|
226
|
-
// files and dangling links, or any other resolution error) falls
|
|
227
|
-
// through: `fs.stat` resolves the same path the same way, fails
|
|
228
|
-
// identically, and lands in the `exists: false` branch below —
|
|
229
|
-
// missing files keep their exact pre-existing behavior.
|
|
230
|
-
if (realRoot !== undefined) {
|
|
231
|
-
try {
|
|
232
|
-
const realPath = await fs.realpath(fullPath);
|
|
233
|
-
if (!isInsideRoot(realRoot, realPath)) {
|
|
234
|
-
images.set(imagePath, { path: imagePath, size: 0, exists: false });
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
catch {
|
|
239
|
-
// Fall through to the stat below.
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
try {
|
|
243
|
-
const stats = await fs.stat(fullPath);
|
|
244
|
-
images.set(imagePath, {
|
|
245
|
-
path: imagePath,
|
|
246
|
-
size: stats.size,
|
|
247
|
-
exists: true,
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
catch {
|
|
251
|
-
images.set(imagePath, {
|
|
252
|
-
path: imagePath,
|
|
253
|
-
size: 0,
|
|
254
|
-
exists: false,
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return images.size > 0 ? { images } : undefined;
|
|
259
|
-
}
|
|
260
|
-
//# sourceMappingURL=files.js.map
|
package/dist/core/files.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/core/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,SAAS,MAAM,WAAW,CAAC;AAIlC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,SAAS,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,SAAiB;IAC3D,KAAK,UAAU,OAAO,CAAC,GAAW;QAChC,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;YAE/D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAE5C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;oBACxB,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;wBACjE,SAAS;oBACX,CAAC;oBACD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC3C,CAAC;qBAAM,IACL,KAAK,CAAC,MAAM,EAAE;oBACd,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,iBAAiB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAClE,CAAC;oBACD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB,OAAO,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;SAAM,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC9B,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,eAAwB;IAC7D,+BAA+B;IAC/B,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;YAC3D,OAAO,OAAO;iBACX,KAAK,CAAC,OAAO,CAAC;iBACd,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;iBACpB,MAAM,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,IAAI,EAAE,CAAC;YACd,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IACD,+CAA+C;IAC/C,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,EAAE;QAC7C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC7B,MAAM,KAAK,GAAG,IAAI;iBACf,KAAK,CAAC,OAAO,CAAC;iBACd,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;iBACpB,MAAM,CAAC,OAAO,CAAC,CAAC;YACnB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,KAAU,EACV,KAAa,EACb,EAA0C;IAE1C,MAAM,OAAO,GAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,UAAU,MAAM;QACnB,OAAO,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC3B,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACjF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAuB;IACxD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACvF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAS,sBAAsB,CAAC,OAAe;IAC7C,OAAO,oBAAoB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;SAChD,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC;SACrC,MAAM,CACL,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAC3F,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,2EAA2E;AAC3E,SAAS,YAAY,CAAC,IAAY,EAAE,QAAgB;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/C,OAAO,CACL,QAAQ,KAAK,EAAE;QACf,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAC3F,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAY,EACZ,OAAe,EACf,IAAI,GAAW,OAAO,CAAC,GAAG,EAAE;IAE5B,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,eAAe,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAExD,sEAAsE;IACtE,mEAAmE;IACnE,gEAAgE;IAChE,wEAAwE;IACxE,iDAAiD;IACjD,IAAI,QAA4B,CAAC;IACjC,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ,GAAG,SAAS,CAAC;IACvB,CAAC;IAED,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE,CAAC;QACxC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,IAAI,uBAAuB,EAAE,CAAC;YAC3C,MAAM;QACR,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC;YAC1C,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YACnE,SAAS;QACX,CAAC;QAED,oEAAoE;QACpE,mEAAmE;QACnE,kEAAkE;QAClE,iEAAiE;QACjE,gEAAgE;QAChE,+DAA+D;QAC/D,wDAAwD;QACxD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAC7C,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;oBACtC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;oBACnE,SAAS;gBACX,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,kCAAkC;YACpC,CAAC;QACH,CAAC;QAED,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE;gBACpB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE;gBACpB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,CAAC;gBACP,MAAM,EAAE,KAAK;aACd,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Matches one CommonMark inline code span: a backtick RUN of N backticks,
|
|
3
|
-
* then content up to the NEXT run of exactly N backticks -- not merely "a
|
|
4
|
-
* backtick ... a backtick" (a single-backtick-only regex treats a
|
|
5
|
-
* multi-backtick span like ` ``configFile`` ` as two adjacent EMPTY
|
|
6
|
-
* single-backtick pairs -- the two backticks at each end each look like
|
|
7
|
-
* their own complete single-backtick pair -- leaving the real content
|
|
8
|
-
* completely unrecognized in between). `(`+)` + backreference `\1`
|
|
9
|
-
* requires the closing run to match the opening run's exact length;
|
|
10
|
-
* `(?!`)` after `\1` rejects a run that is actually LONGER than N (e.g. a
|
|
11
|
-
* stray extra backtick right after would mean this is not the true,
|
|
12
|
-
* maximal closing run) -- this also correctly handles a span whose content
|
|
13
|
-
* itself contains a SHORTER, unpaired backtick run (` ``code ` x`` `).
|
|
14
|
-
* Content is restricted to `[^\n]` so a span can never cross a line;
|
|
15
|
-
* callers only ever run this against single-line text.
|
|
16
|
-
*
|
|
17
|
-
* Shared by capitalization.ts (mask + restore, so `$`-style casing never
|
|
18
|
-
* touches a code span's content), spelling.ts (mask, so a misspelling
|
|
19
|
-
* check never flags identifier text), and metric.ts (strip, so readability
|
|
20
|
-
* scoring never counts a code span's words/syllables) -- all three need
|
|
21
|
-
* the identical CommonMark-correct span recognition, just applied
|
|
22
|
-
* differently (mask-and-restore vs outright removal).
|
|
23
|
-
*/
|
|
24
|
-
export declare const BACKTICK_SPAN_RE: RegExp;
|
|
25
|
-
/**
|
|
26
|
-
* Placeholder character `maskInlineCode` masks spans with. \0 sits outside
|
|
27
|
-
* every word tokenizer in the codebase (title-case.ts's WORD_RE,
|
|
28
|
-
* capitalization.ts's sentence tokenizer, spelling.ts's word regex), so a
|
|
29
|
-
* masked span is invisible to word-based scanning -- never matched, never
|
|
30
|
-
* capitalized, never the first/last word.
|
|
31
|
-
*/
|
|
32
|
-
export declare const INLINE_CODE_MASK_CHAR = "\0";
|
|
33
|
-
/**
|
|
34
|
-
* Masks every inline code span in `text` with a SAME-LENGTH run of
|
|
35
|
-
* INLINE_CODE_MASK_CHAR. Length-preserving on purpose: every remaining
|
|
36
|
-
* token's offset stays aligned with the original text, so match positions
|
|
37
|
-
* computed against the masked string are valid source positions -- and
|
|
38
|
-
* `restoreInlineCode` can splice the original spans back purely by
|
|
39
|
-
* position.
|
|
40
|
-
*/
|
|
41
|
-
export declare function maskInlineCode(text: string): string;
|
|
42
|
-
/**
|
|
43
|
-
* Restores the inline code spans of `original` into `transformed`, a string
|
|
44
|
-
* derived from `maskInlineCode(original)` by length-preserving transforms
|
|
45
|
-
* only (e.g. case changes). Splices by position, not content search: the
|
|
46
|
-
* span offsets found in `original` are still the span offsets in
|
|
47
|
-
* `transformed` because masking and the intervening transforms never change
|
|
48
|
-
* string length.
|
|
49
|
-
*/
|
|
50
|
-
export declare function restoreInlineCode(original: string, transformed: string): string;
|
|
51
|
-
/**
|
|
52
|
-
* The half-open character ranges `[start, end)` of every inline code span
|
|
53
|
-
* in `text`, using the same `BACKTICK_SPAN_RE` span recognition as
|
|
54
|
-
* `maskInlineCode`/`restoreInlineCode` -- span recognition stays in exactly
|
|
55
|
-
* one place.
|
|
56
|
-
*
|
|
57
|
-
* For rules that must REJECT a match inside code rather than rewrite text
|
|
58
|
-
* (swap.ts, pattern.ts): those rules run an arbitrary user-supplied regex
|
|
59
|
-
* (a `pattern` token, a `swap` key under `keysAreRegex`), and masking can
|
|
60
|
-
* change what that regex matches. `maskInlineCode` substitutes a
|
|
61
|
-
* same-length run of `\0` for a span's real characters -- and `\0` is not
|
|
62
|
-
* whitespace, not a comma, not anything in particular. A negated class
|
|
63
|
-
* like `[^\s,]+` treats that run as ordinary "not comma, not whitespace"
|
|
64
|
-
* text and can match straight through it, merging text before and after
|
|
65
|
-
* the span -- including whatever character (e.g. a comma) the class
|
|
66
|
-
* exists to react to -- into one bogus match. A range check has no such
|
|
67
|
-
* failure mode: the regex still runs against the genuine, unmodified text,
|
|
68
|
-
* and a match is discarded only AFTER the fact, if its span overlaps a
|
|
69
|
-
* code span. Use `inlineCodeRanges` + `overlapsAnyRange` for that; keep
|
|
70
|
-
* `maskInlineCode` for rules that transform text in place and need a
|
|
71
|
-
* length-preserving stand-in (capitalization.ts, spelling.ts).
|
|
72
|
-
*/
|
|
73
|
-
export declare function inlineCodeRanges(text: string): Array<{
|
|
74
|
-
start: number;
|
|
75
|
-
end: number;
|
|
76
|
-
}>;
|
|
77
|
-
/**
|
|
78
|
-
* Whether the half-open range `[start, end)` overlaps ANY of `ranges`.
|
|
79
|
-
* Half-open, exclusive-end comparison on both sides: a match that only
|
|
80
|
-
* touches a range's boundary -- ends exactly where the range starts, or
|
|
81
|
-
* starts exactly where the range ends -- does NOT overlap.
|
|
82
|
-
*/
|
|
83
|
-
export declare function overlapsAnyRange(start: number, end: number, ranges: Array<{
|
|
84
|
-
start: number;
|
|
85
|
-
end: number;
|
|
86
|
-
}>): boolean;
|
|
87
|
-
//# sourceMappingURL=inline-code.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inline-code.d.ts","sourceRoot":"","sources":["../../src/core/inline-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,gBAAgB,QAAwB,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAY/E;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAOpF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,GAC5C,OAAO,CAET"}
|
package/dist/core/inline-code.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Matches one CommonMark inline code span: a backtick RUN of N backticks,
|
|
3
|
-
* then content up to the NEXT run of exactly N backticks -- not merely "a
|
|
4
|
-
* backtick ... a backtick" (a single-backtick-only regex treats a
|
|
5
|
-
* multi-backtick span like ` ``configFile`` ` as two adjacent EMPTY
|
|
6
|
-
* single-backtick pairs -- the two backticks at each end each look like
|
|
7
|
-
* their own complete single-backtick pair -- leaving the real content
|
|
8
|
-
* completely unrecognized in between). `(`+)` + backreference `\1`
|
|
9
|
-
* requires the closing run to match the opening run's exact length;
|
|
10
|
-
* `(?!`)` after `\1` rejects a run that is actually LONGER than N (e.g. a
|
|
11
|
-
* stray extra backtick right after would mean this is not the true,
|
|
12
|
-
* maximal closing run) -- this also correctly handles a span whose content
|
|
13
|
-
* itself contains a SHORTER, unpaired backtick run (` ``code ` x`` `).
|
|
14
|
-
* Content is restricted to `[^\n]` so a span can never cross a line;
|
|
15
|
-
* callers only ever run this against single-line text.
|
|
16
|
-
*
|
|
17
|
-
* Shared by capitalization.ts (mask + restore, so `$`-style casing never
|
|
18
|
-
* touches a code span's content), spelling.ts (mask, so a misspelling
|
|
19
|
-
* check never flags identifier text), and metric.ts (strip, so readability
|
|
20
|
-
* scoring never counts a code span's words/syllables) -- all three need
|
|
21
|
-
* the identical CommonMark-correct span recognition, just applied
|
|
22
|
-
* differently (mask-and-restore vs outright removal).
|
|
23
|
-
*/
|
|
24
|
-
export const BACKTICK_SPAN_RE = /(`+)[^\n]*?\1(?!`)/g;
|
|
25
|
-
/**
|
|
26
|
-
* Placeholder character `maskInlineCode` masks spans with. \0 sits outside
|
|
27
|
-
* every word tokenizer in the codebase (title-case.ts's WORD_RE,
|
|
28
|
-
* capitalization.ts's sentence tokenizer, spelling.ts's word regex), so a
|
|
29
|
-
* masked span is invisible to word-based scanning -- never matched, never
|
|
30
|
-
* capitalized, never the first/last word.
|
|
31
|
-
*/
|
|
32
|
-
export const INLINE_CODE_MASK_CHAR = '\0';
|
|
33
|
-
/**
|
|
34
|
-
* Masks every inline code span in `text` with a SAME-LENGTH run of
|
|
35
|
-
* INLINE_CODE_MASK_CHAR. Length-preserving on purpose: every remaining
|
|
36
|
-
* token's offset stays aligned with the original text, so match positions
|
|
37
|
-
* computed against the masked string are valid source positions -- and
|
|
38
|
-
* `restoreInlineCode` can splice the original spans back purely by
|
|
39
|
-
* position.
|
|
40
|
-
*/
|
|
41
|
-
export function maskInlineCode(text) {
|
|
42
|
-
return text.replace(BACKTICK_SPAN_RE, (span) => INLINE_CODE_MASK_CHAR.repeat(span.length));
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Restores the inline code spans of `original` into `transformed`, a string
|
|
46
|
-
* derived from `maskInlineCode(original)` by length-preserving transforms
|
|
47
|
-
* only (e.g. case changes). Splices by position, not content search: the
|
|
48
|
-
* span offsets found in `original` are still the span offsets in
|
|
49
|
-
* `transformed` because masking and the intervening transforms never change
|
|
50
|
-
* string length.
|
|
51
|
-
*/
|
|
52
|
-
export function restoreInlineCode(original, transformed) {
|
|
53
|
-
let result = '';
|
|
54
|
-
let cursor = 0;
|
|
55
|
-
for (const match of original.matchAll(BACKTICK_SPAN_RE)) {
|
|
56
|
-
const start = match.index ?? 0;
|
|
57
|
-
const end = start + match[0].length;
|
|
58
|
-
result += transformed.slice(cursor, start);
|
|
59
|
-
result += original.slice(start, end); // restore the masked span verbatim
|
|
60
|
-
cursor = end;
|
|
61
|
-
}
|
|
62
|
-
result += transformed.slice(cursor);
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* The half-open character ranges `[start, end)` of every inline code span
|
|
67
|
-
* in `text`, using the same `BACKTICK_SPAN_RE` span recognition as
|
|
68
|
-
* `maskInlineCode`/`restoreInlineCode` -- span recognition stays in exactly
|
|
69
|
-
* one place.
|
|
70
|
-
*
|
|
71
|
-
* For rules that must REJECT a match inside code rather than rewrite text
|
|
72
|
-
* (swap.ts, pattern.ts): those rules run an arbitrary user-supplied regex
|
|
73
|
-
* (a `pattern` token, a `swap` key under `keysAreRegex`), and masking can
|
|
74
|
-
* change what that regex matches. `maskInlineCode` substitutes a
|
|
75
|
-
* same-length run of `\0` for a span's real characters -- and `\0` is not
|
|
76
|
-
* whitespace, not a comma, not anything in particular. A negated class
|
|
77
|
-
* like `[^\s,]+` treats that run as ordinary "not comma, not whitespace"
|
|
78
|
-
* text and can match straight through it, merging text before and after
|
|
79
|
-
* the span -- including whatever character (e.g. a comma) the class
|
|
80
|
-
* exists to react to -- into one bogus match. A range check has no such
|
|
81
|
-
* failure mode: the regex still runs against the genuine, unmodified text,
|
|
82
|
-
* and a match is discarded only AFTER the fact, if its span overlaps a
|
|
83
|
-
* code span. Use `inlineCodeRanges` + `overlapsAnyRange` for that; keep
|
|
84
|
-
* `maskInlineCode` for rules that transform text in place and need a
|
|
85
|
-
* length-preserving stand-in (capitalization.ts, spelling.ts).
|
|
86
|
-
*/
|
|
87
|
-
export function inlineCodeRanges(text) {
|
|
88
|
-
const ranges = [];
|
|
89
|
-
for (const match of text.matchAll(BACKTICK_SPAN_RE)) {
|
|
90
|
-
const start = match.index ?? 0;
|
|
91
|
-
ranges.push({ start, end: start + match[0].length });
|
|
92
|
-
}
|
|
93
|
-
return ranges;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Whether the half-open range `[start, end)` overlaps ANY of `ranges`.
|
|
97
|
-
* Half-open, exclusive-end comparison on both sides: a match that only
|
|
98
|
-
* touches a range's boundary -- ends exactly where the range starts, or
|
|
99
|
-
* starts exactly where the range ends -- does NOT overlap.
|
|
100
|
-
*/
|
|
101
|
-
export function overlapsAnyRange(start, end, ranges) {
|
|
102
|
-
return ranges.some((range) => start < range.end && range.start < end);
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=inline-code.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inline-code.js","sourceRoot":"","sources":["../../src/core/inline-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,WAAmB;IACrE,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;QAC/B,MAAM,GAAG,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACpC,MAAM,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC3C,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,mCAAmC;QACzE,MAAM,GAAG,GAAG,CAAC;IACf,CAAC;IACD,MAAM,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,MAAM,MAAM,GAA0C,EAAE,CAAC;IACzD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACpD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,GAAW,EACX,MAA6C;IAE7C,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Matches one line ending: CRLF (`\r\n`), lone CR (`\r`), or LF (`\n`).
|
|
3
|
-
* Safe to share: `String.prototype.split` ignores the `g` flag/lastIndex,
|
|
4
|
-
* and `String.prototype.match` with `g` always scans from index 0.
|
|
5
|
-
*/
|
|
6
|
-
export declare const newLineRe: RegExp;
|
|
7
|
-
/**
|
|
8
|
-
* Gets the file's most common line ending, falling back to the platform
|
|
9
|
-
* default for content with no line endings at all — the exact semantics of
|
|
10
|
-
* upstream's `getPreferredLineEnding(input, os)`. `applyFixesToContent`
|
|
11
|
-
* joins fixed lines with this, so an all-CRLF file round-trips through
|
|
12
|
-
* --fix still CRLF (and a mixed-endings file is normalized to its
|
|
13
|
-
* majority ending, as markdownlint's `applyFixes` does).
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Maps a 0-based character offset within `text` to a 1-based
|
|
17
|
-
* (line, column) pair, treating CRLF, lone CR, and lone LF each as ONE
|
|
18
|
-
* line ending — the single offset→position mapping every scope-rule
|
|
19
|
-
* internals must use instead of hand-rolled `split('\n')` /
|
|
20
|
-
* `lastIndexOf('\n')` arithmetic (which, on a CR-only file, keeps every
|
|
21
|
-
* offset on line 1 with a column counted from the start of the text).
|
|
22
|
-
*
|
|
23
|
-
* An offset pointing INTO a CRLF pair (at its '\n') is reported as
|
|
24
|
-
* column 1 of the following line; real callers pass match/sentence
|
|
25
|
-
* offsets, which never start inside a line ending.
|
|
26
|
-
*/
|
|
27
|
-
export declare function offsetToLineColumn(text: string, offset: number): {
|
|
28
|
-
line: number;
|
|
29
|
-
column: number;
|
|
30
|
-
};
|
|
31
|
-
export declare function getPreferredLineEnding(input: string): string;
|
|
32
|
-
//# sourceMappingURL=line-endings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"line-endings.d.ts","sourceRoot":"","sources":["../../src/core/line-endings.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAc,CAAC;AAErC;;;;;;;GAOG;AACH;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAQjG;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAa5D"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Ported from markdownlint's line-ending helpers (helpers/shared.cjs
|
|
2
|
-
// `newlineRe` and helpers/helpers.cjs `getPreferredLineEnding`;
|
|
3
|
-
// https://github.com/DavidAnson/markdownlint, MIT © David Anson).
|
|
4
|
-
//
|
|
5
|
-
// Everything that turns file content into per-line arrays (the runner's
|
|
6
|
-
// ctx.lines, applyFixesToContent's working lines) must split with
|
|
7
|
-
// `newLineRe`, never a bare '\n' — a CRLF file split on '\n' leaves a
|
|
8
|
-
// trailing '\r' on every line, which token rules then misread as trailing
|
|
9
|
-
// whitespace (and --fix would then mangle).
|
|
10
|
-
import * as os from 'node:os';
|
|
11
|
-
/**
|
|
12
|
-
* Matches one line ending: CRLF (`\r\n`), lone CR (`\r`), or LF (`\n`).
|
|
13
|
-
* Safe to share: `String.prototype.split` ignores the `g` flag/lastIndex,
|
|
14
|
-
* and `String.prototype.match` with `g` always scans from index 0.
|
|
15
|
-
*/
|
|
16
|
-
export const newLineRe = /\r\n?|\n/g;
|
|
17
|
-
/**
|
|
18
|
-
* Gets the file's most common line ending, falling back to the platform
|
|
19
|
-
* default for content with no line endings at all — the exact semantics of
|
|
20
|
-
* upstream's `getPreferredLineEnding(input, os)`. `applyFixesToContent`
|
|
21
|
-
* joins fixed lines with this, so an all-CRLF file round-trips through
|
|
22
|
-
* --fix still CRLF (and a mixed-endings file is normalized to its
|
|
23
|
-
* majority ending, as markdownlint's `applyFixes` does).
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Maps a 0-based character offset within `text` to a 1-based
|
|
27
|
-
* (line, column) pair, treating CRLF, lone CR, and lone LF each as ONE
|
|
28
|
-
* line ending — the single offset→position mapping every scope-rule
|
|
29
|
-
* internals must use instead of hand-rolled `split('\n')` /
|
|
30
|
-
* `lastIndexOf('\n')` arithmetic (which, on a CR-only file, keeps every
|
|
31
|
-
* offset on line 1 with a column counted from the start of the text).
|
|
32
|
-
*
|
|
33
|
-
* An offset pointing INTO a CRLF pair (at its '\n') is reported as
|
|
34
|
-
* column 1 of the following line; real callers pass match/sentence
|
|
35
|
-
* offsets, which never start inside a line ending.
|
|
36
|
-
*/
|
|
37
|
-
export function offsetToLineColumn(text, offset) {
|
|
38
|
-
let line = 1;
|
|
39
|
-
let lineStart = 0;
|
|
40
|
-
for (const match of text.slice(0, offset).matchAll(newLineRe)) {
|
|
41
|
-
line++;
|
|
42
|
-
lineStart = match.index + match[0].length;
|
|
43
|
-
}
|
|
44
|
-
return { line, column: offset - lineStart + 1 };
|
|
45
|
-
}
|
|
46
|
-
export function getPreferredLineEnding(input) {
|
|
47
|
-
let cr = 0;
|
|
48
|
-
let lf = 0;
|
|
49
|
-
let crlf = 0;
|
|
50
|
-
const endings = input.match(newLineRe) ?? [];
|
|
51
|
-
for (const ending of endings) {
|
|
52
|
-
if (ending === '\r')
|
|
53
|
-
cr++;
|
|
54
|
-
else if (ending === '\n')
|
|
55
|
-
lf++;
|
|
56
|
-
else
|
|
57
|
-
crlf++;
|
|
58
|
-
}
|
|
59
|
-
if (!cr && !lf && !crlf)
|
|
60
|
-
return os.EOL;
|
|
61
|
-
if (lf >= crlf && lf >= cr)
|
|
62
|
-
return '\n';
|
|
63
|
-
return crlf >= cr ? '\r\n' : '\r';
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=line-endings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"line-endings.js","sourceRoot":"","sources":["../../src/core/line-endings.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,gEAAgE;AAChE,kEAAkE;AAClE,EAAE;AACF,wEAAwE;AACxE,kEAAkE;AAClE,sEAAsE;AACtE,0EAA0E;AAC1E,4CAA4C;AAC5C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AAErC;;;;;;;GAOG;AACH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,MAAc;IAC7D,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9D,IAAI,EAAE,CAAC;QACP,SAAS,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAC7C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,KAAK,IAAI;YAAE,EAAE,EAAE,CAAC;aACrB,IAAI,MAAM,KAAK,IAAI;YAAE,EAAE,EAAE,CAAC;;YAC1B,IAAI,EAAE,CAAC;IACd,CAAC;IACD,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC,GAAG,CAAC;IACvC,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACpC,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import type { Fix } from '../types/index.js';
|
|
2
|
-
import type { TokenTree } from '../parser/types.js';
|
|
3
|
-
/**
|
|
4
|
-
* The character `scopes/extractor.ts` blanks a markdoc tag's span with when
|
|
5
|
-
* building prose content. A SPACE, deliberately, and not
|
|
6
|
-
* `core/inline-code.ts`'s `\0` sentinel:
|
|
7
|
-
*
|
|
8
|
-
* - Recheck's prose model must read a tag's span as a GAP, and the word
|
|
9
|
-
* tokenizers, `String.prototype.trim`, and the sentence splitter all agree on
|
|
10
|
-
* whitespace, so a space makes every one of them treat the tag as absent.
|
|
11
|
-
* - A user-supplied regex must NOT read it as a gap, and no sentinel can give
|
|
12
|
-
* that: `\0` stops `\s+` from crossing a tag, but a negated class (`[^,]+`)
|
|
13
|
-
* walks straight through it either way. Regex rules therefore have to reject
|
|
14
|
-
* a match by RANGE, after the fact, against the unmodified text — see
|
|
15
|
-
* `ScopedSegment.maskedRanges` and `nonProseRanges` in `rules/utils.ts`.
|
|
16
|
-
*/
|
|
17
|
-
export declare const MARKDOC_TAG_MASK_CHAR = " ";
|
|
18
|
-
/**
|
|
19
|
-
* One markdoc tag's verbatim source bytes on ONE line. A block tag whose
|
|
20
|
-
* attributes are broken across lines (`{% table\n x=1 %}`) contributes one
|
|
21
|
-
* entry per line it covers, so every entry is a plain single-line span that a
|
|
22
|
-
* `Fix` — itself always confined to one line — can be compared against directly.
|
|
23
|
-
*/
|
|
24
|
-
export interface MarkdocTagSpan {
|
|
25
|
-
/** 1-based source line. */
|
|
26
|
-
line: number;
|
|
27
|
-
/** 1-based, inclusive. */
|
|
28
|
-
startColumn: number;
|
|
29
|
-
/** 1-based, exclusive. */
|
|
30
|
-
endColumn: number;
|
|
31
|
-
/** The source bytes between those columns — what must survive a fix. */
|
|
32
|
-
text: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Every markdoc tag's source span in `content`, split per line (see
|
|
36
|
-
* `MarkdocTagSpan`). Empty for a flag-off parse, since no `markdocTag` tokens
|
|
37
|
-
* exist in the tree at all, so `--fix` behaves byte-identically.
|
|
38
|
-
*
|
|
39
|
-
* Uses `filterByTypes` rather than a raw `tree.flat.filter` so htmlFlow-reparsed
|
|
40
|
-
* tokens are excluded on the same terms as for every other consumer: they
|
|
41
|
-
* duplicate positions already covered by their `htmlFlow` parent, and treating a
|
|
42
|
-
* duplicate as a protected span would block fixes on a line with no real tag.
|
|
43
|
-
*/
|
|
44
|
-
export declare function markdocTagSpans(tree: TokenTree, content: string): MarkdocTagSpan[];
|
|
45
|
-
export interface ProtectedFixes {
|
|
46
|
-
/** Fixes safe to apply — tag-overlapping ones with their tags restored. */
|
|
47
|
-
fixes: Fix[];
|
|
48
|
-
/** Fixes that could not be made tag-safe, for the caller's skipped list. */
|
|
49
|
-
dropped: Fix[];
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* The choke point that keeps `--fix` from rewriting a markdoc tag's bytes.
|
|
53
|
-
*
|
|
54
|
-
* Prose scope content is masked (see `MARKDOC_TAG_MASK_CHAR`), which breaks the
|
|
55
|
-
* precondition every whole-span rewriter relied on: `ScopedSegment.content` used
|
|
56
|
-
* to be a verbatim source slice, so a rule replacing its whole span writes the
|
|
57
|
-
* mask back over the real source and DELETES the tag. Rather than teach each such
|
|
58
|
-
* rule to splice its own tags back, every fix from every rule passes through here
|
|
59
|
-
* once, on its way to `applyFixesToContent`:
|
|
60
|
-
*
|
|
61
|
-
* - No tag on the fix's line, or no overlap with one: passes through untouched.
|
|
62
|
-
* This is the only path a flag-off run can take, so flag-off byte-identity is
|
|
63
|
-
* structural, not a special case.
|
|
64
|
-
* - Overlap where the fix replaces its span with the SAME number of characters:
|
|
65
|
-
* each overlapped tag's original bytes are spliced back at their own offsets.
|
|
66
|
-
* Length preservation is what makes those offsets meaningful, and it is the
|
|
67
|
-
* same contract `restoreInlineCode` (core/inline-code.ts) already relies on.
|
|
68
|
-
* - Anything else — a length-changing replacement, a fix that cuts a tag in half,
|
|
69
|
-
* a whole-line rewrite (`deleteCount: -1`) on a line with a tag — is DROPPED
|
|
70
|
-
* and reported as skipped, since there is no position to splice into without
|
|
71
|
-
* inventing one.
|
|
72
|
-
*
|
|
73
|
-
* A fix that turns out to change nothing once its tags are restored is dropped
|
|
74
|
-
* too: it only matched mask characters, and letting it through would report a
|
|
75
|
-
* byte-identical file as fixed and make `runRulesUntilStable` re-propose it on
|
|
76
|
-
* every pass.
|
|
77
|
-
*/
|
|
78
|
-
export declare function protectMarkdocTags(fixes: Fix[], spans: MarkdocTagSpan[], content: string): ProtectedFixes;
|
|
79
|
-
//# sourceMappingURL=markdoc-tags.d.ts.map
|