Skip to content

v0.4.0 — Model core

Choose a tag to compare

@AkramZerarka AkramZerarka released this 24 Apr 20:47
· 31 commits to main since this release

v0.4.0 — Model core (road to 1.0, milestone 1)

First of several milestones on the way to a stable 1.0. This release enriches the in-memory document model with elements that real-world DOCX, HTML, and Markdown files rely on but that paperdoc-lib could not previously represent.

Non-breaking: no existing signatures change, no renderer/parser behaviour changes. Parsers and renderers will be taught the new elements in follow-up v0.5.x releases.

New block elements

Element Highlights
ListBlock + ListItem Bullet / ordered, nested lists, custom starting number, styled item labels with link support
Heading Levels 1–6, optional id anchor (TOC/bookmarks), styled runs
Bookmark Named landmark — completes the v0.3.8 hyperlink feature (TextLink::anchor → Bookmark::id)
CodeBlock Verbatim source block with optional language hint
Blockquote Nested-aware quoted block

Typed document properties

  • Paperdoc\Document\Metadata — author / subject / description / keywords / createdAt / modifiedAt / language
  • Document::getProperties() / setProperties() — exposed next to the existing loose metadata key/value bag

Contracts & error handling

  • Marker interfaces — Paperdoc\Contracts\BlockElementInterface and InlineElementInterface (extend DocumentElementInterface)
  • Existing Paragraph, Image, PageBreak, Table retrofitted to BlockElementInterface (non-breaking)
  • Typed exceptions — new Paperdoc\Exceptions namespace: PaperdocException (base), ParserException, RendererException, UnsupportedFormatException, InvalidDocumentException with factory helpers

Fluent Section API

$section = Section::make();

$section->addHeading('Getting started', 2);

$section->addBulletList()
    ->addText('Install')
    ->addText('Configure')
    ->addText('Run');

$section->addCodeBlock("composer require paperdoc-dev/paperdoc-lib", 'bash');

$section->addBookmark('setup-done');

$section->addBlockquote()
    ->addText('You are all set.');

Tests

  • 80+ new unit tests across tests/Unit/Document/{ListBlock,ListItem,Heading,Bookmark,CodeBlock,Blockquote,Metadata}Test.php and tests/Unit/Exceptions/ExceptionsTest.php
  • Full suite: 531 tests, 1177 assertions, all green
  • Fixed a pre-existing risky test in DocxParserTest that lacked assertions when the optional fixture was missing

Road to 1.0

  • v0.4.0 (this release) — Model core
  • v0.5.x — Round-trip robustness (DOCX/XLSX numbering, merged cells, formulas, headers/footers)
  • v0.6.x — API stabilisation (@api/@internal markers, final on value objects)
  • v0.7.x — Split optional dependencies (Neuron AI moved to suggest / sidecar package)
  • v1.0.0-rc → v1.0.0

Install

composer require paperdoc-dev/paperdoc-lib:^0.4

Full changelog: v0.3.8...v0.4.0