Skip to content

docx-grader: generate the unformatted docx (AI-Assisted) - #388

Open
bh0fer wants to merge 4 commits into
feature/docx-grader-componentfrom
feature/docx-grader-raw
Open

bh0fer wants to merge 4 commits into
feature/docx-grader-componentfrom
feature/docx-grader-raw

Conversation

@bh0fer

@bh0fer bh0fer commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Part 3 of 3 for #385. Stacked on #387, which is stacked on #386: merge in that order.

Behavior

  • create-spec now also writes <original>-raw.docx, the document students format. It contains:
    • the text of every paragraph (tabs and line breaks kept), in the "Normal" style of a blank document (styles reset to baseline/wordDefaults.ts);
    • every image inline at 5 cm wide;
    • tables without style, borders or widths (merged cells kept);
    • for captions, only their description, without "Abbildung 1:".
  • Removed: directories, headers and footers, sections (one A4 section), numbering, empty paragraphs, comments and document settings (e.g. auto hyphenation).
  • The theme is kept so the default fonts resolve the same way.
  • The output is deterministic (fixed zip dates), so regenerating from the same original leaves the file unchanged.
  • To write the raw document from the one docx model, the model gains a block tree (blocks: paragraphs and tables) and the image relationship ids, and readDocx exposes the document relationships.
  • Linked images and image types Word cannot store (unknown content type) are skipped, and the CLI warns about them. The CLI also rejects inputs that are not .docx, so the original can't be overwritten.
  • The CLI formats the spec with the repo's Prettier config, so yarn format:check accepts generated specs.
  • The demo raw document in the README is now the generated one.

Validation

  • yarn test --run packages/hfr/docx-grader: 43 tests pass. For each sample, the raw document:

    • has one section, only "Normal" and no numbering, fields or captions;
    • keeps every image at 5 cm;
    • still contains the text every check of the original anchors to.

    Inline-XML tests cover tables with merged cells, nested tables, and adjacent tables, which need a paragraph between them.

  • python-docx opens all generated raw files (0 tables in the samples, all images 5 cm, "Normal" style only).

  • No Word or LibreOffice was available here, so a manual open in Word is still pending.

  • yarn typecheck, prettier and yarn build pass. Headless Chromium on the demo page: the generated raw file gives 0/19, the original 19/19.

  • Design review with the design-reviewer skill on this branch; all findings fixed.

🤖 Generated with Claude Code

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@lebalz
lebalz added this pull request to stack #389 November 18, 2026 21:11
@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for teaching-dev ready!

Name Link
🔨 Latest commit d906131
🔍 Latest deploy log https://app.netlify.com/projects/teaching-dev/deploys/6afe1ce887112dd81b9d086c
😎 Deploy Preview https://deploy-preview-388--teaching-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

lebalz and others added 2 commits November 18, 2026 22:31
The CLI also writes <original>-raw.docx: text, tables and 5 cm images
without any formatting, styles reset to Word's defaults (#385).
Specs are formatted with the repository's Prettier config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Inserting the tabs is part of the students' task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bh0fer
bh0fer requested a review from a team November 18, 2026 21:34
@bh0fer
bh0fer force-pushed the feature/docx-grader-raw branch from 2d189a9 to 4dce83f Compare November 18, 2026 21:34
…-raw

# Conflicts:
#	packages/hfr/docx-grader/package.json
…-raw

# Conflicts:
#	packages/hfr/docx-grader/tests/createDocx.ts

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants