@driftsys/markspec 0.5.0 → 0.6.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 +74 -20
- package/esm/ast/build.d.ts +11 -21
- package/esm/ast/build.d.ts.map +1 -1
- package/esm/ast/build.js +50 -139
- package/esm/ast/nodes.d.ts +11 -43
- package/esm/ast/nodes.d.ts.map +1 -1
- package/esm/ast/nodes.js +6 -1
- package/esm/ast/normalize.d.ts +8 -17
- package/esm/ast/normalize.d.ts.map +1 -1
- package/esm/ast/normalize.js +14 -72
- package/esm/compiler/constants.d.ts +16 -0
- package/esm/compiler/constants.d.ts.map +1 -0
- package/esm/compiler/constants.js +26 -0
- package/esm/compiler/discipline_classifier.d.ts +55 -0
- package/esm/compiler/discipline_classifier.d.ts.map +1 -0
- package/esm/compiler/discipline_classifier.js +191 -0
- package/esm/compiler/inverses.d.ts +7 -0
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +1 -18
- package/esm/compiler/mod.d.ts +30 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +198 -65
- package/esm/compiler/schema.d.ts +15 -0
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +12 -0
- package/esm/config/markspec.d.ts +5 -0
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/config/markspec.js +17 -2
- package/esm/formatter/mod.d.ts +9 -3
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +97 -49
- package/esm/lexicons/loader.d.ts +35 -0
- package/esm/lexicons/loader.d.ts.map +1 -0
- package/esm/lexicons/loader.js +51 -0
- package/esm/lexicons/mod.d.ts +13 -0
- package/esm/lexicons/mod.d.ts.map +1 -0
- package/esm/lexicons/mod.js +12 -0
- package/esm/lint/glossary.d.ts +45 -0
- package/esm/lint/glossary.d.ts.map +1 -0
- package/esm/lint/glossary.js +85 -0
- package/esm/lint/mod.d.ts +4 -0
- package/esm/lint/mod.d.ts.map +1 -1
- package/esm/lint/mod.js +2 -0
- package/esm/lint/range_util.d.ts +25 -0
- package/esm/lint/range_util.d.ts.map +1 -0
- package/esm/lint/range_util.js +50 -0
- package/esm/lint/rules/ears.d.ts +39 -0
- package/esm/lint/rules/ears.d.ts.map +1 -0
- package/esm/lint/rules/ears.js +316 -0
- package/esm/lint/rules/incose_sentence.d.ts +46 -0
- package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
- package/esm/lint/rules/incose_sentence.js +417 -0
- package/esm/lint/rules/modal_sentence.d.ts +46 -0
- package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
- package/esm/lint/rules/modal_sentence.js +146 -0
- package/esm/lint/rules/passive.d.ts +64 -0
- package/esm/lint/rules/passive.d.ts.map +1 -0
- package/esm/lint/rules/passive.js +282 -0
- package/esm/lint/rules/suppression.d.ts +38 -3
- package/esm/lint/rules/suppression.d.ts.map +1 -1
- package/esm/lint/rules/suppression.js +58 -4
- package/esm/lint/rules/xref.d.ts +19 -0
- package/esm/lint/rules/xref.d.ts.map +1 -0
- package/esm/lint/rules/xref.js +248 -0
- package/esm/lint/runner.d.ts +31 -11
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +67 -26
- package/esm/lint/score.d.ts +64 -0
- package/esm/lint/score.d.ts.map +1 -0
- package/esm/lint/score.js +163 -0
- package/esm/lint/segmenter.d.ts +32 -0
- package/esm/lint/segmenter.d.ts.map +1 -0
- package/esm/lint/segmenter.js +79 -0
- package/esm/lint/types.d.ts +12 -0
- package/esm/lint/types.d.ts.map +1 -1
- package/esm/lock/canonical_edges.d.ts +31 -0
- package/esm/lock/canonical_edges.d.ts.map +1 -0
- package/esm/lock/canonical_edges.js +57 -0
- package/esm/lock/check.d.ts +24 -0
- package/esm/lock/check.d.ts.map +1 -0
- package/esm/lock/check.js +127 -0
- package/esm/lock/hash.d.ts +12 -0
- package/esm/lock/hash.d.ts.map +1 -0
- package/esm/lock/hash.js +32 -0
- package/esm/lock/mod.d.ts +19 -0
- package/esm/lock/mod.d.ts.map +1 -0
- package/esm/lock/mod.js +14 -0
- package/esm/lock/model.d.ts +81 -0
- package/esm/lock/model.d.ts.map +1 -0
- package/esm/lock/model.js +7 -0
- package/esm/lock/parser.d.ts +26 -0
- package/esm/lock/parser.d.ts.map +1 -0
- package/esm/lock/parser.js +195 -0
- package/esm/lock/resolve.d.ts +142 -0
- package/esm/lock/resolve.d.ts.map +1 -0
- package/esm/lock/resolve.js +389 -0
- package/esm/lock/serializer.d.ts +14 -0
- package/esm/lock/serializer.d.ts.map +1 -0
- package/esm/lock/serializer.js +104 -0
- package/esm/mod.d.ts +16 -9
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +12 -4
- package/esm/model/attributes.d.ts +6 -0
- package/esm/model/attributes.d.ts.map +1 -1
- package/esm/model/attributes.js +37 -0
- package/esm/model/discipline.d.ts +53 -0
- package/esm/model/discipline.d.ts.map +1 -0
- package/esm/model/discipline.js +50 -0
- package/esm/model/mod.d.ts +188 -30
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +42 -1
- package/esm/model/profile.d.ts +69 -0
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +1 -10
- package/esm/parser/body_tokens.d.ts +35 -0
- package/esm/parser/body_tokens.d.ts.map +1 -0
- package/esm/parser/body_tokens.js +232 -0
- package/esm/parser/glossary.d.ts +8 -0
- package/esm/parser/glossary.d.ts.map +1 -1
- package/esm/parser/glossary.js +6 -4
- package/esm/parser/grammars.d.ts +5 -3
- package/esm/parser/grammars.d.ts.map +1 -1
- package/esm/parser/grammars.js +12 -4
- package/esm/parser/language_spec.d.ts +55 -0
- package/esm/parser/language_spec.d.ts.map +1 -0
- package/esm/parser/language_spec.js +419 -0
- package/esm/parser/line_map.d.ts +60 -0
- package/esm/parser/line_map.d.ts.map +1 -0
- package/esm/parser/line_map.js +41 -0
- package/esm/parser/markdown.d.ts +9 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +107 -31
- package/esm/parser/mod.d.ts +4 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +30 -8
- package/esm/parser/source.d.ts +39 -8
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +155 -65
- package/esm/parser/translate.d.ts +24 -0
- package/esm/parser/translate.d.ts.map +1 -0
- package/esm/parser/translate.js +99 -0
- package/esm/profile/chain.d.ts +8 -0
- package/esm/profile/chain.d.ts.map +1 -1
- package/esm/profile/chain.js +29 -1
- package/esm/profile/default_profile.d.ts +25 -0
- package/esm/profile/default_profile.d.ts.map +1 -0
- package/esm/profile/default_profile.js +43 -0
- package/esm/profile/discipline_mode.d.ts +64 -0
- package/esm/profile/discipline_mode.d.ts.map +1 -0
- package/esm/profile/discipline_mode.js +133 -0
- package/esm/profile/discipline_registry.d.ts +41 -0
- package/esm/profile/discipline_registry.d.ts.map +1 -0
- package/esm/profile/discipline_registry.js +67 -0
- package/esm/profile/load.d.ts +3 -1
- package/esm/profile/load.d.ts.map +1 -1
- package/esm/profile/load.js +24 -5
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +253 -20
- package/esm/profile/merge.d.ts.map +1 -1
- package/esm/profile/merge.js +112 -0
- package/esm/profile/mod.d.ts +2 -0
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +2 -0
- package/esm/sync/locked_attributes.d.ts +19 -0
- package/esm/sync/locked_attributes.d.ts.map +1 -0
- package/esm/sync/locked_attributes.js +27 -0
- package/esm/sync/log.d.ts +34 -0
- package/esm/sync/log.d.ts.map +1 -0
- package/esm/sync/log.js +48 -0
- package/esm/sync/mapping.d.ts +66 -0
- package/esm/sync/mapping.d.ts.map +1 -0
- package/esm/sync/mapping.js +165 -0
- package/esm/sync/mod.d.ts +16 -0
- package/esm/sync/mod.d.ts.map +1 -0
- package/esm/sync/mod.js +12 -0
- package/esm/sync/status.d.ts +23 -0
- package/esm/sync/status.d.ts.map +1 -0
- package/esm/sync/status.js +21 -0
- package/esm/typl/ast.d.ts +87 -0
- package/esm/typl/ast.d.ts.map +1 -0
- package/esm/typl/ast.js +21 -0
- package/esm/typl/bridge.d.ts +32 -0
- package/esm/typl/bridge.d.ts.map +1 -0
- package/esm/typl/bridge.js +27 -0
- package/esm/typl/bullet.d.ts +34 -0
- package/esm/typl/bullet.d.ts.map +1 -0
- package/esm/typl/bullet.js +44 -0
- package/esm/typl/diagnostics.d.ts +43 -0
- package/esm/typl/diagnostics.d.ts.map +1 -0
- package/esm/typl/diagnostics.js +61 -0
- package/esm/typl/fence.d.ts +31 -0
- package/esm/typl/fence.d.ts.map +1 -0
- package/esm/typl/fence.js +24 -0
- package/esm/typl/grammar.d.ts +20 -0
- package/esm/typl/grammar.d.ts.map +1 -0
- package/esm/typl/grammar.js +471 -0
- package/esm/typl/inline.d.ts +34 -0
- package/esm/typl/inline.d.ts.map +1 -0
- package/esm/typl/inline.js +48 -0
- package/esm/typl/lexer.d.ts +37 -0
- package/esm/typl/lexer.d.ts.map +1 -0
- package/esm/typl/lexer.js +234 -0
- package/esm/typl/mod.d.ts +23 -0
- package/esm/typl/mod.d.ts.map +1 -0
- package/esm/typl/mod.js +16 -0
- package/esm/typl/registry.d.ts +42 -0
- package/esm/typl/registry.d.ts.map +1 -0
- package/esm/typl/registry.js +26 -0
- package/esm/typl/validator.d.ts +29 -0
- package/esm/typl/validator.d.ts.map +1 -0
- package/esm/typl/validator.js +141 -0
- package/esm/util/line_endings.d.ts +33 -0
- package/esm/util/line_endings.d.ts.map +1 -0
- package/esm/util/line_endings.js +53 -0
- package/esm/util/modals.d.ts +29 -0
- package/esm/util/modals.d.ts.map +1 -0
- package/esm/util/modals.js +38 -0
- package/esm/validator/discipline.d.ts +35 -0
- package/esm/validator/discipline.d.ts.map +1 -0
- package/esm/validator/discipline.js +204 -0
- package/esm/validator/mod.d.ts +1 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +23 -2
- package/esm/validator/modal_keywords.d.ts +15 -13
- package/esm/validator/modal_keywords.d.ts.map +1 -1
- package/esm/validator/modal_keywords.js +26 -109
- package/esm/validator/pattern.d.ts +15 -8
- package/esm/validator/pattern.d.ts.map +1 -1
- package/esm/validator/pattern.js +42 -19
- package/esm/validator/per_type_attrs.d.ts +2 -2
- package/esm/validator/per_type_attrs.d.ts.map +1 -1
- package/esm/validator/per_type_attrs.js +2 -2
- package/esm/validator/pipeline.d.ts +11 -0
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +37 -15
- package/esm/validator/type_resolution.d.ts +3 -3
- package/esm/validator/type_resolution.d.ts.map +1 -1
- package/esm/validator/type_resolution.js +31 -9
- package/package.json +2 -2
- package/script/ast/build.d.ts +11 -21
- package/script/ast/build.d.ts.map +1 -1
- package/script/ast/build.js +51 -140
- package/script/ast/nodes.d.ts +11 -43
- package/script/ast/nodes.d.ts.map +1 -1
- package/script/ast/nodes.js +6 -1
- package/script/ast/normalize.d.ts +8 -17
- package/script/ast/normalize.d.ts.map +1 -1
- package/script/ast/normalize.js +16 -74
- package/script/compiler/constants.d.ts +16 -0
- package/script/compiler/constants.d.ts.map +1 -0
- package/script/compiler/constants.js +29 -0
- package/script/compiler/discipline_classifier.d.ts +55 -0
- package/script/compiler/discipline_classifier.d.ts.map +1 -0
- package/script/compiler/discipline_classifier.js +196 -0
- package/script/compiler/inverses.d.ts +7 -0
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +2 -19
- package/script/compiler/mod.d.ts +30 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +202 -69
- package/script/compiler/schema.d.ts +15 -0
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +12 -0
- package/script/config/markspec.d.ts +5 -0
- package/script/config/markspec.d.ts.map +1 -1
- package/script/config/markspec.js +17 -2
- package/script/formatter/mod.d.ts +9 -3
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +99 -51
- package/script/lexicons/loader.d.ts +35 -0
- package/script/lexicons/loader.d.ts.map +1 -0
- package/script/lexicons/loader.js +55 -0
- package/script/lexicons/mod.d.ts +13 -0
- package/script/lexicons/mod.d.ts.map +1 -0
- package/script/lexicons/mod.js +17 -0
- package/script/lint/glossary.d.ts +45 -0
- package/script/lint/glossary.d.ts.map +1 -0
- package/script/lint/glossary.js +88 -0
- package/script/lint/mod.d.ts +4 -0
- package/script/lint/mod.d.ts.map +1 -1
- package/script/lint/mod.js +6 -1
- package/script/lint/range_util.d.ts +25 -0
- package/script/lint/range_util.d.ts.map +1 -0
- package/script/lint/range_util.js +53 -0
- package/script/lint/rules/ears.d.ts +39 -0
- package/script/lint/rules/ears.d.ts.map +1 -0
- package/script/lint/rules/ears.js +320 -0
- package/script/lint/rules/incose_sentence.d.ts +46 -0
- package/script/lint/rules/incose_sentence.d.ts.map +1 -0
- package/script/lint/rules/incose_sentence.js +421 -0
- package/script/lint/rules/modal_sentence.d.ts +46 -0
- package/script/lint/rules/modal_sentence.d.ts.map +1 -0
- package/script/lint/rules/modal_sentence.js +150 -0
- package/script/lint/rules/passive.d.ts +64 -0
- package/script/lint/rules/passive.d.ts.map +1 -0
- package/script/lint/rules/passive.js +286 -0
- package/script/lint/rules/suppression.d.ts +38 -3
- package/script/lint/rules/suppression.d.ts.map +1 -1
- package/script/lint/rules/suppression.js +59 -3
- package/script/lint/rules/xref.d.ts +19 -0
- package/script/lint/rules/xref.d.ts.map +1 -0
- package/script/lint/rules/xref.js +251 -0
- package/script/lint/runner.d.ts +31 -11
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +67 -26
- package/script/lint/score.d.ts +64 -0
- package/script/lint/score.d.ts.map +1 -0
- package/script/lint/score.js +167 -0
- package/script/lint/segmenter.d.ts +32 -0
- package/script/lint/segmenter.d.ts.map +1 -0
- package/script/lint/segmenter.js +82 -0
- package/script/lint/types.d.ts +12 -0
- package/script/lint/types.d.ts.map +1 -1
- package/script/lock/canonical_edges.d.ts +31 -0
- package/script/lock/canonical_edges.d.ts.map +1 -0
- package/script/lock/canonical_edges.js +61 -0
- package/script/lock/check.d.ts +24 -0
- package/script/lock/check.d.ts.map +1 -0
- package/script/lock/check.js +130 -0
- package/script/lock/hash.d.ts +12 -0
- package/script/lock/hash.d.ts.map +1 -0
- package/script/lock/hash.js +36 -0
- package/script/lock/mod.d.ts +19 -0
- package/script/lock/mod.d.ts.map +1 -0
- package/script/lock/mod.js +31 -0
- package/script/lock/model.d.ts +81 -0
- package/script/lock/model.d.ts.map +1 -0
- package/script/lock/model.js +10 -0
- package/script/lock/parser.d.ts +26 -0
- package/script/lock/parser.d.ts.map +1 -0
- package/script/lock/parser.js +198 -0
- package/script/lock/resolve.d.ts +142 -0
- package/script/lock/resolve.d.ts.map +1 -0
- package/script/lock/resolve.js +397 -0
- package/script/lock/serializer.d.ts +14 -0
- package/script/lock/serializer.d.ts.map +1 -0
- package/script/lock/serializer.js +107 -0
- package/script/mod.d.ts +16 -9
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +111 -38
- package/script/model/attributes.d.ts +6 -0
- package/script/model/attributes.d.ts.map +1 -1
- package/script/model/attributes.js +38 -1
- package/script/model/discipline.d.ts +53 -0
- package/script/model/discipline.d.ts.map +1 -0
- package/script/model/discipline.js +53 -0
- package/script/model/mod.d.ts +188 -30
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +48 -1
- package/script/model/profile.d.ts +69 -0
- package/script/model/profile.d.ts.map +1 -1
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +1 -10
- package/script/parser/body_tokens.d.ts +35 -0
- package/script/parser/body_tokens.d.ts.map +1 -0
- package/script/parser/body_tokens.js +235 -0
- package/script/parser/glossary.d.ts +8 -0
- package/script/parser/glossary.d.ts.map +1 -1
- package/script/parser/glossary.js +7 -4
- package/script/parser/grammars.d.ts +5 -3
- package/script/parser/grammars.d.ts.map +1 -1
- package/script/parser/grammars.js +15 -8
- package/script/parser/language_spec.d.ts +55 -0
- package/script/parser/language_spec.d.ts.map +1 -0
- package/script/parser/language_spec.js +423 -0
- package/script/parser/line_map.d.ts +60 -0
- package/script/parser/line_map.d.ts.map +1 -0
- package/script/parser/line_map.js +44 -0
- package/script/parser/markdown.d.ts +9 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +105 -29
- package/script/parser/mod.d.ts +4 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +32 -7
- package/script/parser/source.d.ts +39 -8
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +156 -69
- package/script/parser/translate.d.ts +24 -0
- package/script/parser/translate.d.ts.map +1 -0
- package/script/parser/translate.js +102 -0
- package/script/profile/chain.d.ts +8 -0
- package/script/profile/chain.d.ts.map +1 -1
- package/script/profile/chain.js +29 -1
- package/script/profile/default_profile.d.ts +25 -0
- package/script/profile/default_profile.d.ts.map +1 -0
- package/script/profile/default_profile.js +46 -0
- package/script/profile/discipline_mode.d.ts +64 -0
- package/script/profile/discipline_mode.d.ts.map +1 -0
- package/script/profile/discipline_mode.js +138 -0
- package/script/profile/discipline_registry.d.ts +41 -0
- package/script/profile/discipline_registry.d.ts.map +1 -0
- package/script/profile/discipline_registry.js +70 -0
- package/script/profile/load.d.ts +3 -1
- package/script/profile/load.d.ts.map +1 -1
- package/script/profile/load.js +24 -5
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +252 -19
- package/script/profile/merge.d.ts.map +1 -1
- package/script/profile/merge.js +112 -0
- package/script/profile/mod.d.ts +2 -0
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +6 -1
- package/script/sync/locked_attributes.d.ts +19 -0
- package/script/sync/locked_attributes.d.ts.map +1 -0
- package/script/sync/locked_attributes.js +30 -0
- package/script/sync/log.d.ts +34 -0
- package/script/sync/log.d.ts.map +1 -0
- package/script/sync/log.js +52 -0
- package/script/sync/mapping.d.ts +66 -0
- package/script/sync/mapping.d.ts.map +1 -0
- package/script/sync/mapping.js +169 -0
- package/script/sync/mod.d.ts +16 -0
- package/script/sync/mod.d.ts.map +1 -0
- package/script/sync/mod.js +21 -0
- package/script/sync/status.d.ts +23 -0
- package/script/sync/status.d.ts.map +1 -0
- package/script/sync/status.js +24 -0
- package/script/typl/ast.d.ts +87 -0
- package/script/typl/ast.d.ts.map +1 -0
- package/script/typl/ast.js +24 -0
- package/script/typl/bridge.d.ts +32 -0
- package/script/typl/bridge.d.ts.map +1 -0
- package/script/typl/bridge.js +30 -0
- package/script/typl/bullet.d.ts +34 -0
- package/script/typl/bullet.d.ts.map +1 -0
- package/script/typl/bullet.js +47 -0
- package/script/typl/diagnostics.d.ts +43 -0
- package/script/typl/diagnostics.d.ts.map +1 -0
- package/script/typl/diagnostics.js +65 -0
- package/script/typl/fence.d.ts +31 -0
- package/script/typl/fence.d.ts.map +1 -0
- package/script/typl/fence.js +27 -0
- package/script/typl/grammar.d.ts +20 -0
- package/script/typl/grammar.d.ts.map +1 -0
- package/script/typl/grammar.js +474 -0
- package/script/typl/inline.d.ts +34 -0
- package/script/typl/inline.d.ts.map +1 -0
- package/script/typl/inline.js +51 -0
- package/script/typl/lexer.d.ts +37 -0
- package/script/typl/lexer.d.ts.map +1 -0
- package/script/typl/lexer.js +237 -0
- package/script/typl/mod.d.ts +23 -0
- package/script/typl/mod.d.ts.map +1 -0
- package/script/typl/mod.js +29 -0
- package/script/typl/registry.d.ts +42 -0
- package/script/typl/registry.d.ts.map +1 -0
- package/script/typl/registry.js +29 -0
- package/script/typl/validator.d.ts +29 -0
- package/script/typl/validator.d.ts.map +1 -0
- package/script/typl/validator.js +144 -0
- package/script/util/line_endings.d.ts +33 -0
- package/script/util/line_endings.d.ts.map +1 -0
- package/script/util/line_endings.js +58 -0
- package/script/util/modals.d.ts +29 -0
- package/script/util/modals.d.ts.map +1 -0
- package/script/util/modals.js +42 -0
- package/script/validator/discipline.d.ts +35 -0
- package/script/validator/discipline.d.ts.map +1 -0
- package/script/validator/discipline.js +207 -0
- package/script/validator/mod.d.ts +1 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +23 -1
- package/script/validator/modal_keywords.d.ts +15 -13
- package/script/validator/modal_keywords.d.ts.map +1 -1
- package/script/validator/modal_keywords.js +26 -109
- package/script/validator/pattern.d.ts +15 -8
- package/script/validator/pattern.d.ts.map +1 -1
- package/script/validator/pattern.js +42 -19
- package/script/validator/per_type_attrs.d.ts +2 -2
- package/script/validator/per_type_attrs.d.ts.map +1 -1
- package/script/validator/per_type_attrs.js +2 -2
- package/script/validator/pipeline.d.ts +11 -0
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +40 -17
- package/script/validator/type_resolution.d.ts +3 -3
- package/script/validator/type_resolution.d.ts.map +1 -1
- package/script/validator/type_resolution.js +31 -9
- package/esm/parser/entity_refs.d.ts +0 -53
- package/esm/parser/entity_refs.d.ts.map +0 -1
- package/esm/parser/entity_refs.js +0 -151
- package/script/parser/entity_refs.d.ts +0 -53
- package/script/parser/entity_refs.d.ts.map +0 -1
- package/script/parser/entity_refs.js +0 -155
package/README.md
CHANGED
|
@@ -9,30 +9,77 @@
|
|
|
9
9
|
A Markdown flavor for traceable industrial documentation, and a CLI toolchain
|
|
10
10
|
that processes it.
|
|
11
11
|
|
|
12
|
-
>
|
|
13
|
-
>
|
|
14
|
-
>
|
|
15
|
-
>
|
|
12
|
+
> Pre-1.0. The toolchain is functional end-to-end for authoring, validation,
|
|
13
|
+
> traceability, rendering, and editor / agent integration. The
|
|
14
|
+
> [language specification](docs/spec/language/language.md) and wire formats
|
|
15
|
+
> (compile-output JSON, lockfile) may still change without
|
|
16
|
+
> backward-compatibility shims until 1.0.
|
|
16
17
|
|
|
17
18
|
## Tools
|
|
18
19
|
|
|
20
|
+
**Authoring and validation**
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
markspec format # stamp ULIDs, normalize attributes
|
|
24
|
+
markspec validate # check broken refs, missing Ids, duplicates
|
|
25
|
+
markspec lint # prose analysis (modal verbs, EARS, passive, …)
|
|
26
|
+
markspec hook # pre-commit gate: format --check + validate
|
|
27
|
+
markspec insert <type> # append a scaffolded entry to a file
|
|
28
|
+
markspec create <type> # scaffold a new entry block (stdout)
|
|
29
|
+
markspec next-id <type> # next available display ID for a type
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Traceability and querying**
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
markspec compile <paths> # build traceability graph → JSON
|
|
36
|
+
markspec show <id> # show one entry by display ID or ULID
|
|
37
|
+
markspec context <id> # walk the Satisfies chain upward
|
|
38
|
+
markspec dependents <id> # list entries that depend on an entry
|
|
39
|
+
markspec report <kind> # traceability matrix or coverage report
|
|
40
|
+
markspec export <format> # compile-graph → json, yaml, csv
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Lockfile and external sync**
|
|
44
|
+
|
|
19
45
|
```text
|
|
20
|
-
markspec
|
|
21
|
-
markspec
|
|
22
|
-
markspec
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
markspec
|
|
30
|
-
markspec
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
markspec lock # generate or refresh markspec.lock
|
|
47
|
+
markspec sync status # group bound entries by remote_state
|
|
48
|
+
markspec sync log # tail per-system sync log (NDJSON)
|
|
49
|
+
markspec sync show <id> # full sync state for one bound entry
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Profiles and diagnostics**
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
markspec profile show # show active profile chain
|
|
56
|
+
markspec doctor # project health check
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Rendering**
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
markspec doc build # single document → PDF (Typst WASM)
|
|
63
|
+
markspec book build # multi-chapter → static HTML site
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Editor and agent integration**
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
markspec lsp # LSP server (stdio JSON-RPC)
|
|
70
|
+
markspec lsp install # print LSP config for vscode, neovim, zed
|
|
71
|
+
markspec mcp # MCP server (stdio JSON-RPC)
|
|
72
|
+
markspec mcp install # print MCP config for claude-desktop,
|
|
73
|
+
# cursor, vscode
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Not yet implemented** (registered but exit with an error):
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
markspec export reqif # ReqIF XML export
|
|
80
|
+
markspec book dev # live preview with hot reload
|
|
81
|
+
markspec deck build # slides → PDF via Touying/Typst
|
|
82
|
+
markspec deck dev # live slide preview
|
|
36
83
|
```
|
|
37
84
|
|
|
38
85
|
## Modules
|
|
@@ -119,6 +166,13 @@ fn swt_brk_0001_debounce_filters_noise() {
|
|
|
119
166
|
**Mustache variables** — `{{project.name}}` substitution from `project.yaml`,
|
|
120
167
|
resolved at build time.
|
|
121
168
|
|
|
169
|
+
## Install
|
|
170
|
+
|
|
171
|
+
See [`docs/guide/installation.md`](docs/guide/installation.md) for the VS Code
|
|
172
|
+
extension, the macOS / Linux install script, the
|
|
173
|
+
[Windows PowerShell install script](docs/guide/installation.md#windows-powershell-install-script),
|
|
174
|
+
manual binary downloads, and the Deno install path.
|
|
175
|
+
|
|
122
176
|
## License
|
|
123
177
|
|
|
124
178
|
[MIT](LICENSE)
|
package/esm/ast/build.d.ts
CHANGED
|
@@ -5,29 +5,10 @@
|
|
|
5
5
|
* (post-`splitBodyAndAttributes`) with the shared remark processor and
|
|
6
6
|
* maps each mdast block child to the §2.4-2.6 node taxonomy.
|
|
7
7
|
*
|
|
8
|
-
* Inline markers (modal + $Identifier) are extracted for prose-bearing
|
|
9
|
-
* nodes: Paragraph, List items, Table cells, Note bodies, Blockquotes,
|
|
10
|
-
* and DefinitionList term/definitions. They are NOT extracted inside
|
|
11
|
-
* Code, Feature, or Math blocks (spec §2.5).
|
|
12
|
-
*
|
|
13
8
|
* This module is pure library code: no `Deno.*` APIs.
|
|
14
9
|
*/
|
|
15
|
-
import type {
|
|
16
|
-
|
|
17
|
-
* Extract all inline markers from a prose text string.
|
|
18
|
-
* `lineOffset` is the 0-based line index of the text within the body
|
|
19
|
-
* (used for SourceRange line numbers).
|
|
20
|
-
*
|
|
21
|
-
* For multi-line text the SourceRange carries the first line's 1-based
|
|
22
|
-
* column; this is best-effort for PR 2 (noted as DONE_WITH_CONCERNS:
|
|
23
|
-
* multi-line paragraph ranges are approximated to the starting line).
|
|
24
|
-
*
|
|
25
|
-
* Exported so the AST-native §3.4.1 normalisation pass
|
|
26
|
-
* (`core/ast/normalize.ts`) re-derives `InlineContent.markers` from the
|
|
27
|
-
* normalised text with the SAME extraction the builder uses — no regex
|
|
28
|
-
* duplication.
|
|
29
|
-
*/
|
|
30
|
-
export declare function extractMarkersFromText(text: string, startRange: SourceRange): readonly InlineMarker[];
|
|
10
|
+
import type { Root } from "@types/mdast";
|
|
11
|
+
import type { BodyBlock } from "./nodes.js";
|
|
31
12
|
/**
|
|
32
13
|
* Return the exact source substring for an mdast node `position`, with
|
|
33
14
|
* list-continuation indentation normalised to column 0 so the slice is a
|
|
@@ -67,4 +48,13 @@ export declare function verbatimSlice(body: string, pos: {
|
|
|
67
48
|
* only for single-line paragraphs.
|
|
68
49
|
*/
|
|
69
50
|
export declare function buildBodyAst(body: string): BodyBlock[];
|
|
51
|
+
/**
|
|
52
|
+
* Like {@linkcode buildBodyAst} but also returns the intermediate mdast
|
|
53
|
+
* `Root` so callers that need it (e.g. body-token extraction) avoid
|
|
54
|
+
* re-parsing.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildBodyAstWithTree(body: string): {
|
|
57
|
+
blocks: BodyBlock[];
|
|
58
|
+
tree: Root;
|
|
59
|
+
};
|
|
70
60
|
//# sourceMappingURL=build.d.ts.map
|
package/esm/ast/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/ast/build.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/ast/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAKV,IAAI,EAKL,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAGV,SAAS,EAeV,MAAM,YAAY,CAAC;AAwCpB;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE;IACH,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxD,GAAG,SAAS,GACZ,MAAM,CAgCR;AAucD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,GACX;IAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAkBrC"}
|
package/esm/ast/build.js
CHANGED
|
@@ -5,116 +5,19 @@
|
|
|
5
5
|
* (post-`splitBodyAndAttributes`) with the shared remark processor and
|
|
6
6
|
* maps each mdast block child to the §2.4-2.6 node taxonomy.
|
|
7
7
|
*
|
|
8
|
-
* Inline markers (modal + $Identifier) are extracted for prose-bearing
|
|
9
|
-
* nodes: Paragraph, List items, Table cells, Note bodies, Blockquotes,
|
|
10
|
-
* and DefinitionList term/definitions. They are NOT extracted inside
|
|
11
|
-
* Code, Feature, or Math blocks (spec §2.5).
|
|
12
|
-
*
|
|
13
8
|
* This module is pure library code: no `Deno.*` APIs.
|
|
14
9
|
*/
|
|
15
10
|
import { processor } from "../parser/remark.js";
|
|
16
|
-
import {
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
// Inline marker recognition — modal keywords
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
11
|
+
import { normalizeLineEndings } from "../util/line_endings.js";
|
|
20
12
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
13
|
+
* Build an InlineContent from verbatim source prose.
|
|
14
|
+
* `storedText` is the verbatim source prose that `render` emits (§5.1
|
|
15
|
+
* faithful). The `_recognitionText` and `_range` parameters are kept for
|
|
16
|
+
* call-site compatibility but are intentionally unused — inline-construct
|
|
17
|
+
* extraction has moved to `Entry.bodyTokens` (ADR-016).
|
|
23
18
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const EARS_RE = /\b(When|While|Where|Unless)\b/g;
|
|
27
|
-
/** `$Identifier` entity reference — must not be preceded by another `$`. */
|
|
28
|
-
const ENTITY_REF_RE = /\$([A-Za-z][A-Za-z0-9_]*)/g;
|
|
29
|
-
/**
|
|
30
|
-
* Extract all inline markers from a prose text string.
|
|
31
|
-
* `lineOffset` is the 0-based line index of the text within the body
|
|
32
|
-
* (used for SourceRange line numbers).
|
|
33
|
-
*
|
|
34
|
-
* For multi-line text the SourceRange carries the first line's 1-based
|
|
35
|
-
* column; this is best-effort for PR 2 (noted as DONE_WITH_CONCERNS:
|
|
36
|
-
* multi-line paragraph ranges are approximated to the starting line).
|
|
37
|
-
*
|
|
38
|
-
* Exported so the AST-native §3.4.1 normalisation pass
|
|
39
|
-
* (`core/ast/normalize.ts`) re-derives `InlineContent.markers` from the
|
|
40
|
-
* normalised text with the SAME extraction the builder uses — no regex
|
|
41
|
-
* duplication.
|
|
42
|
-
*/
|
|
43
|
-
export function extractMarkersFromText(text, startRange) {
|
|
44
|
-
const markers = [];
|
|
45
|
-
const lines = text.split("\n");
|
|
46
|
-
for (let li = 0; li < lines.length; li++) {
|
|
47
|
-
const line = lines[li];
|
|
48
|
-
const lineNo = startRange.start.line + li;
|
|
49
|
-
// ---- RFC 2119 ---------------------------------------------------
|
|
50
|
-
RFC2119_RE.lastIndex = 0;
|
|
51
|
-
let m;
|
|
52
|
-
while ((m = RFC2119_RE.exec(line)) !== null) {
|
|
53
|
-
const raw = m[1];
|
|
54
|
-
const canonical = raw.toLowerCase();
|
|
55
|
-
const col = m.index + 1;
|
|
56
|
-
markers.push({
|
|
57
|
-
kind: "modal",
|
|
58
|
-
cls: "rfc2119",
|
|
59
|
-
canonical,
|
|
60
|
-
raw, // preserve source form for uppercase-keyword detection (MSL-M060)
|
|
61
|
-
range: {
|
|
62
|
-
start: { line: lineNo, column: col },
|
|
63
|
-
end: { line: lineNo, column: col + raw.length },
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
// ---- EARS -------------------------------------------------------
|
|
68
|
-
EARS_RE.lastIndex = 0;
|
|
69
|
-
while ((m = EARS_RE.exec(line)) !== null) {
|
|
70
|
-
const raw = m[1];
|
|
71
|
-
const col = m.index + 1;
|
|
72
|
-
markers.push({
|
|
73
|
-
kind: "modal",
|
|
74
|
-
cls: "ears",
|
|
75
|
-
canonical: raw, // EARS: source form is canonical
|
|
76
|
-
raw, // same as canonical for EARS
|
|
77
|
-
range: {
|
|
78
|
-
start: { line: lineNo, column: col },
|
|
79
|
-
end: { line: lineNo, column: col + raw.length },
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
// ---- $Identifier ------------------------------------------------
|
|
84
|
-
ENTITY_REF_RE.lastIndex = 0;
|
|
85
|
-
while ((m = ENTITY_REF_RE.exec(line)) !== null) {
|
|
86
|
-
// Discard if preceded by another `$` (math fence `$$…$$`)
|
|
87
|
-
if (m.index > 0 && line[m.index - 1] === "$")
|
|
88
|
-
continue;
|
|
89
|
-
// Discard if preceded by `\` (escaped)
|
|
90
|
-
if (m.index > 0 && line[m.index - 1] === "\\")
|
|
91
|
-
continue;
|
|
92
|
-
const ident = m[0]; // includes leading `$`
|
|
93
|
-
const bare = m[1];
|
|
94
|
-
const col = m.index + 1;
|
|
95
|
-
markers.push({
|
|
96
|
-
kind: "entity",
|
|
97
|
-
ident,
|
|
98
|
-
convention: classifyConvention(bare),
|
|
99
|
-
range: {
|
|
100
|
-
start: { line: lineNo, column: col },
|
|
101
|
-
end: { line: lineNo, column: col + ident.length },
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return markers;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Build an InlineContent. `storedText` is the verbatim source prose that
|
|
110
|
-
* `render` emits (§5.1 faithful); `recognitionText` is the flattened
|
|
111
|
-
* projection that modal / $Identifier recognition runs on (so `\bshall\b`
|
|
112
|
-
* still matches inside `_shall_`). For nodes whose text carries no inline
|
|
113
|
-
* markup the two are identical and behaviour is unchanged.
|
|
114
|
-
*/
|
|
115
|
-
function inlineContent(storedText, recognitionText, range) {
|
|
116
|
-
const markers = extractMarkersFromText(recognitionText, range);
|
|
117
|
-
return { text: storedText, markers };
|
|
19
|
+
function inlineContent(storedText, _recognitionText, _range) {
|
|
20
|
+
return { text: storedText };
|
|
118
21
|
}
|
|
119
22
|
// ---------------------------------------------------------------------------
|
|
120
23
|
// mdast position → SourceRange
|
|
@@ -269,7 +172,6 @@ function splitVerbatimDeflist(verbatim) {
|
|
|
269
172
|
// ---------------------------------------------------------------------------
|
|
270
173
|
// mdast text extraction helper
|
|
271
174
|
// ---------------------------------------------------------------------------
|
|
272
|
-
// deno-lint-ignore no-explicit-any
|
|
273
175
|
function extractMdastText(node) {
|
|
274
176
|
if (!node)
|
|
275
177
|
return "";
|
|
@@ -277,10 +179,10 @@ function extractMdastText(node) {
|
|
|
277
179
|
// re-add the backtick delimiters so the round-trip is byte-identical.
|
|
278
180
|
if (node.type === "inlineCode")
|
|
279
181
|
return `\`${node.value}\``;
|
|
280
|
-
if (typeof node.value === "string")
|
|
182
|
+
if ("value" in node && typeof node.value === "string")
|
|
281
183
|
return node.value;
|
|
282
|
-
if (
|
|
283
|
-
return node.children.map(extractMdastText).join("");
|
|
184
|
+
if ("children" in node) {
|
|
185
|
+
return node.children.map((c) => extractMdastText(c)).join("");
|
|
284
186
|
}
|
|
285
187
|
return "";
|
|
286
188
|
}
|
|
@@ -360,7 +262,6 @@ function deQuote(rawBlockquote) {
|
|
|
360
262
|
// ---------------------------------------------------------------------------
|
|
361
263
|
// Main builder — mdast node → BodyBlock
|
|
362
264
|
// ---------------------------------------------------------------------------
|
|
363
|
-
// deno-lint-ignore no-explicit-any
|
|
364
265
|
function mapMdastNode(node, body) {
|
|
365
266
|
const range = positionToRange(node.position);
|
|
366
267
|
switch (node.type) {
|
|
@@ -439,16 +340,12 @@ function mapMdastNode(node, body) {
|
|
|
439
340
|
};
|
|
440
341
|
}
|
|
441
342
|
case "list": {
|
|
343
|
+
const listNode = node;
|
|
442
344
|
// Detect GFM task-list items (remark-gfm sets `checked` to true/false).
|
|
443
|
-
|
|
444
|
-
const
|
|
445
|
-
const items = node.children.map(
|
|
446
|
-
// deno-lint-ignore no-explicit-any
|
|
447
|
-
(item) => {
|
|
345
|
+
const hasTaskItems = listNode.children.some((item) => item.checked != null);
|
|
346
|
+
const items = listNode.children.map((item) => {
|
|
448
347
|
const itemRange = positionToRange(item.position);
|
|
449
|
-
const subBlocks = (item.children ?? []).map(
|
|
450
|
-
// deno-lint-ignore no-explicit-any
|
|
451
|
-
(child) => mapMdastNode(child, body));
|
|
348
|
+
const subBlocks = (item.children ?? []).map((child) => mapMdastNode(child, body));
|
|
452
349
|
return {
|
|
453
350
|
blocks: subBlocks,
|
|
454
351
|
...(item.checked != null ? { checked: item.checked } : {}),
|
|
@@ -458,19 +355,20 @@ function mapMdastNode(node, body) {
|
|
|
458
355
|
});
|
|
459
356
|
return {
|
|
460
357
|
kind: "list",
|
|
461
|
-
ordered:
|
|
462
|
-
spread:
|
|
358
|
+
ordered: listNode.ordered ?? false,
|
|
359
|
+
spread: listNode.spread ?? false,
|
|
463
360
|
items,
|
|
464
361
|
...(hasTaskItems ? { hasTaskItems: true } : {}),
|
|
465
362
|
range,
|
|
466
363
|
};
|
|
467
364
|
}
|
|
468
365
|
case "table": {
|
|
469
|
-
|
|
470
|
-
const rows =
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
366
|
+
const tableNode = node;
|
|
367
|
+
const rows = tableNode.children.map((row) => row.children.map((cell) => {
|
|
368
|
+
// TableCell children are PhrasingContent ⊂ RootContent ⊂ Nodes.
|
|
369
|
+
const cellText = cell.children
|
|
370
|
+
.map((c) => extractMdastText(c))
|
|
371
|
+
.join("");
|
|
474
372
|
const cellRange = positionToRange(cell.position);
|
|
475
373
|
// stored == recognition (table cells render via TableNode.raw; Task 5 confirms)
|
|
476
374
|
return inlineContent(cellText, cellText, cellRange);
|
|
@@ -487,7 +385,7 @@ function mapMdastNode(node, body) {
|
|
|
487
385
|
}
|
|
488
386
|
case "code": {
|
|
489
387
|
const lang = node.lang ?? undefined; // empty string → undefined
|
|
490
|
-
if (lang === "gherkin") {
|
|
388
|
+
if (lang === "gherkin" || lang === "feature") {
|
|
491
389
|
return {
|
|
492
390
|
kind: "feature",
|
|
493
391
|
source: node.value ?? "",
|
|
@@ -502,8 +400,9 @@ function mapMdastNode(node, body) {
|
|
|
502
400
|
};
|
|
503
401
|
}
|
|
504
402
|
case "blockquote": {
|
|
505
|
-
const
|
|
506
|
-
const
|
|
403
|
+
const bqNode = node;
|
|
404
|
+
const verbatim = deQuote(verbatimSlice(body, bqNode.position));
|
|
405
|
+
const firstChild = bqNode.children?.[0];
|
|
507
406
|
if (firstChild?.type === "paragraph") {
|
|
508
407
|
const paraText = extractMdastText(firstChild);
|
|
509
408
|
const admonMatch = ADMONITION_FIRST_LINE_RE.exec(paraText.trim());
|
|
@@ -512,9 +411,8 @@ function mapMdastNode(node, body) {
|
|
|
512
411
|
// Flattened recognition text (unchanged from prior behaviour):
|
|
513
412
|
// marker-stripped first paragraph + remaining paragraphs.
|
|
514
413
|
const rest = paraText.replace(ADMONITION_FIRST_LINE_RE, "").trim();
|
|
515
|
-
const otherText =
|
|
414
|
+
const otherText = bqNode.children
|
|
516
415
|
.slice(1)
|
|
517
|
-
// deno-lint-ignore no-explicit-any
|
|
518
416
|
.map((c) => extractMdastText(c))
|
|
519
417
|
.join("\n\n");
|
|
520
418
|
const flattened = [rest, otherText].filter(Boolean).join("\n\n");
|
|
@@ -544,8 +442,7 @@ function mapMdastNode(node, body) {
|
|
|
544
442
|
};
|
|
545
443
|
}
|
|
546
444
|
}
|
|
547
|
-
const bqFlattened =
|
|
548
|
-
// deno-lint-ignore no-explicit-any
|
|
445
|
+
const bqFlattened = bqNode.children
|
|
549
446
|
.map((c) => extractMdastText(c))
|
|
550
447
|
.join("\n\n");
|
|
551
448
|
return {
|
|
@@ -556,8 +453,7 @@ function mapMdastNode(node, body) {
|
|
|
556
453
|
}
|
|
557
454
|
default: {
|
|
558
455
|
let subkind;
|
|
559
|
-
if (node.type === "heading"
|
|
560
|
-
node.type === "setextHeading") {
|
|
456
|
+
if (node.type === "heading") {
|
|
561
457
|
subkind = "heading";
|
|
562
458
|
}
|
|
563
459
|
else if (node.type === "thematicBreak") {
|
|
@@ -596,10 +492,25 @@ function mapMdastNode(node, body) {
|
|
|
596
492
|
* only for single-line paragraphs.
|
|
597
493
|
*/
|
|
598
494
|
export function buildBodyAst(body) {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
495
|
+
return buildBodyAstWithTree(body).blocks;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Like {@linkcode buildBodyAst} but also returns the intermediate mdast
|
|
499
|
+
* `Root` so callers that need it (e.g. body-token extraction) avoid
|
|
500
|
+
* re-parsing.
|
|
501
|
+
*/
|
|
502
|
+
export function buildBodyAstWithTree(body) {
|
|
503
|
+
// Line-ending normalisation is a §3.4 spec-permitted transformation:
|
|
504
|
+
// every AST is built from LF-canonical text so `\r` never reaches a
|
|
505
|
+
// node's text or markers. Without this, `buildBodyAst("a\r\nb")` and
|
|
506
|
+
// `buildBodyAst("a\nb")` would produce different ASTs, breaking the
|
|
507
|
+
// build/render/format contract for CRLF-bearing inputs.
|
|
508
|
+
const normalised = normalizeLineEndings(body);
|
|
509
|
+
if (!normalised.trim()) {
|
|
510
|
+
return { blocks: [], tree: { type: "root", children: [] } };
|
|
511
|
+
}
|
|
512
|
+
const tree = processor.parse(normalised);
|
|
513
|
+
const blocks = tree.children.map((node) => mapMdastNode(node, normalised));
|
|
603
514
|
// Post-pass: assign caption positions
|
|
604
|
-
return assignCaptionPositions(blocks);
|
|
515
|
+
return { blocks: assignCaptionPositions(blocks), tree };
|
|
605
516
|
}
|
package/esm/ast/nodes.d.ts
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Canonical body-AST node taxonomy. Authoritative spec:
|
|
5
5
|
* `docs/specs/markspec-core-data-model.md` §2.4 (closed 10-block
|
|
6
|
-
* catalogue), §2.
|
|
6
|
+
* catalogue), §2.6 (captions).
|
|
7
7
|
*
|
|
8
8
|
* PR 1 of the canonical-body-AST plan: pure type contract, zero
|
|
9
9
|
* behaviour. The builder (`build.ts`) and renderer (`render.ts`)
|
|
10
10
|
* land in later PRs.
|
|
11
|
+
*
|
|
12
|
+
* ADR-016: inline-construct extraction (modal keywords, EARS triggers,
|
|
13
|
+
* entity refs, Gherkin tokens) has moved to `Entry.bodyTokens` —
|
|
14
|
+
* see `core/parser/body_tokens.ts`. `InlineContent` now carries only
|
|
15
|
+
* verbatim source text.
|
|
11
16
|
*/
|
|
12
|
-
import type { EntityRefConvention } from "../model/mod.js";
|
|
13
17
|
/** Body-relative source span. 1-based line/column, matching the
|
|
14
18
|
* codebase's {@link SourceLocation} convention. No `file`: that
|
|
15
19
|
* lives on the owning {@link Entry}. */
|
|
@@ -23,51 +27,15 @@ export interface SourceRange {
|
|
|
23
27
|
readonly column: number;
|
|
24
28
|
};
|
|
25
29
|
}
|
|
26
|
-
/**
|
|
27
|
-
export type ModalMarkerClass = "rfc2119" | "ears";
|
|
28
|
-
/** A recognised modal keyword occurrence in prose (spec §2.5.1). */
|
|
29
|
-
export interface ModalMarker {
|
|
30
|
-
readonly kind: "modal";
|
|
31
|
-
readonly cls: ModalMarkerClass;
|
|
32
|
-
/** Canonical (lowercased RFC 2119 / case-preserved EARS) form. */
|
|
33
|
-
readonly canonical: string;
|
|
34
|
-
/**
|
|
35
|
-
* Original source text as it appears in the body (may differ from
|
|
36
|
-
* `canonical` for RFC 2119 keywords written in uppercase, e.g.
|
|
37
|
-
* `"SHALL"` vs `canonical = "shall"`). Used by the MSL-M060 validator
|
|
38
|
-
* to report the exact uppercase form in the diagnostic message and to
|
|
39
|
-
* detect whether the keyword deviates from canonical form.
|
|
40
|
-
*
|
|
41
|
-
* Populated by {@link extractMarkersFromText} in `core/ast/build.ts`.
|
|
42
|
-
* Absent only for `ModalMarker` values constructed outside the builder
|
|
43
|
-
* (e.g. in tests that predate this field).
|
|
44
|
-
*/
|
|
45
|
-
readonly raw?: string;
|
|
46
|
-
readonly range: SourceRange;
|
|
47
|
-
}
|
|
48
|
-
/** An inline `$Identifier` entity reference (spec §2.5.2). Reuses
|
|
49
|
-
* the existing {@link EntityRefConvention}. */
|
|
50
|
-
export interface EntityRefMarker {
|
|
51
|
-
readonly kind: "entity";
|
|
52
|
-
/** Identifier including the leading `$`. */
|
|
53
|
-
readonly ident: string;
|
|
54
|
-
readonly convention: EntityRefConvention;
|
|
55
|
-
readonly range: SourceRange;
|
|
56
|
-
}
|
|
57
|
-
/** Inline marker union (spec §2.5). */
|
|
58
|
-
export type InlineMarker = ModalMarker | EntityRefMarker;
|
|
59
|
-
/**
|
|
60
|
-
* Prose text plus the inline markers recognised within it.
|
|
30
|
+
/** Prose text. Verbatim source (markup-preserving per spec §5.1).
|
|
61
31
|
*
|
|
62
32
|
* `text` is the **verbatim source prose** (markup-preserving — emphasis,
|
|
63
33
|
* strong, links, autolinks, hard line breaks survive byte-identically per
|
|
64
|
-
* spec §5.1).
|
|
65
|
-
*
|
|
66
|
-
* Marker `range` columns are best-effort relative to the verbatim text.
|
|
34
|
+
* spec §5.1). Inline-construct extraction (modal keywords, EARS triggers,
|
|
35
|
+
* entity refs) has moved to `Entry.bodyTokens` (ADR-016 Decision 5).
|
|
67
36
|
*/
|
|
68
37
|
export interface InlineContent {
|
|
69
38
|
readonly text: string;
|
|
70
|
-
readonly markers: readonly InlineMarker[];
|
|
71
39
|
}
|
|
72
40
|
/** A list item: a sequence of blocks (spec §2.4 `List`). */
|
|
73
41
|
export interface ListItemNode {
|
|
@@ -95,7 +63,7 @@ export interface DefinitionPair {
|
|
|
95
63
|
}
|
|
96
64
|
/** GitHub-style admonition kinds (spec §2.4 `Note`). */
|
|
97
65
|
export type AdmonitionKind = "NOTE" | "TIP" | "IMPORTANT" | "WARNING" | "CAUTION";
|
|
98
|
-
/** CommonMark paragraph
|
|
66
|
+
/** CommonMark paragraph (spec §2.4). */
|
|
99
67
|
export interface ParagraphNode {
|
|
100
68
|
readonly kind: "paragraph";
|
|
101
69
|
readonly content: InlineContent;
|
|
@@ -145,7 +113,7 @@ export interface CodeNode {
|
|
|
145
113
|
readonly text: string;
|
|
146
114
|
readonly range: SourceRange;
|
|
147
115
|
}
|
|
148
|
-
/** Fenced code with info-string `gherkin`.
|
|
116
|
+
/** Fenced code with info-string `gherkin` or `feature`. Content is kept verbatim
|
|
149
117
|
* for now; structured scenario parsing is deferred to a later PR
|
|
150
118
|
* (see the canonical-body-AST plan). */
|
|
151
119
|
export interface FeatureNode {
|
package/esm/ast/nodes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/ast/nodes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/ast/nodes.ts"],"names":[],"mappings":"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"}
|
package/esm/ast/nodes.js
CHANGED
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Canonical body-AST node taxonomy. Authoritative spec:
|
|
5
5
|
* `docs/specs/markspec-core-data-model.md` §2.4 (closed 10-block
|
|
6
|
-
* catalogue), §2.
|
|
6
|
+
* catalogue), §2.6 (captions).
|
|
7
7
|
*
|
|
8
8
|
* PR 1 of the canonical-body-AST plan: pure type contract, zero
|
|
9
9
|
* behaviour. The builder (`build.ts`) and renderer (`render.ts`)
|
|
10
10
|
* land in later PRs.
|
|
11
|
+
*
|
|
12
|
+
* ADR-016: inline-construct extraction (modal keywords, EARS triggers,
|
|
13
|
+
* entity refs, Gherkin tokens) has moved to `Entry.bodyTokens` —
|
|
14
|
+
* see `core/parser/body_tokens.ts`. `InlineContent` now carries only
|
|
15
|
+
* verbatim source text.
|
|
11
16
|
*/
|
|
12
17
|
export {};
|
package/esm/ast/normalize.d.ts
CHANGED
|
@@ -5,28 +5,20 @@
|
|
|
5
5
|
*
|
|
6
6
|
* `normalizeBodyAst` is a deterministic, total, pure AST→AST transform
|
|
7
7
|
* that applies the §3.4.1 modal-keyword case rule to every prose-bearing
|
|
8
|
-
* node's `InlineContent.text
|
|
9
|
-
* the normalised text via the SAME extraction the builder uses
|
|
10
|
-
* (`extractMarkersFromText`, re-exported from `core/ast/build.ts`).
|
|
8
|
+
* node's `InlineContent.text`.
|
|
11
9
|
*
|
|
12
|
-
* §3.4.1 rule (`docs/specs/markspec-core-data-model.md` §3.4.1)
|
|
13
|
-
* verbatim from the string pass `normalizeModalKeywords` in
|
|
14
|
-
* `core/formatter/mod.ts`:
|
|
10
|
+
* §3.4.1 rule (`docs/specs/markspec-core-data-model.md` §3.4.1):
|
|
15
11
|
*
|
|
16
12
|
* - RFC 2119 (`SHALL`, `SHOULD`, `MAY`, `MUST`, optionally `… NOT`) —
|
|
17
13
|
* always lowercased.
|
|
18
14
|
* - EARS (`When`, `While`, `Where`, `Unless`) — lowercased
|
|
19
15
|
* mid-sentence, capitalisation preserved when sentence-initial.
|
|
20
16
|
*
|
|
21
|
-
* The
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* path (SP3 Task 5), but `normalizeModalKeywords` in `formatter/mod.ts`
|
|
27
|
-
* is retained for the title/trailer string paths. Full deduplication is
|
|
28
|
-
* deferred to a future sprint (TODO SP4: unify the two implementations
|
|
29
|
-
* once all prose paths migrate to the AST path).
|
|
17
|
+
* The shared `RFC2119_MODAL_RE`, `EARS_KEYWORD_RE`, and `isSentenceInitial`
|
|
18
|
+
* helpers are imported from `core/util/modals.ts` (D11 consolidation).
|
|
19
|
+
* They cannot be imported from `formatter/mod.ts` because `formatter/`
|
|
20
|
+
* depends on `ast/`, making an `ast → formatter` import a dependency cycle.
|
|
21
|
+
* `core/util/` is the base level that both modules can import from.
|
|
30
22
|
*
|
|
31
23
|
* Invariants (HARD — never weaken):
|
|
32
24
|
* - Pure: no `Deno.*`, no I/O.
|
|
@@ -44,8 +36,7 @@
|
|
|
44
36
|
import type { BodyBlock } from "./nodes.js";
|
|
45
37
|
/**
|
|
46
38
|
* Apply the §3.4.1 modal-keyword case rule to every prose-bearing node
|
|
47
|
-
* in a body AST
|
|
48
|
-
* text.
|
|
39
|
+
* in a body AST.
|
|
49
40
|
*
|
|
50
41
|
* Pure, deterministic, total (never throws; unknown shapes pass
|
|
51
42
|
* through), idempotent, and non-mutating: a fresh top-level array is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/ast/normalize.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/ast/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAQH,OAAO,KAAK,EAEV,SAAS,EASV,MAAM,YAAY,CAAC;AAiJpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,SAAS,EAAE,GAC3B,SAAS,EAAE,CAEb"}
|