@ansonlai/docx-redline-js 0.9.0 → 0.10.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/ARCHITECTURE.md +679 -669
- package/CHANGELOG.md +32 -1
- package/README.md +29 -6
- package/core/word-xml.js +160 -118
- package/dist/docx-redline-js.esm.js +171 -51
- package/dist/docx-redline-js.esm.js.map +4 -4
- package/dist/docx-redline-js.esm.min.js +93 -93
- package/dist/docx-redline-js.esm.min.js.map +4 -4
- package/dist/docx-redline.bundle.cjs +171 -51
- package/dist/docx-redline.bundle.cjs.map +4 -4
- package/dist/docx-redline.bundle.js +171 -51
- package/dist/docx-redline.bundle.js.map +4 -4
- package/docs/AGENT_KNOWLEDGE_BASE.md +30 -4
- package/docs/SKILL_AUTHORING.md +5 -1
- package/docs/TESTING.md +4 -0
- package/docs/schemas/document-operations.schema.json +1 -1
- package/engine/oxml-engine.js +748 -736
- package/index.d.ts +6 -1
- package/index.js +2 -0
- package/node/cli.js +993 -992
- package/package.json +1 -1
- package/pipeline/markdown-processor.js +5 -2
- package/services/comment-replies.js +1 -1
- package/services/document-operation-applier.js +1 -0
- package/services/document-operation-contract.js +1 -0
- package/services/document-operation-mutations.js +3358 -3346
- package/services/inspection-comparison.js +82 -0
- package/services/operation-preflight.js +42 -33
- package/services/revision-fidelity-verifier.js +5 -19
package/package.json
CHANGED
|
@@ -35,7 +35,10 @@ const MARKDOWN_PATTERNS = [
|
|
|
35
35
|
{ regex: /\*\*\+\+(.+?)\+\+\*\*/, format: { bold: true, underline: true } },
|
|
36
36
|
// Bold: **text** or __text__
|
|
37
37
|
{ regex: /\*\*(.+?)\*\*/, format: { bold: true } },
|
|
38
|
-
|
|
38
|
+
// Underscore delimiters follow CommonMark flanking rules: not intraword, not part of a
|
|
39
|
+
// longer underscore run, and never around whitespace. So signature lines ("_____")
|
|
40
|
+
// and snake_case identifiers stay literal text.
|
|
41
|
+
{ regex: /(?<![A-Za-z0-9_])__(?=[^_\s])(.+?)(?<=[^_\s])__(?![A-Za-z0-9_])/, format: { bold: true } },
|
|
39
42
|
// Underline: ++text++
|
|
40
43
|
{ regex: /\+\+(.+?)\+\+/, format: { underline: true } },
|
|
41
44
|
// Strikethrough: ~~text~~ or ~text~
|
|
@@ -43,7 +46,7 @@ const MARKDOWN_PATTERNS = [
|
|
|
43
46
|
{ regex: /~(.+?)~/, format: { strikethrough: true } },
|
|
44
47
|
// Italic: *text* or _text_ (using lookahead only for compatibility)
|
|
45
48
|
{ regex: /\*(?!\*)(.+?)\*(?!\*)/, format: { italic: true } },
|
|
46
|
-
{ regex: /_(
|
|
49
|
+
{ regex: /(?<![A-Za-z0-9_])_(?=[^_\s])(.+?)(?<=[^_\s])_(?![A-Za-z0-9_])/, format: { italic: true } }
|
|
47
50
|
];
|
|
48
51
|
|
|
49
52
|
/**
|
|
@@ -32,7 +32,7 @@ export function applyCommentReplyToParts({ commentsXml, commentsExtendedXml = nu
|
|
|
32
32
|
}
|
|
33
33
|
const occupied = usedParaIds(commentsDoc, extendedDoc);
|
|
34
34
|
// paraIds are unique across the whole package; body paragraphs can carry them too.
|
|
35
|
-
if (documentXml) for (const match of String(documentXml).matchAll(
|
|
35
|
+
if (documentXml) for (const match of String(documentXml).matchAll(/\bw14:paraId="([0-9A-Fa-f]{8})"/g)) occupied.add(match[1].toUpperCase());
|
|
36
36
|
const parentParagraph = commentThreadParagraph(parent);
|
|
37
37
|
if (!parentParagraph) return { status: 'error', error: { code: 'PARENT_COMMENT_INVALID', message: `Parent comment '${parentCommentId}' has no paragraph.` } };
|
|
38
38
|
let parentParaId = commentParaId(parent);
|
|
@@ -258,6 +258,7 @@ export async function applyOperationToDocumentXml(documentXml, op, author, runti
|
|
|
258
258
|
...(operation.existingRevisions ? { existingRevisions: operation.existingRevisions } : {}),
|
|
259
259
|
structuredContent: typeof operation.structuredContent === 'boolean' ? operation.structuredContent : (options.structuredContent !== false),
|
|
260
260
|
explicitStructuredContent: operation.structuredContent === true,
|
|
261
|
+
plainTextContent: operation.structuredContent === false || (operation.structuredContent == null && options.structuredContent === false),
|
|
261
262
|
...(operation._localizedReplacementCompilation && operation.structuredContent !== true ? { literalTextEdit: true } : {}),
|
|
262
263
|
pairReplacements: typeof operation.pairReplacements === 'boolean' ? operation.pairReplacements : (options.pairReplacements !== false),
|
|
263
264
|
...(operation.insertionAffinity ? { insertionAffinity: operation.insertionAffinity } : {}),
|