@adeu/core 1.25.0 → 1.26.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/dist/index.cjs +298 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +296 -73
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/diff.ts +129 -4
- package/src/engine.ts +135 -18
- package/src/index.ts +1 -1
- package/src/ingest.ts +11 -2
- package/src/mapper.ts +99 -47
- package/src/repro_qa_report_v7.test.ts +380 -0
- package/src/sanitize/core.ts +3 -0
- package/src/sanitize/transforms.ts +29 -0
- package/src/utils/docx.ts +30 -2
package/src/utils/docx.ts
CHANGED
|
@@ -560,6 +560,27 @@ export function get_run_style_markers(
|
|
|
560
560
|
return [prefix, suffix];
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
+
/**
|
|
564
|
+
* Splits `text` into [leading_ws, core, trailing_ws]. Emphasis markers must
|
|
565
|
+
* wrap only the core: `**The Supplier **` (a bold run with a trailing space)
|
|
566
|
+
* is malformed Markdown — CommonMark requires the closing delimiter to hug
|
|
567
|
+
* non-whitespace — and it poisons every downstream CriticMarkup consumer
|
|
568
|
+
* (QA 2026-07-19 F-03/F-10). Fully-whitespace text yields ["", "", text] so
|
|
569
|
+
* callers skip the markers entirely.
|
|
570
|
+
*/
|
|
571
|
+
export function split_boundary_whitespace(
|
|
572
|
+
text: string,
|
|
573
|
+
): [string, string, string] {
|
|
574
|
+
const core = text.trim();
|
|
575
|
+
if (!core) return ["", "", text];
|
|
576
|
+
const lead_len = text.length - text.trimStart().length;
|
|
577
|
+
return [
|
|
578
|
+
text.substring(0, lead_len),
|
|
579
|
+
text.substring(lead_len, lead_len + core.length),
|
|
580
|
+
text.substring(lead_len + core.length),
|
|
581
|
+
];
|
|
582
|
+
}
|
|
583
|
+
|
|
563
584
|
export function apply_formatting_to_segments(
|
|
564
585
|
text: string,
|
|
565
586
|
prefix: string,
|
|
@@ -567,10 +588,17 @@ export function apply_formatting_to_segments(
|
|
|
567
588
|
): string {
|
|
568
589
|
if (!prefix && !suffix) return text;
|
|
569
590
|
if (!text) return "";
|
|
570
|
-
|
|
591
|
+
|
|
592
|
+
const wrap = (segment: string): string => {
|
|
593
|
+
const [lead, core, trail] = split_boundary_whitespace(segment);
|
|
594
|
+
if (!core) return segment;
|
|
595
|
+
return `${lead}${prefix}${core}${suffix}${trail}`;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
if (!text.includes("\n")) return wrap(text);
|
|
571
599
|
|
|
572
600
|
const parts = text.split("\n");
|
|
573
|
-
return parts.map((p) => (p ?
|
|
601
|
+
return parts.map((p) => (p ? wrap(p) : "")).join("\n");
|
|
574
602
|
}
|
|
575
603
|
|
|
576
604
|
export function get_run_text(run: Run): string {
|