Skip to content

fix: add image resoures cleaner#65

Merged
shinyu0430 merged 6 commits into
mainfrom
fix/image-resoure-cleaner
Aug 18, 2025
Merged

fix: add image resoures cleaner#65
shinyu0430 merged 6 commits into
mainfrom
fix/image-resoure-cleaner

Conversation

@shinyu0430

Copy link
Copy Markdown
Contributor

Problem

When users upload images and subsequently remove the corresponding markdown syntax, the system continues to include these unused image files in exported packages.

Solution

Remove unused image files before export

  • Parse generated HTML content:
    • STEP1: convert HTML string to DOM object
    • STEP2: identify <img> tags by extracting data-id attributes
    • STEP3: matching them against the image resource list.
  • Fallback mechanism: Utilize markdown text analysis when HTML parsing encounters errors

WendellLiu
WendellLiu previously approved these changes Jul 23, 2025
Comment thread src/lib/image-resource-cleaner.js Outdated
Comment thread src/lib/image-resource-cleaner.js Outdated
@WendellLiu WendellLiu self-requested a review July 23, 2025 13:02
@WendellLiu WendellLiu dismissed their stale review July 23, 2025 13:03

I should have commented rather than approved.

Comment thread src/lib/image-resource-cleaner.js Outdated
@shinyu0430

Copy link
Copy Markdown
Contributor Author

@WendellLiu I've updated it. Please let me know if it’s ok to merge 🙏🏻

@WendellLiu WendellLiu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shinyu0430 Thank you. It's good to merge.

@shinyu0430 shinyu0430 force-pushed the fix/image-resoure-cleaner branch 2 times, most recently from a35c26e to 219b00e Compare August 18, 2025 19:16
@shinyu0430 shinyu0430 force-pushed the fix/image-resoure-cleaner branch 3 times, most recently from 2b78c80 to 41011f7 Compare August 18, 2025 19:39
@shinyu0430 shinyu0430 force-pushed the fix/image-resoure-cleaner branch from 41011f7 to 01b1786 Compare August 18, 2025 20:14
@shinyu0430 shinyu0430 merged commit 904e3af into main Aug 18, 2025
1 check passed
@shinyu0430 shinyu0430 deleted the fix/image-resoure-cleaner branch August 18, 2025 20:18
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