Repository navigation
Description
Stage 4 — Readable, configurable exports
Synopsis
Make code-language labels configurable in the two formats that already support them, using top-left as the new default while retaining a visibility switch.
End goal
PDF and DOCX labels appear in the selected position, remain associated with their code blocks, and preserve readable editable/selectable code.
Start after
No prerequisite issue. This work can start independently from freshly fetched origin/main; stage numbering does not require waiting for every earlier milestone. Use the repository's dedicated feature-branch/worktree workflow and record the actual base revision.
Current evidence
The current export-language setting controls visibility in direct PDF and DOCX. The inspected implementations place a label at the lower-right, through separate PDF and Pandoc/DOCX paths. No existing position setting was found. HTML/EPUB language metadata and standalone Electron export are outside this feature.
Source-inspected baseline: 19b276f3b819b9549e3a9e06d2dc967d8187ec06. Recheck the relevant code on the actual implementation base. No current runtime pass or implementation completion is claimed by this issue.
Agreed scope
- Default to top-left and provide a documented corner-position selector, retaining the existing lower-right presentation as a selectable choice.
- Keep
binary-markdown.export.showCodeLanguagecompatible; capture presentation choices once for a saved export revision. - Establish reusable header/footer metadata placement so the later bottom-left line count can be added without overlapping a label.
- Keep labels derived from the declared fence language and existing alias mapping; do not invent a language for an unlabeled block.
- This is an explicit presentation-default change. Preserve stored user choices and document the migration.
Acceptance criteria
- Every documented position and the independent visibility setting works in PDF and DOCX with top-left as the unset default.
- Labels remain attached to the correct block across pagination, including blocks too long for one page; no code text is lost or replaced by a screenshot.
- Known aliases, unknown/custom names, long names, and unlabeled blocks retain the agreed behavior.
- Source Markdown is unchanged and exported code remains selectable in PDF and editable in DOCX under the supported-reader contract.
- Settings and the shared export presentation contract are documented for dependent line-count/numbering work.
Verification
- Generate actual PDF/DOCX files with short/long blocks, labeled/unlabeled/custom languages, and multi-page content.
- Inspect supported PDF and DOCX readers and record versions; XML/DOM assertions supplement but do not replace reader observation.
- Exercise visibility and position settings in a packaged extension, using real converters and the saved-revision export gate.
Source pointers
src/export/controller.tssrc/export/types.tssrc/export/pdf.tssrc/export/pandoc.tssrc/export/language-tab.tssrc/export/code-language.tspackage.jsonmedia/export-help.md
Delivery contract
Use the existing supported export host and saved-revision capture; do not add standalone Electron export. Preserve authored Markdown and all code whitespace. Capture presentation settings consistently for each job, update supported translations/documentation, and distinguish structural/converter checks from actual target-reader observations.
Work from the repository root using the Node version in .node-version and the maintained instructions in CONTRIBUTING.md, docs/building.md, and docs/testing/README.md; export changes also follow docs/export-verification.md. Run full compilation after webview JavaScript/CSS, shared-module, or translation changes, plus checks that exercise the changed behavior. Rebuild and reinstall for installed-extension evidence. Report failures/skips honestly; follow required CI and review gates. Update affected documentation and review any committed Markdown in source and rendered form.
Link the PR or investigation to this issue. Keep remediation on the same focused work item where practical. Completion requires the stated evidence and accepted outcome; opening a draft PR does not complete the issue. No deadline or assignee is imposed by this issue.
Activity