fix: place Markdown/HTML attachment assets under target folder#60
Merged
Merged
Conversation
When exporting a folder as Markdown or HTML, attachments were copied twice: once by ExportRunner Step 6 into the target folder's assets dir (<assetsRoot>/assets, consistent with PDF/DOCX), and again by the format renderers into plan.outputRoot/assets (the export root). For a folder source these differ (assetsRoot = outputRoot/outputFolderName), so a stray extra 'assets' folder appeared at the export root. Remove the self-copying logic from renderMarkdownBundle and renderHtmlDocument. Attachments are now copied only by ExportRunner Step 6, landing in the target folder's assets dir — matching PDF/DOCX and deduplicating across files. Tests: - html-document: assert the renderer no longer creates its own assets folder or calls copyBinaryFile - ExportRunner: assert attachments land in <targetFolder>/assets, not the export root
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.
Problem
When exporting a folder as Markdown or HTML, a stray extra
assetsfolder appeared at the export root, instead of (only) under the target folder — inconsistent with PDF/DOCX.Root Cause
Attachments were copied twice:
<assetsRoot>/assets— the target folder (e.g.exports/Publio/assets), consistent with PDF/DOCXrenderMarkdownBundleandrenderHtmlDocumentself-copied intoplan.outputRoot/assets— the export root (e.g.exports/assets)For a folder source these paths differ (
assetsRoot = outputRoot/outputFolderName), so both copies were written and the stray folder appeared. Single-file exports happened to match, so the bug was hidden.PDF/DOCX never had the issue — they don't self-copy (PDF inlines as dataURI, DOCX embeds in the file).
Fix
Removed the self-copying logic (
ensureFolder(outputRoot/assets)+ thecopyBinaryFileloop) fromrenderMarkdownBundleandrenderHtmlDocument. Attachments are now copied only by ExportRunner Step 6 — landing in the target folder's assets dir, matching PDF/DOCX, with cross-file deduplication.Tests
html-document: asserts renderer no longer creates its own assets folder or calls copyBinaryFileExportRunner: asserts attachments land in<targetFolder>/assets, not the export root