Skip to content

Migrate to document-schema.js 3 and read odt heading levels as headingLevel - #54

Merged
Mearman merged 2 commits into
mainfrom
feat/odt-heading-level
Aug 17, 2026
Merged

Migrate to document-schema.js 3 and read odt heading levels as headingLevel#54
Mearman merged 2 commits into
mainfrom
feat/odt-heading-level

Conversation

@Mearman

@Mearman Mearman commented Aug 17, 2026

Copy link
Copy Markdown
Member

Three changes in one PR.

document-schema.js ^2.7.17 -> ^3.0.0. The migration is dependency-only for odf.js: nothing here constructs a DocumentPackage or touches the frames surface. The one test that tracked the content format by literal (formula/read.test.ts asserting formatVersion toBe(2) — the failure red on the standalone bump PR) now asserts the imported CONTENT_FORMAT_VERSION constant, matching the production readers that already stamp that constant on every emitted document, so it tracks whatever the installed schema defines instead of a number that rots on the next bump.

headingLevel (Closes #52). readParagraphOrHeading parsed text:outline-level only to re-encode it into the docx-equivalent 'Heading<level>' styleId string, then discarded the number. The parsed value now also populates ContentParagraph.headingLevel alongside the unchanged styleId encoding — both derive from the same single parse and always agree. The odt reader tests assert both fields on every heading fixture.

Breaking marker. Emitted ContentDocuments now carry formatVersion: 3 (schema 3.0.0's CONTENT_FORMAT_VERSION), so consumers still validating odf.js output against document-schema.js 2 will reject the new documents — that warrants the major, the same reasoning applied to the other codecs' schema-3 migrations.

Supersedes #53 (the standalone document-schema.js 3.0.0 bump PR): this carries the same bump together with the test fix and the headingLevel population, so the standalone bump has nothing left to do.

Generated by Claude Code

The migration is dependency-only for odf.js: nothing here constructs a
DocumentPackage or touches the frames surface, so no code moves with the
bump. The one place that tracked the old content format by literal --
formula/read.test.ts asserting formatVersion toBe(2) -- now asserts the
imported CONTENT_FORMAT_VERSION constant, matching the production
readers that already stamp that constant on every emitted document, so
the test tracks whatever the installed schema defines instead of a
number that silently rots on the next format bump.

BREAKING CHANGE: odf.js's emitted ContentDocuments now carry
formatVersion 3, from document-schema.js 3.0.0's CONTENT_FORMAT_VERSION;
consumers still validating odf.js output against document-schema.js 2
will reject the new documents.
readParagraphOrHeading parsed text:outline-level only to re-encode it
into the docx-equivalent 'Heading<level>' styleId string, then
discarded the number. The parsed value now also populates
ContentParagraph.headingLevel, document-schema.js's canonical numeric
heading field, so consumers that need the level as a number no longer
have to parse it back out of styleId. styleId keeps its existing
encoding unchanged; both derive from the same single parse and always
agree.
@Mearman
Mearman merged commit cf21f55 into main Aug 17, 2026
10 checks passed
@Mearman
Mearman deleted the feat/odt-heading-level branch August 17, 2026 13:34
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant