markdown-parity-check 0.2.34 → 0.2.36
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 +10 -7
- package/SECURITY.md +2 -2
- package/dist/src/align.d.ts +3 -2
- package/dist/src/align.js +3 -2
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js +22 -1
- package/dist/src/html.js +3 -3
- package/dist/src/markdown.js +3 -0
- package/dist/src/normalize.d.ts +4 -3
- package/dist/src/normalize.js +5 -4
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -78,10 +78,10 @@ A value that is outside these ranges, or that is not a plain run of digits, stop
|
|
|
78
78
|
|
|
79
79
|
### Example output
|
|
80
80
|
|
|
81
|
-
This is the text report for the matching fixture pair in this repository, run with version 0.2.
|
|
81
|
+
This is the text report for the matching fixture pair in this repository, run with version 0.2.36 on 2026-11-10. The exact command is in the Development section below. The text report ends with a list of limitations, which is omitted here:
|
|
82
82
|
|
|
83
83
|
```text
|
|
84
|
-
markdown-parity-check 0.2.
|
|
84
|
+
markdown-parity-check 0.2.36 (offline mode)
|
|
85
85
|
Result: PASS (0 error(s), 0 warning(s), 1 info)
|
|
86
86
|
|
|
87
87
|
HTML: test/fixtures/same/page.html (file, 1,017 bytes, base https://example.com/page)
|
|
@@ -137,7 +137,7 @@ A `<br>` in a code block is a line break. A code block that differs only in whit
|
|
|
137
137
|
|
|
138
138
|
In URL mode the Markdown response is checked first. An HTTP error or an HTML page in place of Markdown fails the check, and nothing is compared. A Markdown response labelled `text/plain` is a warning, and any other content type than `text/markdown` or `text/x-markdown` is an error. A comment, an XML declaration or another declaration before the doctype does not hide an HTML page from this check. If the HTML request itself returns an HTTP error, the run ends with exit code 2.
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
A response whose Content-Type header names `text/html` or `application/xhtml+xml` is decoded by its byte order mark first, then by the charset of that header, then by a meta charset declaration in its first 1024 bytes, and as UTF-8 when none of them names a known encoding. The choice follows the type of the response, not the request: any other response, including an HTML page sent with another type or with no Content-Type header, is decoded by the charset of its header or as UTF-8, and its byte order mark and meta declaration do not choose the encoding. A Markdown response is decoded that way too.
|
|
141
141
|
|
|
142
142
|
### Limits of the method
|
|
143
143
|
|
|
@@ -202,18 +202,19 @@ The options type is `RunOptions`. It takes `selector`, `frontMatter`, `strict`,
|
|
|
202
202
|
|
|
203
203
|
When the Markdown source has `kind: 'url'` in its `meta`, the delivery check runs first and reads the HTTP `status` and `contentType` from that `meta`.
|
|
204
204
|
|
|
205
|
-
A host with a smaller CPU or memory budget can pass lower `limits`, typed as `RunLimits`: `maxAlignmentPairs`, `maxSimilarityCandidates`, `maxSimilarityWork` and `maxNestingDepth`. The nesting limit also applies to raw HTML blocks inside the Markdown. Set `maxSimilarityWork` when the library compares untrusted documents: with the default limits one
|
|
205
|
+
A host with a smaller CPU or memory budget can pass lower `limits`, typed as `RunLimits`: `maxAlignmentPairs`, `maxSimilarityCandidates`, `maxSimilarityWork` and `maxNestingDepth`. The nesting limit also applies to raw HTML blocks inside the Markdown. Set `maxSimilarityWork` when the library compares untrusted documents: with the default limits one worst case at the full 4 000 000 block pairs (100 HTML blocks of 870 distinct words against 40 000 Markdown blocks of one word each) took between 26 and 30 seconds in hand timings on development machines, and a value of 2 000 000 made the pairing step stop after about 70 milliseconds, on top of the parse time. The test suite runs the bounded case and asserts no time. When a limit is exceeded, `run` throws a `RunError` whose message names the limit, and the command line reports it with exit code 2.
|
|
206
206
|
|
|
207
207
|
The caller fetches the pages and decides which addresses are allowed. The address policy the command applies is exported as `assertPublicHost` and `isPublicAddress`.
|
|
208
208
|
|
|
209
209
|
### Report format
|
|
210
210
|
|
|
211
|
-
The JSON report is the `Report` type. Its
|
|
211
|
+
The JSON report is the `Report` type. Its top-level fields are:
|
|
212
212
|
|
|
213
213
|
| Field | Content |
|
|
214
214
|
| --- | --- |
|
|
215
215
|
| `schemaVersion` | The number `1`. |
|
|
216
216
|
| `toolVersion` | The release that produced the report. |
|
|
217
|
+
| `generatedAt` | The time the report was made, as an ISO 8601 timestamp in UTC. |
|
|
217
218
|
| `mode` | `url` or `offline`. |
|
|
218
219
|
| `sources` | The metadata of the HTML and the Markdown input. |
|
|
219
220
|
| `extraction` | How each side was extracted. It is `null` in an error report and in a result that failed at the delivery check, because no extraction result is reported then. |
|
|
@@ -221,6 +222,8 @@ The JSON report is the `Report` type. Its main fields are:
|
|
|
221
222
|
| `findings` | A list of `Finding` objects, each with `code`, `severity`, `direction` and `message`, and where they apply the `html` and `markdown` locations and the `before` and `after` text. |
|
|
222
223
|
| `limitations` | The fixed list of what the check does not cover. |
|
|
223
224
|
|
|
225
|
+
An error report for an argument error is built before the arguments are validated, so the command takes `mode` from the presence of `--url` and `summary.strict` from the presence of `--strict` in the command line. A command line with neither is recorded as `offline` and not strict, and so is one that gives `--markdown-url` without `--url`.
|
|
226
|
+
|
|
224
227
|
## Development
|
|
225
228
|
|
|
226
229
|
The sources are TypeScript under `src/`, compiled with `tsc` to `dist/`. Clone the repository, build it and run the bundled example:
|
|
@@ -248,10 +251,10 @@ Only after that check does it create the GitHub release with the verified tarbal
|
|
|
248
251
|
GitHub Actions publishes every version from 0.1.2 on with npm trusted publishing, and each one carries a provenance attestation. To check one, install it in an empty directory and ask npm to verify the signatures. Replace the version with the one you want to check.
|
|
249
252
|
|
|
250
253
|
```sh
|
|
251
|
-
mkdir verify-mpc && cd verify-mpc && npm init -y && npm install markdown-parity-check@0.2.
|
|
254
|
+
mkdir verify-mpc && cd verify-mpc && npm init -y && npm install markdown-parity-check@0.2.36 --ignore-scripts && npm audit signatures
|
|
252
255
|
```
|
|
253
256
|
|
|
254
|
-
`npm audit signatures` checks the registry signature and the provenance attestation of each installed package that has one. The attestation of this package names three things to compare with what you expect: the repository `github.com/erekola/markdown-parity-check`, the workflow file `.github/workflows/release.yml` and the commit that produced the tarball. The npm version page shows them under Provenance. Tag `v0.2.
|
|
257
|
+
`npm audit signatures` checks the registry signature and the provenance attestation of each installed package that has one. The attestation of this package names three things to compare with what you expect: the repository `github.com/erekola/markdown-parity-check`, the workflow file `.github/workflows/release.yml` and the commit that produced the tarball. The npm version page shows them under Provenance. Tag `v0.2.36` must point at that same commit, and `gh api repos/erekola/markdown-parity-check/commits/v0.2.36 --jq .sha` prints it. A mismatch is a reason not to use that version. Provenance proves which workflow built a release and from which commit. It does not prove that the code is safe, so reading the source and the dependencies stays your job.
|
|
255
258
|
|
|
256
259
|
## Security
|
|
257
260
|
|
package/SECURITY.md
CHANGED
|
@@ -14,7 +14,7 @@ Please do not open a public issue for security reports. You can expect an initia
|
|
|
14
14
|
|
|
15
15
|
URL mode requests HTML and Markdown over HTTP or HTTPS. Non-public network targets are blocked, including targets reached through DNS and redirects. Each fetch has a deadline and a limit on decoded response bytes. The defaults are 15 seconds and 5 MiB. In the command line the same deadline also covers parsing and comparison, which run in a worker thread that is stopped when the deadline passes, and the tool then exits with code 2. The library entry point has no such deadline, so a program that compares untrusted documents with it needs a time limit of its own. JavaScript from fetched pages is not executed.
|
|
16
16
|
|
|
17
|
-
The number of block pairs is bounded by the product of the two block counts, at most 4 000 000. The time spent on each pair is not: the similarity search walks the distinct words of the HTML block once per pair, so the work grows with block pairs times distinct words per HTML block. One
|
|
17
|
+
The number of block pairs is bounded by the product of the two block counts, at most 4 000 000. The time spent on each pair is not: the similarity search walks the distinct words of the HTML block once per pair, so the work grows with block pairs times distinct words per HTML block. One case, 100 HTML blocks of 870 distinct words each against 40 000 Markdown blocks of one word each, which is 4 000 000 pairs, took between 26 and 30 seconds with default limits on development machines, in two hand timings by two people that the test suite does not repeat. The command line stops such a run at its deadline. The number of similar block pairs kept for matching is bounded as well. Above either limit the tool stops with exit code 2 and an error message instead of reporting a pass for a comparison it did not complete. The pairing of links inside one block is not separately bounded by default: with the default limits it has no budget of its own, and a block with thousands of links that cannot be resolved against a base URL can take time that grows with the square of the link count. The maxSimilarityWork limit is unbounded by default and covers both cases, so a library caller that compares untrusted documents should set it. In the case above, a limit of 2 000 000 made the pairing step stop after about 70 milliseconds, on top of the time spent parsing the two documents, and the whole call took under one second. `run` throws a `RunError` there, with a message that names the limit, and the command line reports it with exit code 2.
|
|
18
18
|
|
|
19
19
|
Offline mode reads the two files supplied by the caller. The output option writes a report to the selected path. Reports mask URL query values and fragments and remove any user name or password from a URL. Excerpts may contain private page content. Review reports before sharing them.
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Offline mode reads the two files supplied by the caller. The output option write
|
|
|
22
22
|
|
|
23
23
|
The tool uses runtime dependencies to parse and compare content. Dependency versions and integrity hashes are recorded in package-lock.json. GitHub Actions installs locked dependencies with install scripts disabled and runs type checks and tests on Windows and Ubuntu.
|
|
24
24
|
|
|
25
|
-
The package is published on npm as `markdown-parity-check`. Each version has a matching GitHub release. The attached tarball is the registry copy after its integrity hash and content were checked against the freshly packed file. The first npm release was published from a maintainer machine and has no provenance attestation. Its npm metadata names commit 7e8fad9 as its source, while the tag of that release points at 3f3a599, the release commit that follows it and adds the license, this policy, the release workflow and the package manifest without changing src/ or test/. The tag stays where it is. Every version from 0.1.2 on is published from GitHub Actions with npm trusted publishing and carries a provenance attestation, which the registry served for each
|
|
25
|
+
The package is published on npm as `markdown-parity-check`. Each version has a matching GitHub release. The attached tarball is the registry copy after its integrity hash and content were checked against the freshly packed file. The first npm release was published from a maintainer machine and has no provenance attestation. Its npm metadata names commit 7e8fad9 as its source, while the tag of that release points at 3f3a599, the release commit that follows it and adds the license, this policy, the release workflow and the package manifest without changing src/ or test/. The tag stays where it is. Every version from 0.1.2 on is published from GitHub Actions with npm trusted publishing and carries a provenance attestation, which the registry served for each version up to 0.2.34 when it was last checked on 2026-11-07.
|
|
26
26
|
|
|
27
27
|
## Verify a release
|
|
28
28
|
|
package/dist/src/align.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ export declare function strictKey(b: Block): string;
|
|
|
19
19
|
export declare const SIMILARITY_THRESHOLD = 0.6;
|
|
20
20
|
export declare const UNCERTAIN_THRESHOLD = 0.8;
|
|
21
21
|
/** Upper bound on the alignment work, as the product of the HTML and Markdown block counts. The LCS
|
|
22
|
-
* table holds (n+1)*(m+1) Uint32 cells
|
|
23
|
-
*
|
|
22
|
+
* table holds (n+1)*(m+1) Uint32 cells: 16 MiB for a square pair at the limit (2 000 by 2 000 blocks) and more for a
|
|
23
|
+
* lopsided pair with the same product (1 by 4 000 000 blocks is about 32 MB). The similarity search visits at most
|
|
24
|
+
* n*m block pairs. Above the limit the comparison stops with an error before any
|
|
24
25
|
* table is allocated, instead of growing without bound with the page size. */
|
|
25
26
|
export declare const MAX_ALIGNMENT_PAIRS = 4000000;
|
|
26
27
|
/** Upper bound on the similarity candidates kept for the greedy best-match pass. Only pairs at or above
|
package/dist/src/align.js
CHANGED
|
@@ -24,8 +24,9 @@ function linkSignature(b) {
|
|
|
24
24
|
export const SIMILARITY_THRESHOLD = 0.6;
|
|
25
25
|
export const UNCERTAIN_THRESHOLD = 0.8;
|
|
26
26
|
/** Upper bound on the alignment work, as the product of the HTML and Markdown block counts. The LCS
|
|
27
|
-
* table holds (n+1)*(m+1) Uint32 cells
|
|
28
|
-
*
|
|
27
|
+
* table holds (n+1)*(m+1) Uint32 cells: 16 MiB for a square pair at the limit (2 000 by 2 000 blocks) and more for a
|
|
28
|
+
* lopsided pair with the same product (1 by 4 000 000 blocks is about 32 MB). The similarity search visits at most
|
|
29
|
+
* n*m block pairs. Above the limit the comparison stops with an error before any
|
|
29
30
|
* table is allocated, instead of growing without bound with the page size. */
|
|
30
31
|
export const MAX_ALIGNMENT_PAIRS = 4_000_000;
|
|
31
32
|
/** Upper bound on the similarity candidates kept for the greedy best-match pass. Only pairs at or above
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { type FetchOptions, type FetchResult } from './fetch.js';
|
|
3
|
-
export declare const HELP = "markdown-parity-check 0.2.
|
|
3
|
+
export declare const HELP = "markdown-parity-check 0.2.36\nCompares the main content of a web page's HTML and Markdown representations and reports concrete\nmissing, added and changed blocks.\n\nUsage:\n markdown-parity-check --url <https://example.com/page> [--markdown-url <url>] [options]\n markdown-parity-check --html-file <page.html> --markdown-file <page.md> [--base-url <url>] [options]\n\nModes:\n --url <url> Fetch <url> twice: with Accept: text/html and with Accept: text/markdown.\n --markdown-url <url> Fetch the Markdown from this explicit address instead (requires --url).\n --html-file <path> Offline: local HTML file (requires --markdown-file).\n --markdown-file <path> Offline: local Markdown file (requires --html-file).\n --base-url <url> Offline: base for resolving relative links on both sides.\n\nOptions:\n --html-profile generic|starlight\n HTML extraction rules (default: generic). Starlight includes inactive tab panels.\n --selector <css> CSS selector for the HTML main content (default: main, article, [role=main], then body).\n --front-matter keep|strip\n Markdown front matter. keep (default) removes nothing and warns when the document\n starts with a YAML-looking fenced block; strip removes that leading block.\n --format text|json Report format (default: text).\n --output <path> Write the report to a file instead of stdout. Refuses to overwrite an input file.\n --timeout-ms <n> Timeout in milliseconds for each fetch and for the parse-and-compare step\n (default: 15000). When it runs out the exit code is 2.\n --max-bytes <n> Cap on decoded response bytes per fetch (default: 5242880).\n --strict Treat warnings as rejecting findings too.\n --help, -h Show this help.\n --version, -V Show the version.\n\nExit codes:\n 0 comparison completed, no rejecting finding\n 1 comparison completed, rejecting content or delivery differences found\n 2 input, fetch, parse or report error prevented a reliable comparison\n\nOnly http(s) URLs to public addresses are fetched; loopback, private, link-local and other non-public\naddresses are refused, also behind DNS and redirects. No JavaScript is executed. Exit 0 does not prove\nsemantic equivalence.\n";
|
|
4
4
|
export declare class CliError extends Error {
|
|
5
5
|
}
|
|
6
6
|
export interface CliArgs {
|
package/dist/src/cli.js
CHANGED
|
@@ -71,6 +71,26 @@ function rawWantsJson(argv) {
|
|
|
71
71
|
}
|
|
72
72
|
return wants;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* What the invocation asked for, read from the raw argv for the same reason as rawWantsJson: an argument error is
|
|
76
|
+
* thrown before parseCliArgs has produced a validated CliArgs. URL mode is the presence of --url, as in the normal
|
|
77
|
+
* path (`args.url !== undefined`), and strict is the presence of --strict. Both are read until a bare `--`, after
|
|
78
|
+
* which every token is a positional argument. An invocation that gives neither stays offline and not strict, which
|
|
79
|
+
* is the only answer the arguments leave open (for example --markdown-url without --url).
|
|
80
|
+
*/
|
|
81
|
+
function rawInvocation(argv) {
|
|
82
|
+
let mode = 'offline';
|
|
83
|
+
let strict = false;
|
|
84
|
+
for (const a of argv) {
|
|
85
|
+
if (a === '--')
|
|
86
|
+
break;
|
|
87
|
+
if (a === '--url' || a.startsWith('--url='))
|
|
88
|
+
mode = 'url';
|
|
89
|
+
else if (a === '--strict')
|
|
90
|
+
strict = true;
|
|
91
|
+
}
|
|
92
|
+
return { mode, strict };
|
|
93
|
+
}
|
|
74
94
|
// The largest delay Node's own timer accepts (2^31 - 1 ms, about 24.8 days). A larger value is not
|
|
75
95
|
// rejected by Node: it becomes a roughly 1 ms timeout instead, with a TimeoutOverflowWarning, so an
|
|
76
96
|
// error built from the value the caller gave would misreport what is actually going to happen
|
|
@@ -315,8 +335,9 @@ export async function main(argv, io = { stdout: (s) => process.stdout.write(s),
|
|
|
315
335
|
// stdout carries the report on top of, not instead of, the plain-text stderr line every
|
|
316
336
|
// argument error writes, since --output cannot be trusted without validated args and callers
|
|
317
337
|
// already rely on the stderr line regardless of format (test/review-0212.test.ts, test/secrets.test.ts).
|
|
338
|
+
// The report records the mode and strictness the arguments asked for where they say so (rawInvocation).
|
|
318
339
|
if (rawWantsJson(argv)) {
|
|
319
|
-
const report = errorReport(
|
|
340
|
+
const report = errorReport(rawInvocation(argv), null, null, message);
|
|
320
341
|
io.stdout(renderJson(report));
|
|
321
342
|
}
|
|
322
343
|
io.stderr(`Error: ${message}\n`);
|
package/dist/src/html.js
CHANGED
|
@@ -404,7 +404,7 @@ function listOrdinals(ctx, ol) {
|
|
|
404
404
|
n += reversed ? -1 : 1;
|
|
405
405
|
});
|
|
406
406
|
// A reversed list only gives its first item a browser-shown number (see above); Markdown has no reversed list,
|
|
407
|
-
// so the later numbers are never compared. Up to 0.2.15 that was silent; listInfo
|
|
407
|
+
// so the later numbers are never compared. Up to 0.2.15 that was silent; listInfo above now also leaves every
|
|
408
408
|
// item's ordinal out, not only the ones already undefined (0.2.16, found by an outside review 2026-09-28).
|
|
409
409
|
if (reversed && items.length > 0) {
|
|
410
410
|
ctx.issues.push({ code: 'EXTRACTION_LIST_REVERSED_NOT_COMPARED', severity: 'info', message: 'This list is reversed; its numbering is not compared, because Markdown has no reversed list to compare it against.', line: lineOf(ctx, ol) });
|
|
@@ -421,7 +421,7 @@ function taskState(li, profile = 'generic') {
|
|
|
421
421
|
while (stack.length > 0) {
|
|
422
422
|
const node = stack.pop();
|
|
423
423
|
// A <template> element's content is inert: the browser never renders it as part of the document, the
|
|
424
|
-
// same reason hiddenInPage
|
|
424
|
+
// same reason hiddenInPage below treats it like a hidden ancestor for the main extraction. taskState had
|
|
425
425
|
// no matching check, so a checkbox sitting in a <template> answered for a later, real checkbox in the
|
|
426
426
|
// same item (found by an outside review 2026-09-28).
|
|
427
427
|
if (!(node instanceof Element) || node.name === 'ul' || node.name === 'ol')
|
|
@@ -716,7 +716,7 @@ function hiddenInPage(el) {
|
|
|
716
716
|
/** Whether the element, or any ancestor, is a subtree the extraction leaves out (navigation, a dialog, a banner
|
|
717
717
|
* role and the rest of isSkipped). A candidate root inside one is page chrome, not main content. A plain <form> is
|
|
718
718
|
* the one exception: a page-wide form (ASP.NET WebForms) wraps the real content, so a candidate inside it is kept
|
|
719
|
-
* (
|
|
719
|
+
* (the maintainer's decision of 2026-10-02). A form with a left-out role still counts. */
|
|
720
720
|
function inExcludedSubtree(el) {
|
|
721
721
|
for (let cur = el; cur instanceof Element; cur = cur.parent) {
|
|
722
722
|
if (cur.name === 'form' && cur !== el && !SKIP_ROLES.has((cur.attribs['role'] ?? '').toLowerCase()))
|
package/dist/src/markdown.js
CHANGED
|
@@ -149,6 +149,9 @@ function inlineChildren(ctx, children, run, line) {
|
|
|
149
149
|
i = end;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
+
// Foreign elements that may close themselves with a trailing slash. Of the two, only svg is a left-out tag of its own
|
|
153
|
+
// (SKIP_TAGS in html.ts); math is left out only when it carries a left-out role such as navigation, so for math the
|
|
154
|
+
// self-closing rule above applies only in that case.
|
|
152
155
|
const FOREIGN_TAGS = new Set(['svg', 'math']);
|
|
153
156
|
const VOID_TAGS = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'source', 'track', 'wbr']);
|
|
154
157
|
/**
|
package/dist/src/normalize.d.ts
CHANGED
|
@@ -16,9 +16,10 @@ export declare function textKey(text: string): string;
|
|
|
16
16
|
export declare function codeWhitespaceKey(code: string): string;
|
|
17
17
|
/** Code content: CRLF and CR line endings become LF and every trailing newline is removed; other whitespace is kept. */
|
|
18
18
|
export declare function normalizeCode(code: string): string;
|
|
19
|
-
/** Removes ANSI escape
|
|
20
|
-
*
|
|
21
|
-
* review 2026-09-28).
|
|
19
|
+
/** Removes the escape character (which starts an ANSI escape sequence), the other C0 and C1 controls and the Unicode
|
|
20
|
+
* bidi controls from a value that may come from a compared page or a raw argument, so a plain --format text report
|
|
21
|
+
* cannot replay them at the terminal (0.2.16, found by an outside review 2026-09-28). The printable rest of an escape
|
|
22
|
+
* sequence, such as the "[2J" of ESC [ 2 J, stays as inert text. */
|
|
22
23
|
export declare function stripControlChars(text: string): string;
|
|
23
24
|
/** Extracts numeric tokens (prices, percentages, dates, versions, signed values) in source order. */
|
|
24
25
|
export declare function extractNumbers(text: string): string[];
|
package/dist/src/normalize.js
CHANGED
|
@@ -75,9 +75,10 @@ export function normalizeCode(code) {
|
|
|
75
75
|
// controls (U+202A to U+202E and U+2066 to U+2069) reorder the text a reader sees, so a quoted excerpt could read
|
|
76
76
|
// differently in a report than in the page. Both ranges match the hosted validator's stripControls(stripBidi()).
|
|
77
77
|
const CONTROL_CHARS = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f\u202A-\u202E\u2066-\u2069]/g;
|
|
78
|
-
/** Removes ANSI escape
|
|
79
|
-
*
|
|
80
|
-
* review 2026-09-28).
|
|
78
|
+
/** Removes the escape character (which starts an ANSI escape sequence), the other C0 and C1 controls and the Unicode
|
|
79
|
+
* bidi controls from a value that may come from a compared page or a raw argument, so a plain --format text report
|
|
80
|
+
* cannot replay them at the terminal (0.2.16, found by an outside review 2026-09-28). The printable rest of an escape
|
|
81
|
+
* sequence, such as the "[2J" of ESC [ 2 J, stays as inert text. */
|
|
81
82
|
export function stripControlChars(text) {
|
|
82
83
|
return text.replace(CONTROL_CHARS, '');
|
|
83
84
|
}
|
|
@@ -514,7 +515,7 @@ export function maskHref(href) {
|
|
|
514
515
|
const u = new URL(href);
|
|
515
516
|
u.username = '';
|
|
516
517
|
u.password = '';
|
|
517
|
-
// One pass
|
|
518
|
+
// One pass: a Set keeps the first-seen key order and merges duplicates, and the
|
|
518
519
|
// masked query is built once with append. Calling searchParams.set for each key re-serializes the whole query
|
|
519
520
|
// every time, which is quadratic in the number of keys (5 000 keys took 2.1 s, 20 000 took 35 s). An empty
|
|
520
521
|
// query is left as it is, so "?" stays "?".
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const TOOL_NAME = "markdown-parity-check";
|
|
2
|
-
export declare const TOOL_VERSION = "0.2.
|
|
2
|
+
export declare const TOOL_VERSION = "0.2.36";
|
package/dist/src/version.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
// Cloudflare Worker as well as under Node.js. test/version.test.ts fails the build when these differ
|
|
3
3
|
// from package.json, which stays the version the release workflow publishes.
|
|
4
4
|
export const TOOL_NAME = 'markdown-parity-check';
|
|
5
|
-
export const TOOL_VERSION = '0.2.
|
|
5
|
+
export const TOOL_VERSION = '0.2.36';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown-parity-check",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"description": "Compares the main content of a web page's HTML and Markdown representations and reports concrete differences.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"css-select": "^7.0.0",
|
|
52
52
|
"domhandler": "^6.0.1",
|
|
53
|
-
"domutils": "^4.0.2",
|
|
54
53
|
"htmlparser2": "^12.0.0",
|
|
55
54
|
"mdast-util-from-markdown": "^2.0.2",
|
|
56
55
|
"mdast-util-gfm": "^3.1.0",
|