migrated to Chrome Manifest V3 - #398
Open
neo37 wants to merge 18 commits into
Open
Conversation
…ped folders New buttons added to popup alongside existing MarkDownload UI: - Open all links on current page in new tabs (3 s delay between each) - Save current tab or all tabs as HTML, PNG, PDF, or Markdown - PDF export uses Chrome DevTools Protocol (Page.printToPDF) — no print dialog - Screenshots and all downloads handled by background page (no popup-close issues) - Each batch is saved into page-saver/YYYY-MM-DD_HH-mm/ inside Downloads All original MarkDownload features by @deathau remain unchanged. Permissions added: tabs, debugger
…abels, update README with usage guide and authors
- Move Readability/DOMParser processing to content script context (get-article.js) to fix 'DOMParser is not defined' error in Chrome MV3 service workers - Also fix notify() clip handler: use getArticleFromContent (tab-injected) instead of getArticleFromDom (which used DOMParser in the SW) - Remove Readability.js from service-worker.js importScripts (no longer needed in SW) - Add 'Crawl entire domain' button: recursively opens all same-domain links with URL normalization and deduplication, plus a Stop button - Update README: document primary use case (wiki/docs archiving) and new feature
…lThis, SW-compatible), guard chrome:// URLs in popup
refactor: replace object URLs with data URLs and crypto.randomUUID() ``` - `414,1048`: `URL.createObjectURL(blob)` → data URLs (`btoa` / `encodeURIComponent`) - `493`: remove `URL.revokeObjectURL()` (no longer needed) - `691`: `URL.createObjectURL(new Blob([]))` → `crypto.randomUUID()` - `710`: `document.createElement` → `dom.createElement` (DOMParser document)
…lenames - Service worker lacks `window`, causing turndown to use slow fallback via `document.implementation` - Added `self.window = self` before imports to enable native DOMParser - Sanitize title with `generateValidFileName()`, fallback to untitled if empty
turndown.js — fallback
…т быть undefined, хотя глобальная DOMParser доступна. Теперь во всех трёх местах (canParseHTMLNatively, HTMLParser, fallback parseFromString) используется цепочка: root.DOMParser || (typeof DOMParser !== undefined ? DOMParser : null)
…rse the HTML string. Well run the conversion via executeScript directly in + fix pdf
…e(...) contains raw unicode characters instead of \uXXXX - Chrome cant do them
… logging
- Run Turndown conversion via executeScript in the tab context (where
document/DOMParser are always available) instead of the service worker,
which has no HTML parser. TurndownService now receives a pre-parsed DOM
node, bypassing its internal htmlParser() entirely.
- Fix TurndownService.prototype.defaultEscape not being set in the tab
isolated world (it was only set in the SW via background.js), causing
"self.escape is not a function" and silent fallback to broken SW path.
- Fix batch "All → Markdown": force saveAs=false so Chrome does not block
downloads after the first save dialog; all tabs now save automatically.
- Fix PDF export: single tab opens print dialog (no black background);
batch uses CDP Page.printToPDF with printBackground=false to avoid
dark-mode black pages and save directly to downloads.
- Add persistent debug log ring buffer (dbgLog → chrome.storage.local)
with "Show debug log" button in popup that downloads markdownload-debug.txt.
nsureScripts → getArticle → convertToMarkdown → download
Author
|
i just found the branch that was there with v3... |
Author
|
new buttons: save all |
neo37
force-pushed
the
main
branch
3 times, most recently
from
May 28, 2026 20:42
dea06c7 to
3a0910a
Compare
Co-Authored-By: neo36 <neo36@users.noreply.github.com>
Author
|
maan |
Y-T04KA
added a commit
to Y-T04KA/markdownload
that referenced
this pull request
Jul 21, 2026
Scopes the migration to the existing feature set, adopting the service-worker-can't-parse-HTML workaround from upstream PR deathau#398 (inject Turndown/Readability into the tab context) while dropping that PR's unrelated Page Saver feature and debugger permission.
Y-T04KA
added a commit
to Y-T04KA/markdownload
that referenced
this pull request
Jul 21, 2026
convertArticleToMarkdown now injects turndown.js + turndown-plugin-gfm.js + convert-article.js into the tab and runs the conversion there, instead of the service worker (which has no DOMParser for Turndown's internal HTML-string parsing to use). The old SW-side turndown() wrapper and its private helpers are deleted rather than kept as dead fallback code, since every call site now has a tabId. Also fixes a bug inherited from the reference implementation this migration is based on (upstream PR deathau#398): the 'copy markdown link' context menu item called the SW-side turndown() on a synthesized <a> tag, which would still fail with no DOMParser. Since the input is already known plain text + URL, it now builds the markdown link directly instead. The popup-triggered clip-to-preview flow (notify's "clip" handler) should now work end-to-end. Context-menu/keyboard-shortcut-triggered actions (download, copy-*) still don't work — they call ensureScripts, which still uses the removed browser.tabs.executeScript API. Fixed in the next task.
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.
Core problem
The extension was migrated to Chrome Manifest V3, which replaces the background page with a Service Worker. SWs have no document, no
URL.createObjectURL, and in this environment DOMParser was also inaccessible — breaking virtually every key feature.
What was done today
Service Worker compatibility
Turndown / HTML parsing in SW
bare global
with new DOMParser() there (page context always has it), and pass the resulting DOM node to TurndownService — bypassing the internal
htmlParser() entirely
fallback to the broken SW path
PDF export
Batch Markdown save ("All → Markdown")
the first tab was actually saved
Download filename fix
special characters
Debug logging