Repository navigation
Conversation
…cond Normal A localized Word names its built-in defaults in its own language (German `Standard` / `Absatz-Standardschriftart`). Provisioning a baseline style (Hyperlink via an autolink, headings, notes, code blocks, `styles create`) looked for the English ids, so it added a second `w:default="1"` paragraph style `Normal` and based Hyperlink on a nonexistent `DefaultParagraphFont`. `StylesView.localStyleId` now maps `Normal`/`DefaultParagraphFont` to the document's `w:default="1"` style of that type; provisioning rewrites basedOn/next to the local ids (dropping a basedOn on a default the doc lacks entirely), and `styles set --at Normal` targets the localized default. Fixes #59 Triage-Routine: true Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LkctEPkr8mq92sCK3ERfG3
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 docx-cli triage
What was wrong
In a localized Word doc, the built-in defaults use translated ids (German:
Standard/Absatz-Standardschriftart). When docx-cli provisioned a baseline style, it looked them up by their English ids. Sodocx edit de.docx --at p0 "See https://example.com"added a secondw:default="1"paragraph style calledNormal, plus aHyperlinkstyle with<w:basedOn w:val="DefaultParagraphFont"/>, which doesn't exist.validatestill saidvalid.What changed
StylesView.localStyleIdmapsNormal/DefaultParagraphFontto the doc'sw:default="1"style of that type. Ids that already exist as-is are left alone.#ensureStyleNode/ensureCustomStyle: Hyperlink, headings, Quote, list, note, caption and code-block styles, andstyles create. These paths now:Normalwhen a default paragraph style already existsbasedOn/nextat the local idsbasedOnthat names a default the doc doesn't define at all (before this, our owncreatedocs also had a danglingDefaultParagraphFont)styles set --at Normal(and--based-on/--next Normal) now resolve to the localized default. The self-reference check runs after that resolution.defaultSizeHalfPoints/defaultFontfall back through the localized default as well.style-defsfixture: the template's defaults are re-id'd to the German ones, and the fixture now inserts an autolink too, soHeading1/Hyperlink/Calloutall exercise this path in the LibreOffice round-trip.src/core/CLAUDE.mdnotes the rule.Verification
Standard(default),Absatz-Standardschriftart(default),Normal(default=1),Hyperlink ← DefaultParagraphFontStandard(default),Absatz-Standardschriftart(default),Hyperlink ← Absatz-Standardschriftart.docx validatereportsvalidandreadshows the link.tests/cli/styles.test.ts, covering hyperlink, heading basedOn/next,styles set --at Normal, and the self-reference via the local id. The first three failed before the fix.bun run check✅bun run test:unit✅ (2103 tests)--at Normal --based-on Standardself-cycle, which is now fixed and tested.Decisions for you
Hyperlinkused to keepbasedOn DefaultParagraphFont; it now drops that line. This also changes the output for docs made by our owncreate, whose template has noDefaultParagraphFont. OK, or would you rather we provision aDefaultParagraphFontdefault?Überschrift1(nameheading 1) gets a parallelHeading1. Matching byw:namewould mean every caller using the resolved id inpStyle.read'sCONSTRUCT_STYLESstill lists onlyNormal, so a German paragraph that explicitly setspStyle="Standard"may get astyle=hint.validatewarnings for more than one default per type, or abasedOnthat points at a missing style.Fixes #59
Action needed: approve/merge — review the Hyperlink
basedOndecision above, then merge.Generated by Claude Code