@nielspeter/eess-md 0.6.1 → 0.8.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 +15 -0
- package/dist/builders/vocabulary.d.ts.map +1 -1
- package/dist/builders/vocabulary.js +4 -6
- package/dist/builders/vocabulary.js.map +1 -1
- package/dist/internal.d.ts +2 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +16 -0
- package/dist/internal.js.map +1 -0
- package/dist/model/prose.d.ts +44 -0
- package/dist/model/prose.d.ts.map +1 -0
- package/dist/model/prose.js +155 -0
- package/dist/model/prose.js.map +1 -0
- package/dist/rules/ledger.d.ts +2 -1
- package/dist/rules/ledger.d.ts.map +1 -1
- package/dist/rules/ledger.js +71 -12
- package/dist/rules/ledger.js.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -168,6 +168,21 @@ adrEnforcement(c, {
|
|
|
168
168
|
})
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
+
## `@nielspeter/eess-md/internal` is not API
|
|
172
|
+
|
|
173
|
+
| Specifier | What it is |
|
|
174
|
+
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
175
|
+
| `@nielspeter/eess-md` | The public API — the corpus, the builders, the presets. A change to it is a versioned change. |
|
|
176
|
+
| `@nielspeter/eess-md/internal` | Family plumbing: `proseText`, the one reader of a document's prose the family shares, so nothing hand-rolls a fence regex. Not API. |
|
|
177
|
+
|
|
178
|
+
You want the root. `/internal` exists so the family's other markdown readers —
|
|
179
|
+
`@nielspeter/eess-crossvalidate`, and this repo's own gate scripts — can read prose the way this
|
|
180
|
+
dialect reads it, rather than keeping a copy that disagrees with it (bug 0287). It is published because
|
|
181
|
+
npm has no way to ship a package-private module. Nothing there is documented beyond its own JSDoc, the
|
|
182
|
+
package barrel does not re-export it, and it changes without migration notes. The kernel's
|
|
183
|
+
`/internal` says the same thing for the same reason; see
|
|
184
|
+
[ADR-011](https://github.com/nielspeter/eess/blob/main/adr/011-the-kernels-public-api-is-explicit.md).
|
|
185
|
+
|
|
171
186
|
## License
|
|
172
187
|
|
|
173
188
|
MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../../src/builders/vocabulary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAsD,MAAM,kBAAkB,CAAA;AAClG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../../src/builders/vocabulary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAsD,MAAM,kBAAkB,CAAA;AAClG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGtD;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3E,qDAAqD;IACrD,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CAC/C;AAED,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACnC,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CAC9C;AAID,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAoCjF;AAED,kFAAkF;AAClF,MAAM,WAAW,MAAM;IACrB,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,6DAA6D;IAC7D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CAC1C;AA0DD,wEAAwE;AACxE,qBAAa,eAAgB,SAAQ,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;IAG5D,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADrB,MAAM,EAAE,MAAM,EACG,IAAI,EAAE,YAAY;IAKrC,SAAS,CAAC,WAAW,IAAI,MAAM,EAAE;IAIjC,qEAAqE;IACrE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIhC,kEAAkE;IAClE,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAGxC;AAED,qFAAqF;AACrF,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,eAAe,CAE5E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import picomatch from 'picomatch';
|
|
2
2
|
import { RuleBuilder } from '@nielspeter/eess';
|
|
3
|
+
import { proseText } from '../model/prose.js';
|
|
3
4
|
const defaultNormalize = (value) => value.trim();
|
|
4
5
|
/** Derive a controlled vocabulary from the corpus. */
|
|
5
6
|
export function vocabulary(corpus, options) {
|
|
@@ -39,11 +40,6 @@ export function vocabulary(corpus, options) {
|
|
|
39
40
|
terms.add(normalize(t));
|
|
40
41
|
return { terms, normalize };
|
|
41
42
|
}
|
|
42
|
-
// Blank out fenced code (line-preserving) so example prose never yields terms.
|
|
43
|
-
const FENCE_RE = /(```|~~~)[\s\S]*?\1/g;
|
|
44
|
-
function stripFencedCode(s) {
|
|
45
|
-
return s.replace(FENCE_RE, (m) => '\n'.repeat((m.match(/\n/g) ?? []).length));
|
|
46
|
-
}
|
|
47
43
|
const defaultValue = (rest) => rest
|
|
48
44
|
.replace(/[*_`]/g, '')
|
|
49
45
|
.trim()
|
|
@@ -55,7 +51,9 @@ function collectTerms(corpus, options) {
|
|
|
55
51
|
const label = new RegExp(options.label.source, options.label.flags.replace(/g/g, ''));
|
|
56
52
|
const out = [];
|
|
57
53
|
for (const doc of corpus.documents()) {
|
|
58
|
-
|
|
54
|
+
// A closed fence is an example, so its prose never yields terms. Only a closed one: a builder cannot
|
|
55
|
+
// report a fence that never closes, so it reads past one rather than drop the rest (bug 0287).
|
|
56
|
+
const lines = proseText(doc.text, 'closed-fences', doc.root).split('\n');
|
|
59
57
|
for (let i = 0; i < lines.length; i++) {
|
|
60
58
|
const line = lines[i] ?? '';
|
|
61
59
|
const m = label.exec(line);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../../src/builders/vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,WAAW,EAAsD,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../../src/builders/vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,WAAW,EAAsD,MAAM,kBAAkB,CAAA;AAGlG,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AA+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I,CAAC,CAAA;IAC9C,CAAC;IAED,qEAAqE;IACrE,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9C,CAAC;IAED,kEAAkE;IAClE,cAAc,CAAC,KAAiB;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAA;IACjD,CAAC;CACF;AAED,qFAAqF;AACrF,MAAM,UAAU,KAAK,CAAC,MAAc,EAAE,OAAqB;IACzD,OAAO,IAAI,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @nielspeter/eess-md/internal — family plumbing, the dialect's counterpart of the kernel's (ADR-011).
|
|
2
|
+
//
|
|
3
|
+
// NOT public API. These symbols exist so the family's other markdown readers — eess-crossvalidate and this
|
|
4
|
+
// repo's own gate scripts — read a document's prose with the one reader this dialect owns rather than a
|
|
5
|
+
// copy of it (bug 0287). A consumer writing rules never names them, and nothing here is taught by `docs/`
|
|
6
|
+
// or the package README.
|
|
7
|
+
//
|
|
8
|
+
// As with the kernel's, the boundary holds on this side only: the package barrel must never re-export
|
|
9
|
+
// what is here (checked by `scripts/lib/internal-not-reexported.test.mjs`), and a subpath export is
|
|
10
|
+
// resolvable by anyone.
|
|
11
|
+
//
|
|
12
|
+
// `unterminatedFence` rides along with `proseText` on purpose: a caller that sets aside only closed
|
|
13
|
+
// fences is choosing to read past an unclosed one, and ADR-010's line is that a verdict is built from
|
|
14
|
+
// evidence. A caller that can report should be able to reach the fact, not just the reading.
|
|
15
|
+
export { proseText, unclosedFences, unterminatedFence } from './model/prose.js';
|
|
16
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,EAAE;AACF,2GAA2G;AAC3G,wGAAwG;AACxG,0GAA0G;AAC1G,yBAAyB;AACzB,EAAE;AACF,sGAAsG;AACtG,oGAAoG;AACpG,wBAAwB;AACxB,EAAE;AACF,oGAAoG;AACpG,sGAAsG;AACtG,6FAA6F;AAE7F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAiB,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Root } from 'mdast';
|
|
2
|
+
/**
|
|
3
|
+
* Which code a reader sets aside (bug 0287).
|
|
4
|
+
*
|
|
5
|
+
* - `'code-blocks'` — every code block the parser reports, which is how CommonMark reads the document.
|
|
6
|
+
* For a reader that reports what it cannot read: the ledger reads this way, and reports a fence that
|
|
7
|
+
* never closes and a `State:` line found only in code. Not named `'commonmark'`: both readings deviate
|
|
8
|
+
* from it by one deliberate step, the fenced example inside an HTML block below.
|
|
9
|
+
* - `'closed-fences'` — only a fence with its closing line, the one shape that is certainly an example.
|
|
10
|
+
* For a reader that cannot report: an indented block, or a fence that never closes, is read. A reader
|
|
11
|
+
* whose findings grow with what it reads — a term, a citation — then errs toward a false red, never a
|
|
12
|
+
* silent pass. A reader that keeps only the **last** of something does not have that property: an
|
|
13
|
+
* example read after the real line becomes the verdict. Such a reader must refuse below a fence with
|
|
14
|
+
* no closing line rather than pick a side — {@link unclosedFences} is the fact it refuses on, and the
|
|
15
|
+
* proposal-ruling gate script is the one that does it.
|
|
16
|
+
*
|
|
17
|
+
* In both, a closed fence inside an HTML block is set aside too.
|
|
18
|
+
*/
|
|
19
|
+
export type SetAside = 'code-blocks' | 'closed-fences';
|
|
20
|
+
/**
|
|
21
|
+
* The document's text with every line of the code it sets aside blanked, and the line count kept, so a
|
|
22
|
+
* line number read from it is a line number in the document. The mode is required: the two readings
|
|
23
|
+
* drop different lines, and a caller must say which one it can answer for.
|
|
24
|
+
*/
|
|
25
|
+
export declare function proseText(text: string, setAside: SetAside, root?: Root): string;
|
|
26
|
+
/**
|
|
27
|
+
* The opening line of every fence with no closing line, in document order — ended by its container or by
|
|
28
|
+
* the end of the document alike.
|
|
29
|
+
*
|
|
30
|
+
* For a reader that keeps only the last of something: below such a fence, whether a line is the
|
|
31
|
+
* document's own claim or an example is not decidable, and the two readings disagree. A reader that can
|
|
32
|
+
* report should refuse rather than pick (bug 0287's review measured an example ruling inside a
|
|
33
|
+
* list-item-ended fence becoming a proposal's verdict).
|
|
34
|
+
*/
|
|
35
|
+
export declare function unclosedFences(text: string, root?: Root): number[];
|
|
36
|
+
/**
|
|
37
|
+
* The line of a fenced code block that never closes and so runs to the end of the document, or
|
|
38
|
+
* `null`. By CommonMark everything after such a fence is code, so a `State:` line or a task box below
|
|
39
|
+
* it is not the document's own; a reader that silently agrees reports nothing at all (bug 0286). A
|
|
40
|
+
* fence its container ends is not reported here — it hides only what is inside that container, and
|
|
41
|
+
* {@link unclosedFences} is the wider fact.
|
|
42
|
+
*/
|
|
43
|
+
export declare function unterminatedFence(text: string, root: Root): number | null;
|
|
44
|
+
//# sourceMappingURL=prose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prose.d.ts","sourceRoot":"","sources":["../../src/model/prose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,IAAI,EAAE,MAAM,OAAO,CAAA;AAsHxC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,eAAe,CAAA;AAEtD;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,IAAI,GAAE,IAA0B,GAC/B,MAAM,CAUR;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,IAA0B,GAAG,MAAM,EAAE,CAIvF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAMzE"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
2
|
+
import { gfm } from 'micromark-extension-gfm';
|
|
3
|
+
import { gfmFromMarkdown } from 'mdast-util-gfm';
|
|
4
|
+
/**
|
|
5
|
+
* Which lines of a markdown document are prose, read with the parser the corpus is read with (bugs 0286
|
|
6
|
+
* and 0287). A scan for a claim a document makes — a `State:` line, a `Deferred:` summary, a ruling, a
|
|
7
|
+
* term, a citation — must skip an example of the claim written as a code block. Four scans each
|
|
8
|
+
* hand-rolled a regex for that, which read a triple-backtick run inside a longer fence as a closer and
|
|
9
|
+
* disagreed with the parser the task-box pass beside one of them runs. They all ask the parser now,
|
|
10
|
+
* through this one owner.
|
|
11
|
+
*
|
|
12
|
+
* Code blocks, and fenced examples inside an HTML block. An HTML block can hold a record's real claim as
|
|
13
|
+
* well as an example of one, so setting whole HTML blocks aside silences real claims; that is bug 0293's
|
|
14
|
+
* design question, not decided here.
|
|
15
|
+
*/
|
|
16
|
+
const GFM = gfm();
|
|
17
|
+
const GFM_MDAST = gfmFromMarkdown();
|
|
18
|
+
/** Parse markdown as the corpus does. */
|
|
19
|
+
function parseMarkdown(text) {
|
|
20
|
+
return fromMarkdown(text, { extensions: [GFM], mdastExtensions: [GFM_MDAST] });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A node's last line. A position's end is exclusive, so a block its container closes ends at column 1 of
|
|
24
|
+
* the next line; that line is not part of the block.
|
|
25
|
+
*/
|
|
26
|
+
function lastLineOf(node) {
|
|
27
|
+
if (!node.position)
|
|
28
|
+
return 0;
|
|
29
|
+
const { start, end } = node.position;
|
|
30
|
+
return end.column === 1 && end.line > start.line ? end.line - 1 : end.line;
|
|
31
|
+
}
|
|
32
|
+
/** Visit every node, in document order. */
|
|
33
|
+
function walk(node, visit) {
|
|
34
|
+
visit(node);
|
|
35
|
+
if ('children' in node)
|
|
36
|
+
for (const child of node.children)
|
|
37
|
+
walk(child, visit);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Each code node with its first and last line and its shape, in document order.
|
|
41
|
+
*
|
|
42
|
+
* Whether a fence has its closing line is read off the parser, not re-derived: a closed fence spans its
|
|
43
|
+
* opener, its content and its closer, so an unclosed one spans one line fewer than its content plus two.
|
|
44
|
+
*/
|
|
45
|
+
function codeBlocks(text, root) {
|
|
46
|
+
const lines = text.split('\n');
|
|
47
|
+
const blocks = [];
|
|
48
|
+
walk(root, (node) => {
|
|
49
|
+
if (node.type !== 'code' || !node.position)
|
|
50
|
+
return;
|
|
51
|
+
const first = node.position.start.line;
|
|
52
|
+
const last = lastLineOf(node);
|
|
53
|
+
const opener = (lines[first - 1] ?? '').slice(node.position.start.column - 1);
|
|
54
|
+
const contentLines = node.value === '' ? 0 : node.value.split('\n').length;
|
|
55
|
+
const shape = !/^(`{3,}|~{3,})/.test(opener)
|
|
56
|
+
? 'indented'
|
|
57
|
+
: last - first + 1 >= contentLines + 2
|
|
58
|
+
? 'closed-fence'
|
|
59
|
+
: 'unclosed-fence';
|
|
60
|
+
blocks.push({ first, last, shape });
|
|
61
|
+
});
|
|
62
|
+
return blocks;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The closed fences written inside an HTML block. CommonMark reads such a fence as raw HTML, so the
|
|
66
|
+
* parser has no code node for it; but the author fenced it as an example, and the copies this owner
|
|
67
|
+
* replaced set aside a simple one there — mis-reading a longer one, as they did everywhere else (bug
|
|
68
|
+
* record's state and as a proposal's ruling). Paired by run length as CommonMark pairs a fence: a closer
|
|
69
|
+
* is a run of the opener's character at least as long, alone on its line. A fence with no closer inside
|
|
70
|
+
* the block is not set aside.
|
|
71
|
+
*
|
|
72
|
+
* **Indentation carries no meaning here**, of any width or kind. CommonMark's "at most three spaces, or
|
|
73
|
+
* it is an indented code block instead" is a rule about a markdown block context, and inside an HTML
|
|
74
|
+
* block there is none: every line is raw text. Importing that bound split `<details>` bodies by how far
|
|
75
|
+
* their author indented them — four spaces or a tab and the example was read as the document's own
|
|
76
|
+
* claim, measured on the ledger and on a proposal's ruling, where 0.6.0's textual regex set both aside.
|
|
77
|
+
*
|
|
78
|
+
* **This pairing is hand-rolled, and it is the one place in the family that still is.** Bug 0287's
|
|
79
|
+
* thesis is "ask the parser", and here there is nothing to ask: the parser hands back one `html` node
|
|
80
|
+
* and no structure inside it. So this loop can drift from micromark's fence rules where they are subtler
|
|
81
|
+
* than run length and the info string — which is why it lives in the owner, under the check that allows
|
|
82
|
+
* a fence regex in this file and nowhere else.
|
|
83
|
+
*/
|
|
84
|
+
function fencesInHtml(text, root) {
|
|
85
|
+
const lines = text.split('\n');
|
|
86
|
+
const out = [];
|
|
87
|
+
walk(root, (node) => {
|
|
88
|
+
if (node.type !== 'html' || !node.position)
|
|
89
|
+
return;
|
|
90
|
+
const column = node.position.start.column - 1;
|
|
91
|
+
let open = null;
|
|
92
|
+
for (let n = node.position.start.line; n <= lastLineOf(node); n++) {
|
|
93
|
+
const fence = /^[ \t]*(`{3,}|~{3,})(.*)$/.exec((lines[n - 1] ?? '').slice(column));
|
|
94
|
+
const run = fence?.[1];
|
|
95
|
+
if (run === undefined)
|
|
96
|
+
continue;
|
|
97
|
+
const rest = fence?.[2] ?? '';
|
|
98
|
+
if (open === null) {
|
|
99
|
+
if (!(run.startsWith('`') && rest.includes('`')))
|
|
100
|
+
open = { char: run.charAt(0), length: run.length, line: n };
|
|
101
|
+
}
|
|
102
|
+
else if (run.charAt(0) === open.char && run.length >= open.length && rest.trim() === '') {
|
|
103
|
+
out.push({ first: open.line, last: n });
|
|
104
|
+
open = null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The document's text with every line of the code it sets aside blanked, and the line count kept, so a
|
|
112
|
+
* line number read from it is a line number in the document. The mode is required: the two readings
|
|
113
|
+
* drop different lines, and a caller must say which one it can answer for.
|
|
114
|
+
*/
|
|
115
|
+
export function proseText(text, setAside, root = parseMarkdown(text)) {
|
|
116
|
+
const lines = text.split('\n');
|
|
117
|
+
const blank = (first, last) => {
|
|
118
|
+
for (let line = first; line <= last && line <= lines.length; line++)
|
|
119
|
+
lines[line - 1] = '';
|
|
120
|
+
};
|
|
121
|
+
for (const { first, last, shape } of codeBlocks(text, root)) {
|
|
122
|
+
if (setAside === 'code-blocks' || shape === 'closed-fence')
|
|
123
|
+
blank(first, last);
|
|
124
|
+
}
|
|
125
|
+
for (const { first, last } of fencesInHtml(text, root))
|
|
126
|
+
blank(first, last);
|
|
127
|
+
return lines.join('\n');
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The opening line of every fence with no closing line, in document order — ended by its container or by
|
|
131
|
+
* the end of the document alike.
|
|
132
|
+
*
|
|
133
|
+
* For a reader that keeps only the last of something: below such a fence, whether a line is the
|
|
134
|
+
* document's own claim or an example is not decidable, and the two readings disagree. A reader that can
|
|
135
|
+
* report should refuse rather than pick (bug 0287's review measured an example ruling inside a
|
|
136
|
+
* list-item-ended fence becoming a proposal's verdict).
|
|
137
|
+
*/
|
|
138
|
+
export function unclosedFences(text, root = parseMarkdown(text)) {
|
|
139
|
+
return codeBlocks(text, root)
|
|
140
|
+
.filter((b) => b.shape === 'unclosed-fence')
|
|
141
|
+
.map((b) => b.first);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The line of a fenced code block that never closes and so runs to the end of the document, or
|
|
145
|
+
* `null`. By CommonMark everything after such a fence is code, so a `State:` line or a task box below
|
|
146
|
+
* it is not the document's own; a reader that silently agrees reports nothing at all (bug 0286). A
|
|
147
|
+
* fence its container ends is not reported here — it hides only what is inside that container, and
|
|
148
|
+
* {@link unclosedFences} is the wider fact.
|
|
149
|
+
*/
|
|
150
|
+
export function unterminatedFence(text, root) {
|
|
151
|
+
const lastContentLine = text.trimEnd().split('\n').length;
|
|
152
|
+
const block = codeBlocks(text, root).find((b) => b.shape === 'unclosed-fence' && b.last >= lastContentLine);
|
|
153
|
+
return block?.first ?? null;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=prose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prose.js","sourceRoot":"","sources":["../../src/model/prose.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD;;;;;;;;;;;GAWG;AAEH,MAAM,GAAG,GAAG,GAAG,EAAE,CAAA;AACjB,MAAM,SAAS,GAAG,eAAe,EAAE,CAAA;AAEnC,yCAAyC;AACzC,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,YAAY,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,eAAe,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AAChF,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAW;IAC7B,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO,CAAC,CAAA;IAC5B,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAA;IACpC,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAA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IACD,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC;QAAE,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC1E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,OAAa,aAAa,CAAC,IAAI,CAAC;IAC3E,OAAO,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC;SAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,gBAAgB,CAAC;SAC3C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AACxB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,IAAU;IACxD,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAA;IACzD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,gBAAgB,IAAI,CAAC,CAAC,IAAI,IAAI,eAAe,CACjE,CAAA;IACD,OAAO,KAAK,EAAE,KAAK,IAAI,IAAI,CAAA;AAC7B,CAAC"}
|
package/dist/rules/ledger.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type PresetReportOptions } from '@nielspeter/eess';
|
|
2
2
|
import type { Corpus } from '../corpus.js';
|
|
3
3
|
import type { ArchViolation } from '../model/violation.js';
|
|
4
|
+
import type { Root } from 'mdast';
|
|
4
5
|
/**
|
|
5
6
|
* `honestyAtClose` — the ledger-reconciliation gate for an engineering corpus.
|
|
6
7
|
*
|
|
@@ -79,7 +80,7 @@ export interface HonestyAtCloseOptions extends PresetReportOptions {
|
|
|
79
80
|
* the done-item test and the placement check so the two cannot disagree about
|
|
80
81
|
* what a document says it is.
|
|
81
82
|
*/
|
|
82
|
-
export declare function findState(text: string, vocabulary: readonly string[]): {
|
|
83
|
+
export declare function findState(text: string, vocabulary: readonly string[], root?: Root): {
|
|
83
84
|
state?: string;
|
|
84
85
|
raw: string;
|
|
85
86
|
line: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../src/rules/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,mBAAmB,EAAuB,MAAM,kBAAkB,CAAA;AAE9F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../src/rules/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,mBAAmB,EAAuB,MAAM,kBAAkB,CAAA;AAE9F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAMjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CACtC;AAwED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,IAAI,CAAC,EAAE,IAAI,GACV;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAItD;AA6TD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,qBAA0B,GAClC,aAAa,EAAE,CA2EjB;AAED,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,wEAAwE;IACxE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,WAAW,CAqB5F"}
|
package/dist/rules/ledger.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { finishPreset, mergeCollectResults } from '@nielspeter/eess';
|
|
2
2
|
import { collectTaskItems } from '../model/task-items.js';
|
|
3
|
+
import { proseText, unterminatedFence } from '../model/prose.js';
|
|
3
4
|
import { docs } from '../builders/docs.js';
|
|
4
5
|
import { taskItems } from '../builders/task-items.js';
|
|
5
6
|
const DEFAULT_DONE_FOLDERS = ['/completed/', '/fixed/', '/wont-do/', '/delivered/', '/archived/'];
|
|
@@ -65,21 +66,20 @@ const DISPOSITION_RE = /(\bdone-otherwise\b|\bdropped-on-purpose\b|\bvalidation-
|
|
|
65
66
|
const DEFERRED_DISPOSITION_RE = /deferred\s*(?:→|->|:|\bto\b)\s*(?!none\b)\S/i;
|
|
66
67
|
// A summary line asserting the deferral count out loud, e.g. `Deferred: none`.
|
|
67
68
|
const DEFERRED_SUMMARY_RE = /^[^\S\n]*(?:[-*+][^\S\n]+)?(?:\*\*)?deferred:?(?:\*\*)?[^\S\n]*(.+?)[^\S\n]*$/im;
|
|
68
|
-
const FENCE_RE = /(```|~~~)[\s\S]*?\1/g;
|
|
69
|
-
// Blank out fenced code in place (preserve line numbers) so an illustrative
|
|
70
|
-
// `**State:** Done` or `Deferred: none` in an example never misclassifies.
|
|
71
|
-
function stripFencedCode(s) {
|
|
72
|
-
return s.replace(FENCE_RE, (m) => '\n'.repeat((m.match(/\n/g) ?? []).length));
|
|
73
|
-
}
|
|
74
69
|
/**
|
|
75
70
|
* The `State:` token in the header region, with its line — one scan, shared by
|
|
76
71
|
* the done-item test and the placement check so the two cannot disagree about
|
|
77
72
|
* what a document says it is.
|
|
78
73
|
*/
|
|
79
|
-
export function findState(text, vocabulary) {
|
|
74
|
+
export function findState(text, vocabulary, root) {
|
|
75
|
+
// Prose only, read as CommonMark reads it, so an illustrative `**State:** Draft` in a code block is
|
|
76
|
+
// not the document's own (bugs 0286, 0287) — by the parser the task-box pass uses.
|
|
77
|
+
return stateIn(proseText(text, 'code-blocks', root).split('\n'), vocabulary);
|
|
78
|
+
}
|
|
79
|
+
/** The first `State:` token in the header region of these lines — `findState`'s scan. */
|
|
80
|
+
function stateIn(lines, vocabulary) {
|
|
80
81
|
const known = stateMatcher(vocabulary);
|
|
81
82
|
const canonical = (m) => vocabulary.find((s) => s.toLowerCase().replace(/’/g, "'") === m.toLowerCase().replace(/’/g, "'")) ?? m;
|
|
82
|
-
const lines = stripFencedCode(text).split('\n');
|
|
83
83
|
// The preamble **and the first section**. Stopping at the first `##` — as this
|
|
84
84
|
// did — meant the check never ran on a real document in the corpus it was
|
|
85
85
|
// written for: the house template is `# Title` / `## Status` / `- **State:** X`,
|
|
@@ -108,7 +108,7 @@ export function findState(text, vocabulary) {
|
|
|
108
108
|
function isDoneItem(doc, doneFolders, terminalStates) {
|
|
109
109
|
if (doneFolders.some((seg) => `/${doc.relPath}`.includes(seg)))
|
|
110
110
|
return true;
|
|
111
|
-
const found = findState(doc.text, terminalStates);
|
|
111
|
+
const found = findState(doc.text, terminalStates, doc.root);
|
|
112
112
|
return found?.state !== undefined && terminalStates.includes(found.state);
|
|
113
113
|
}
|
|
114
114
|
const v = (rule, doc, line, message, because) => ({
|
|
@@ -128,7 +128,7 @@ const v = (rule, doc, line, message, because) => ({
|
|
|
128
128
|
*/
|
|
129
129
|
function headerStateViolation(doc, inDoneFolder, closeInPlace, states, terminalStates) {
|
|
130
130
|
const known = [...new Set([...states, ...terminalStates])];
|
|
131
|
-
const found = findState(doc.text, known);
|
|
131
|
+
const found = findState(doc.text, known, doc.root);
|
|
132
132
|
if (!found)
|
|
133
133
|
return null; // no State line at all → this document is not an item
|
|
134
134
|
if (found.state === undefined) {
|
|
@@ -167,7 +167,7 @@ function hasDeferredDisposedBox(doc) {
|
|
|
167
167
|
* is deliberately NOT gated; only a *contradicting* one is.
|
|
168
168
|
*/
|
|
169
169
|
function deferredNoneLieViolation(doc) {
|
|
170
|
-
const lines =
|
|
170
|
+
const lines = proseText(doc.text, 'code-blocks', doc.root).split('\n');
|
|
171
171
|
for (let i = 0; i < lines.length; i++) {
|
|
172
172
|
const raw = lines[i] ?? '';
|
|
173
173
|
if (/^\s*>/.test(raw))
|
|
@@ -213,6 +213,55 @@ function belongsToADoneItem(doneFolders, terminalStates) {
|
|
|
213
213
|
test: (t) => isDoneItem(t.doc, doneFolders, terminalStates),
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* A fenced code block that never closes (bug 0286). By CommonMark it runs to the end of the document, so
|
|
218
|
+
* the document's `State:` line and task boxes below it are code: the gate would read no state and no box,
|
|
219
|
+
* and report nothing. The fence is reported instead, at its line.
|
|
220
|
+
*/
|
|
221
|
+
function unterminatedFenceViolation(doc) {
|
|
222
|
+
const line = unterminatedFence(doc.text, doc.root);
|
|
223
|
+
if (line === null)
|
|
224
|
+
return null;
|
|
225
|
+
return {
|
|
226
|
+
rule: 'ledger/unterminated-fence',
|
|
227
|
+
element: doc.relPath,
|
|
228
|
+
file: doc.file,
|
|
229
|
+
line,
|
|
230
|
+
message: 'a fenced code block opened here never closes, so by CommonMark everything after it is code — no State: line or task box below it can be read',
|
|
231
|
+
because: 'a record the gate cannot read would pass with nothing checked',
|
|
232
|
+
suggestion: 'close the fence where the example ends — above the State: line — with a line of at least as many backticks or tildes as opened it',
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* A document whose header has a `State:` line only inside a code block (bug 0286). By CommonMark it then
|
|
237
|
+
* states nothing, so the gate would treat it as no item and check nothing; an indented line is the likely
|
|
238
|
+
* cause — four spaces make a code block. Reported at the first such line, which may be an example rather
|
|
239
|
+
* than the record's own, and on a document that is not a record at all, such as a guide showing the
|
|
240
|
+
* template: the gate cannot tell those apart, so the remedy names each case.
|
|
241
|
+
*
|
|
242
|
+
* The header ends where the prose's second heading does. A `##` line inside a code block — a shell
|
|
243
|
+
* comment, a template's skeleton — is not a heading, and counting it would end the search above the line.
|
|
244
|
+
*/
|
|
245
|
+
function stateInCodeViolation(doc, known) {
|
|
246
|
+
const prose = proseText(doc.text, 'code-blocks', doc.root).split('\n');
|
|
247
|
+
if (stateIn(prose, known) !== null)
|
|
248
|
+
return null;
|
|
249
|
+
const raw = doc.text
|
|
250
|
+
.split('\n')
|
|
251
|
+
.map((line, i) => (/^##\s/.test(line) && prose[i] !== line ? '' : line));
|
|
252
|
+
const hidden = stateIn(raw, known);
|
|
253
|
+
if (hidden === null)
|
|
254
|
+
return null;
|
|
255
|
+
return {
|
|
256
|
+
rule: 'ledger/state-in-code',
|
|
257
|
+
element: doc.relPath,
|
|
258
|
+
file: doc.file,
|
|
259
|
+
line: hidden.line,
|
|
260
|
+
message: 'the header has a State: line only inside a code block, and this is the first — read as code it states nothing, so its boxes are not checked',
|
|
261
|
+
because: 'a record the gate cannot read would pass with nothing checked',
|
|
262
|
+
suggestion: "write the record's own State: line as prose in the header — if this is it, remove its indent or move it out of the fence; if it is an example, keep it and add the real line; if this document is not a record, list it in boardFiles",
|
|
263
|
+
};
|
|
264
|
+
}
|
|
216
265
|
/** Condition: the header `State:` line is readable and matches its folder. */
|
|
217
266
|
function headerStateCondition(doneFolders, closeInPlace, states, terminalStates) {
|
|
218
267
|
return {
|
|
@@ -221,6 +270,16 @@ function headerStateCondition(doneFolders, closeInPlace, states, terminalStates)
|
|
|
221
270
|
const out = [];
|
|
222
271
|
for (const doc of elements) {
|
|
223
272
|
const inDoneFolder = doneFolders.some((seg) => `/${doc.relPath}`.includes(seg));
|
|
273
|
+
// A fence that never closes turns everything below it into code, so it is reported alone; a
|
|
274
|
+
// State: line still in code once it is closed is reported on the next run.
|
|
275
|
+
const fence = unterminatedFenceViolation(doc);
|
|
276
|
+
if (fence)
|
|
277
|
+
out.push(fence);
|
|
278
|
+
else {
|
|
279
|
+
const hidden = stateInCodeViolation(doc, [...new Set([...states, ...terminalStates])]);
|
|
280
|
+
if (hidden)
|
|
281
|
+
out.push(hidden);
|
|
282
|
+
}
|
|
224
283
|
const found = headerStateViolation(doc, inDoneFolder, closeInPlace, states, terminalStates);
|
|
225
284
|
if (found)
|
|
226
285
|
out.push(found);
|
|
@@ -439,7 +498,7 @@ export function ledgerStats(corpus, options = {}) {
|
|
|
439
498
|
if (boardFiles.has(base))
|
|
440
499
|
continue;
|
|
441
500
|
scanned += 1;
|
|
442
|
-
const found = findState(doc.text, known);
|
|
501
|
+
const found = findState(doc.text, known, doc.root);
|
|
443
502
|
if (found?.state !== undefined)
|
|
444
503
|
withReadableState += 1;
|
|
445
504
|
else if (found !== null)
|
package/dist/rules/ledger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../src/rules/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4B,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAK9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAmB,MAAM,2BAA2B,CAAA;AA4EtE,MAAM,oBAAoB,GAAG,CAAC,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,CAAC,CAAA;AACjG,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,CAAC,CAAA;AACjG,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAA;AACrE,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAEpD,gFAAgF;AAChF,+EAA+E;AAC/E,wEAAwE;AACxE,2EAA2E;AAC3E,oDAAoD;AACpD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAA,kFAAkF,CAAA;AAC1G,mFAAmF;AACnF,sCAAsC;AACtC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAA,wCAAwC,CAAA;AAE/D,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;AAEhF;;;;;;;;;;;;;;;;;;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,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,CAAA;AACnE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nielspeter/eess-md",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Architecture testing for a Markdown corpus — the Markdown dialect of the eess family. Links resolve, code pointers ground, ADRs declare enforcement.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"./rules/ledger": {
|
|
16
16
|
"types": "./dist/rules/ledger.d.ts",
|
|
17
17
|
"import": "./dist/rules/ledger.js"
|
|
18
|
+
},
|
|
19
|
+
"./internal": {
|
|
20
|
+
"types": "./dist/internal.d.ts",
|
|
21
|
+
"import": "./dist/internal.js"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
20
24
|
"files": [
|
|
@@ -49,7 +53,7 @@
|
|
|
49
53
|
"eess"
|
|
50
54
|
],
|
|
51
55
|
"dependencies": {
|
|
52
|
-
"@nielspeter/eess": "^0.
|
|
56
|
+
"@nielspeter/eess": "^0.6.0",
|
|
53
57
|
"mdast-util-from-markdown": "^2.0.3",
|
|
54
58
|
"mdast-util-gfm": "^3.1.0",
|
|
55
59
|
"micromark-extension-gfm": "^3.0.0",
|