@jasonbelmonti/markdown-engine 3.4.0 → 3.5.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/CHANGELOG.md +9 -0
- package/README.md +11 -10
- package/dist/declarative-validation/assertions/frontmatter-shape.js +45 -5
- package/dist/declarative-validation/assertions/frontmatter-shape.js.map +1 -1
- package/dist/declarative-validation/profile/frontmatter-shape-schema.js +52 -7
- package/dist/declarative-validation/profile/frontmatter-shape-schema.js.map +1 -1
- package/dist/declarative-validation/profile/index.d.ts +14 -0
- package/dist/declarative-validation/profile/index.d.ts.map +1 -1
- package/dist/internal/package-version.d.ts +1 -1
- package/dist/internal/package-version.js +1 -1
- package/dist-bundled/markdown-engine-cli.mjs +393 -285
- package/docs/contracts/declarative-validation.md +26 -5
- package/package.json +1 -1
- package/scripts/install-markdown-engine-cli.sh +2 -2
|
@@ -343,6 +343,9 @@ interface DeclarativeAssertion {
|
|
|
343
343
|
required?: true;
|
|
344
344
|
valueType?: "string" | "number" | "boolean" | "array" | "object" | "null";
|
|
345
345
|
nonEmpty?: true;
|
|
346
|
+
equals?: string;
|
|
347
|
+
nonBlank?: true;
|
|
348
|
+
forbidden?: true;
|
|
346
349
|
}[];
|
|
347
350
|
};
|
|
348
351
|
text?: {
|
|
@@ -464,12 +467,17 @@ selector because frontmatter is document metadata. `presence` is optional and
|
|
|
464
467
|
must be exactly `"required"` or `"forbidden"` when provided. `fields` is an
|
|
465
468
|
optional non-empty array of field constraints. Each field constraint has a
|
|
466
469
|
required non-empty `field` name and must include at least one effective
|
|
467
|
-
constraint: `required: true`, `valueType`,
|
|
468
|
-
|
|
470
|
+
constraint: `required: true`, `valueType`, `nonEmpty: true`, `equals`,
|
|
471
|
+
`nonBlank: true`, or `forbidden: true`. Field names within one
|
|
472
|
+
`frontmatterShape.fields` array must be unique. `valueType` must be
|
|
469
473
|
one of `"string"`, `"number"`, `"boolean"`, `"array"`, `"object"`, or `"null"`.
|
|
470
|
-
`nonEmpty: true`
|
|
471
|
-
`valueType` must be `"string"`. `
|
|
472
|
-
|
|
474
|
+
`nonEmpty: true`, `equals`, and `nonBlank: true` are string predicates; when
|
|
475
|
+
any is combined with `valueType`, `valueType` must be `"string"`. `equals`
|
|
476
|
+
accepts any string, including the empty string, and compares it exactly.
|
|
477
|
+
`nonBlank: true` requires a string whose JavaScript `trim()` result is non-empty.
|
|
478
|
+
`forbidden: true` requires the named field to be absent and cannot be combined
|
|
479
|
+
with `required`, `valueType`, `nonEmpty`, `equals`, or `nonBlank`.
|
|
480
|
+
`presence: "forbidden"` cannot be combined with `fields`.
|
|
473
481
|
|
|
474
482
|
Runtime evaluation treats frontmatter as present when
|
|
475
483
|
`document.frontmatter !== undefined`. `presence: "required"` fails absent
|
|
@@ -486,6 +494,16 @@ requires a present field value to be a non-empty string and emits
|
|
|
486
494
|
`profile.validation.frontmatterFieldEmpty` when that predicate fails. When
|
|
487
495
|
`valueType: "string"` and `nonEmpty: true` are combined, a non-string value
|
|
488
496
|
emits the type-mismatch diagnostic without a duplicate empty-string diagnostic.
|
|
497
|
+
`equals` compares present strings exactly without coercion and emits
|
|
498
|
+
`profile.validation.frontmatterFieldValueMismatch` on mismatch. `nonBlank: true`
|
|
499
|
+
uses JavaScript `trim()` without coercion and emits
|
|
500
|
+
`profile.validation.frontmatterFieldBlank` when its field is not a non-blank
|
|
501
|
+
string. `forbidden: true` emits `profile.validation.frontmatterFieldForbidden`
|
|
502
|
+
when the named field is present, regardless of value. When `valueType: "string"`
|
|
503
|
+
is combined with `equals` or `nonBlank`, a non-string value emits only
|
|
504
|
+
`profile.validation.frontmatterFieldTypeMismatch` rather than an additional
|
|
505
|
+
string-predicate diagnostic. Diagnostic messages do not include frontmatter
|
|
506
|
+
values.
|
|
489
507
|
|
|
490
508
|
`text` must include `contains` or a non-empty `excludes` array.
|
|
491
509
|
`textOccurrenceCount.count` is a finite number and counts non-overlapping
|
|
@@ -558,9 +576,12 @@ an unproven pass.
|
|
|
558
576
|
| `profile.validation.assertionFailed` | Rule severity | A supported assertion evaluates and fails without a more specific diagnostic code, including selector-count bound failures, missing table columns, exact table-header mismatches, exact occurrence-count mismatches, text-length bound failures, and text-format `isoDate` failures. |
|
|
559
577
|
| `profile.validation.duplicateId` | Rule severity | An `ids.unique` assertion finds repeated IDs. |
|
|
560
578
|
| `profile.validation.frontmatterForbidden` | Rule severity | A `frontmatterShape` assertion with `presence: "forbidden"` finds present frontmatter. |
|
|
579
|
+
| `profile.validation.frontmatterFieldBlank` | Rule severity | A frontmatter field configured with `nonBlank: true` is not a non-blank string. |
|
|
561
580
|
| `profile.validation.frontmatterFieldEmpty` | Rule severity | A frontmatter field configured with `nonEmpty: true` is not a non-empty string. |
|
|
581
|
+
| `profile.validation.frontmatterFieldForbidden` | Rule severity | A frontmatter field configured with `forbidden: true` is present. |
|
|
562
582
|
| `profile.validation.frontmatterFieldMissing` | Rule severity | A required frontmatter field is absent. |
|
|
563
583
|
| `profile.validation.frontmatterFieldTypeMismatch` | Rule severity | A frontmatter field value does not match the configured `frontmatterShape.fields[].valueType` without coercion. |
|
|
584
|
+
| `profile.validation.frontmatterFieldValueMismatch` | Rule severity | A frontmatter field configured with `equals` does not exactly match the configured string without coercion. |
|
|
564
585
|
| `profile.validation.frontmatterMissing` | Rule severity | A `frontmatterShape` assertion with `presence: "required"` finds absent frontmatter. |
|
|
565
586
|
| `profile.validation.idCountTooHigh` | Rule severity | Unique ID count after filtering is higher than `ids.maxCount`. |
|
|
566
587
|
| `profile.validation.idCountTooLow` | Rule severity | Unique ID count after filtering is lower than `ids.minCount`. |
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env sh
|
|
2
2
|
set -eu
|
|
3
3
|
|
|
4
|
-
VERSION="3.
|
|
4
|
+
VERSION="3.5.0"
|
|
5
5
|
PACKAGE="@jasonbelmonti/markdown-engine"
|
|
6
|
-
EXPECTED_SHA256="
|
|
6
|
+
EXPECTED_SHA256="4a4e9ae7d9ff4797c96a7483555bcba7cbec5852d330c6c50dc0ef8fb2e5d933"
|
|
7
7
|
DEFAULT_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
|
8
8
|
MARKDOWN_ENGINE_HOME="${MARKDOWN_ENGINE_HOME:-$DEFAULT_DATA_HOME/markdown-engine}"
|
|
9
9
|
MARKDOWN_ENGINE_BIN_DIR="${MARKDOWN_ENGINE_BIN_DIR:-$HOME/.local/bin}"
|