Repository navigation
Live HTML preview for docx and slides (--watch), and VS Code live preview - #176
Merged
Merged
Conversation
…views) for Word, slides, and posters
VS Code extension: - One format detection (front matter and deck-only blocks) for the instant preview and the eye button; real posters (paper, byline, orientation) are no longer sent to `py-doc docx`, and file names no longer decide - The front matter header keeps its mode when callouts or captions render nested Markdown - List and mapping values in front matter are shown instead of crashing - Heading accents only on posters, splitting inline tokens so code, bold and links keep their formatting - A new live preview stops the running one first, waits for the server before opening Simple Browser, and the port is a setting - Slide grouping honours split_level; colours and weights are sanitised; command titles no longer repeat "py-doc" docx/slides --watch: - HTML twins go to .py-doc/preview, keyed by relative path, so no user file is overwritten and same-named files stay apart - OutputLocked replaces matching "locked" in the message - convert_file and convert_twin share one render helper - Twin-only preview.css (page breaks, notes, columns); html.css is unchanged for normal HTML builds; page breaks carry a class - --port/--no-open without --watch warn; served paths are URL-decoded Docs: README, guide (single files, writing), architecture (live previews, AD-08), workspace.dsl (VS Code extension, Live preview component and dynamic view), requirements FR-161/162 with traceability. CI runs the extension tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le split - The VS Code extension runs py-doc --watch as a child process instead of in a terminal. py-doc picks a free port and the extension reads the address from its "serving" line, so windows never fight over a port. Output goes to an output channel, failures are reported, and stopping ends the whole process tree. New pydoc.executable setting; pydoc.watch.port defaults to 0. - The HTML twin of a deck shows each slide as a numbered 16:9 box, split where PowerPoint splits it (slides-preview.lua, split level and breaks). - Shared preview cases (tests/fixtures/preview/cases.json) run through both the instant preview and the HTML twin, so the two cannot drift apart. - Front matter is read with js-yaml (core schema) instead of a hand parser. - extension.js is split into src/ modules (plugin, detect, frontmatter, text, watch), with ESLint, node --test and tests for the live preview. - Ready to package: license, icon, repository, bugs and homepage fields; the .vsix keeps js-yaml and leaves out dev dependencies. Install docs added. - poster_watch.py is now watch.py, as it serves docx and slides too. - CI lints the extension; docs, model and traceability updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
line-length = 120, the width the code was already written to, so the reformat changes layout only. examples/ and tests/fixtures/ are left out: example files are included into documents and posters, wrapped to fit. CI's lint job now runs `ruff format --check .`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vale 3.24 in CI counts FR-161, FR-162 and the AD-08 context over 30 words; the near-limit sentences of the live preview docs are split as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Adds a live preview to
py-doc docxandpy-doc slidesand lets the VS Code extension drive it. It also fixes the issues found when reviewing the extension, and formats the Python code withruff format.docx/slides --watch.docx/.pptxon every save, plus an HTML twin served on 127.0.0.1 that reloads itself (the same loop asposter --watch, nowwatch.py)..py-doc/preview/and named by their relative path, so no user file is overwritten and two files with the same name in different folders both show.OutputLocked).preview.cssis used only by the twin and shows page breaks, speaker notes and columns. The twin of a deck shows each slide as a numbered 16:9 box, split where PowerPoint splits it (slides-preview.lua).--port/--no-openwithout--watchprint a warning.VS Code extension
paper,byline,orientation) were being sent topy-doc docx.servingline. Output goes to an output channel, failures are reported, and stopping ends the whole process tree. Newpydoc.executablesetting.author:no longer crash the preview.split_levelis honoured in the instant preview.src/modules, with ESLint andnode --test. Added license, icon and repository fields; the.vsixpackages with only its runtime dependency.Shared preview cases
tests/fixtures/preview/cases.jsonruns through both the instant preview (test/cases.test.js) and the HTML twin (tests/test_preview_cases.py), so the two previews can't drift apart.Formatting
ruff formatwithline-length = 120, the width the code was already written to.examples/andtests/fixtures/are excluded because example files are included in documents and posters, wrapped to fit. CI now checks it. The formatting commit is listed in.git-blame-ignore-revs. It touches about 100 files, so reviewing commit by commit is easiest (the formatting commit is layout only).Docs
README, guide (live preview, VS Code), architecture (live previews section, AD-08),
workspace.dsl(VS Code extension container, Live preview component, LivePreview dynamic view), requirements FR-161/FR-162 with traceability, and the extension README (install, settings, tests).Testing
pytest: 1363 passed, 11 skipped (Windows, pandoc on the host)ruff check .andruff format --check .passnpm run lintandnpm testpass (10 tests, including the live preview against a fake py-doc)vsce packagebuilds the.vsix(59 files, 308 KB)py-doc lint docs --strict: 0 warningsNot tested: the extension inside a real VS Code window, and
workspace.dslagainst structurizr-cli (no Docker here). Before merging, it's worth runningpy-doc c4 check docs/architecture/workspace.dsland trying the 👁️ button once.🤖 Generated with Claude Code