Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
77ca181
Fix a typo in README.md
eugenesvk Jan 10, 2024
d0078e9
fix filename issue when saving to obsidian
nekton39 Feb 5, 2024
3d598c1
fix filename issue when saving to obsidian
nekton39 Feb 5, 2024
0abc826
Detailed instructions on how to use obsidian integration.
2gn Mar 9, 2024
a2fd13e
Merge pull request #303 from 2gn/master
deathau Mar 13, 2024
5d8075c
Prevent Readability from removing the <html> element if has a 'class'
WetHat Mar 27, 2024
94b3dae
Make sure the 'href' attribute of the base tag points to the actual
WetHat Mar 28, 2024
31e7c39
Update to 7.1.3
WetHat Mar 28, 2024
419f91b
Readability component updated to 0.5.0
WetHat Mar 28, 2024
be04cbd
Provide a defaut titl if a web page has none
WetHat Mar 28, 2024
f9ca896
Generate a document title element if none is presentaso that pageTitl…
WetHat Mar 28, 2024
d2eb594
Title element presence check fixed
WetHat Mar 28, 2024
0484f3d
Fixed flattened code blocks. This occured because the 'codel' element…
WetHat Apr 2, 2024
1bfcd7f
Return plain text (rather than html) if called for `<pre>` element wh…
WetHat Apr 3, 2024
156fde1
Do not creeate a fenced block if `<pre>` tag contains an image
WetHat Apr 3, 2024
aa8ac75
add lowercase and uppercase parameterizations
redxtech Jun 3, 2024
60a1e71
add docs on lower and upper case parameterizations
redxtech Jun 3, 2024
528940e
Added additional parameterization options
NSHenry Aug 20, 2024
acaf729
fix #340 clean extra whitespace in generateValidFileName
ricketyboo Aug 22, 2024
71fb3b8
fix erroneous assignment to const
ricketyboo Aug 22, 2024
08b0b80
Merge pull request #285 from eugenesvk/patch-1
deathau Aug 23, 2024
15b8d35
Merge pull request #290 from nekton39/master
deathau Aug 23, 2024
5aa250e
Merge pull request #307 from WetHat/keepHTML
deathau Aug 23, 2024
6b0e2fa
Merge pull request #308 from WetHat/badBase
deathau Aug 23, 2024
b2a7317
Merge pull request #311 from WetHat/missingTitle
deathau Aug 23, 2024
38f867b
Merge pull request #312 from WetHat/codeFix
deathau Aug 23, 2024
d18f10b
Merge pull request #313 from WetHat/ReadabilityUpdate
deathau Aug 23, 2024
eda2989
Merge pull request #314 from WetHat/TurndownUpdate
deathau Aug 23, 2024
846283f
Merge pull request #324 from redxtech/master
deathau Aug 23, 2024
e1a117a
Merge pull request #339 from NSHenry/dev
deathau Aug 23, 2024
72ddf6f
Merge pull request #341 from rickdoesdev/master
deathau Aug 23, 2024
7e8cc1a
Updating version and readme for 3.4.0
deathau Aug 23, 2024
1adab2a
fix v3
TianleLin Sep 10, 2025
83a9a1a
fix send to obsidian
TianleLin Sep 10, 2025
0a24d16
fix send to obsidian
TianleLin Sep 10, 2025
0283e13
fix download
TianleLin Sep 10, 2025
83c6fae
fix download image and add copy button
TianleLin Sep 10, 2025
02eb5c6
delete v2 code, delete tab, fix service work
TianleLin Sep 10, 2025
400ebb1
optimize popup
TianleLin Sep 11, 2025
7fc9e11
fix download image
TianleLin Sep 11, 2025
8ed4b6f
fix download image
TianleLin Sep 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# Changelog
## 3.4.0
- Fixed extra spaces in titles which could cause issues (thanks @rickdoesdev !)
- Fixed an issue with image paths in some circumstances (thanks @rickdoesdev !)
- Added parametersizations for "mixed-kebab" and "mixed_snake" which retain original casing but replace spaces (thanks @NSHenry !)
- Also added a special "obsidian-cal" parameterization which is the same as "mixed-kebab" with duplicate `-` removed for additional compatibility with the Obsidian Consistent Attachment Location plugin (thanks @NSHenry !)
- Added lowecase and uppercase options to parameterizations (thanks @redxtech !)
- Updated Turndown to v7.1.3 (thanks @WeHat !)
- Updated Readability to v0.5.0 (thanks @WeHat !)
- Fixed some issues with code block parsing and formatting (thanks @WeHat !)
- Fixed an issue with some sites missing a proper title (thanks @WeHat !)
- Fixed an issue with bad base urls causing issues with links in certain circumstances (thanks @WeHat !)
- Fixed an issue with readability removing everything in certain circumstances (thanks @WeHat !)
- Send properly configured title to the Obsidian integration (thanks @nekton39 !)
- Updates to the README (thanks @2gn and @eugenesvk !)
## 3.3.0
- Remove hidden content before exporting (thanks @nhaouari !). This allows you to use a different extension (e.g. Adblock) to hide elements that would otherwise clutter up your export
- Fixes for Obsidian integration in Safari (thanks @aancw !)
Expand Down
61 changes: 35 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,27 @@ The extension is available for [Firefox](https://addons.mozilla.org/en-GB/firefo
# Obsidian Integration

For integration with obsidian, you need to install and enable community plugins named "Advanced Obsidian URI". This plugin help us to bypass character limitation in URL. Because it's using clipboard as the source for creating new file.
More information: https://vinzent03.github.io/obsidian-advanced-uri/
More information about Advanced Obsidian URI plugin: https://vinzent03.github.io/obsidian-advanced-uri/

You need to do some configurations in order to use this integration.
<details>
<summary>Steps to follow</summary>

1. Left-Click on the extension
2. Click on the gear icon to open the configuration menu
3. Scroll down to "Obsidian integration" section and turn "enable obsidian integration" on.
4. Fill out the form below (Obsidian vault name and Obsidian folder name.)
5. Right-click on the extension and open the menu
6. In "MarkDownload - Markdown Web Clipper", select "Send Tab to Obsidian"

</details>



# External Libraries
It uses the following libraries:
- [Readability.js](https://github.com/mozilla/readability) by Mozilla in version from commit [1fde3ac626bc4c2e5e54daa57c57d48b7ed9c574](https://github.com/mozilla/readability/commit/1fde3ac626bc4c2e5e54daa57c57d48b7ed9c574). This library is also used for the Firefox Reader View and it simplifies the page so that only the important parts are clipped. (Licensed under Apache License Version 2.0)
- [Turndown](https://github.com/mixmark-io/turndown) by Dom Christie in version 7.1.1 is used to convert the simplified HTML (from Readability.js) into markdown. (Licensed under MIT License)
- [Readability.js](https://github.com/mozilla/readability) by Mozilla version [0.5.0](https://github.com/mozilla/readability/releases/tag/0.5.0). This library is also used for the Firefox Reader View and it simplifies the page so that only the important parts are clipped. (Licensed under Apache License Version 2.0)
- [Turndown](https://github.com/mixmark-io/turndown) by Dom Christie in version [7.1.3](https://github.com/mixmark-io/turndown/releases/tag/v7.1.3) is used to convert the simplified HTML (from Readability.js) into markdown. (Licensed under MIT License)
- [Moment.js](https://momentjs.com) version 2.29.4 used to format dates in template variables

# Permissions
Expand All @@ -42,7 +57,7 @@ It uses the following libraries:
The Common Mark icon courtesy of https://github.com/dcurtis/markdown-mark

## Pricing
This is an open-source extension I made *for fun*. It's intention is to be completely free.
This is an open-source extension I made *for fun*. Its intention is to be completely free.
It's free on Firefox, Edge and Chrome (and other Chromium browsers),
but unfortunately for Safari there is a yearly developer fee, so I've decided to
charge a small price for the Safari version to help cover that cost.
Expand All @@ -56,25 +71,19 @@ in my hat via the following:
[![Paypal](https://img.shields.io/badge/paypal-deathau-yellow?style=social&logo=paypal)](https://paypal.me/deathau)

# Version History
## 3.3.0
- Remove hidden content before exporting (thanks @nhaouari !). This allows you to use a different extension (e.g. Adblock) to hide elements that would otherwise clutter up your export
- Fixes for Obsidian integration in Safari (thanks @aancw !)
- Keep a few more HTML tags that have no markdown equivalent (`u`, `ins`, `del`, `small`, `big`) (thanks @mnaoumov !)
- Add support for KaTeX formulas parsing (thanks @mnaoumov !)
- Fixed saving for options when imported from file (and show a little 'saved' indicator)
- Added a toggle for downloading images in the context menu and popup
- Added a link to the options in the popup
- Added some basic error handling to the popup
- Changes to how html inside code blocks is handled (thanks @mnaumov !)
- Treat codehilite without specified language as plaintext (thanks @mnaoumov !)
- Ensure sequential line breaks in `<pre>` are preserved in code blocks (thanks @mnaumov !)
- Update user guide link in README to point to GitHub
- Added keyboard shortcuts to copy selection / current tab to obsidian (user-definable in browsers that support that) (thanks @legolasdimir and @likeablob !)
- Select multiple tabs (hold crtl/cmd) then copy all tab urls as a markdown link list via keyboard shortcut or context menu (thanks @romanPrignon !)
- Allow users to include custom text such like `{date:YYYY-MM-DD}/`` in their Obsidian Folder Name setting (thanks @likeablob !)
- Fixed a small typo in the user guide (thanks @devon-research !)
- Fix for missing headings on sites like Substack (thanks @eactisgrosso !)
- Add support for websites using MathJax 3 (thanks @LeLocTai !)
- Moved previous version history into [CHANGELOG.md](./CHANGELOG.md)

> Previous version history is recorded in [CHANGELOG.md](./CHANGELOG.md)
## 3.4.0
- Fixed extra spaces in titles which could cause issues (thanks @rickdoesdev !)
- Fixed an issue with image paths in some circumstances (thanks @rickdoesdev !)
- Added parametersizations for "mixed-kebab" and "mixed_snake" which retain original casing but replace spaces (thanks @NSHenry !)
- Also added a special "obsidian-cal" parameterization which is the same as "mixed-kebab" with duplicate `-` removed for additional compatibility with the Obsidian Consistent Attachment Location plugin (thanks @NSHenry !)
- Added lowecase and uppercase options to parameterizations (thanks @redxtech !)
- Updated Turndown to v7.1.3 (thanks @WeHat !)
- Updated Readability to v0.5.0 (thanks @WeHat !)
- Fixed some issues with code block parsing and formatting (thanks @WeHat !)
- Fixed an issue with some sites missing a proper title (thanks @WeHat !)
- Fixed an issue with bad base urls causing issues with links in certain circumstances (thanks @WeHat !)
- Fixed an issue with readability removing everything in certain circumstances (thanks @WeHat !)
- Send properly configured title to the Obsidian integration (thanks @nekton39 !)
- Updates to the README (thanks @2gn and @eugenesvk !)

> Previous version history is recorded in [CHANGELOG.md](./CHANGELOG.md)
101 changes: 101 additions & 0 deletions UPGRADE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# MarkDownload Manifest V3 升级说明

## 已完成的修改

### 1. Manifest.json 升级
- 从 Manifest V2 升级到 Manifest V3
- 更新权限:将 `<all_urls>` 移动到 `host_permissions`
- 将 `browser_action` 更改为 `action`
- 将 `background.scripts` 更改为 `background.service_worker`
- 添加了 `scripting` 权限以支持动态脚本注入
- 添加了 `content_scripts` 声明以自动注入内容脚本
- **修复**: 移除了 `options_ui` 中不兼容的 `chrome_style` 和 `browser_style` 选项
- **修复**: 将命令 `_execute_browser_action` 改为 `_execute_action`

### 2. Background Script 转换为 Service Worker
- 创建了新的 `src/background/service-worker.js` 文件
- 将所有依赖脚本使用 `importScripts()` 导入
- 更新了所有 Chrome API 调用以适配 Manifest V3
- 使用 `chrome.scripting.executeScript()` 替代 `chrome.tabs.executeScript()`
- 添加了详细的调试日志用于问题排查

### 3. 内容脚本改进
- 添加了详细的调试日志
- 改进了DOM处理和错误处理
- 增强了剪贴板操作的兼容性
- 添加了更好的浏览器API兼容性检查

### 4. 调试功能
- 在所有关键函数中添加了console.log输出
- 添加了错误处理和回退机制
- 提供了详细的操作状态信息

## 测试建议

### 1. 加载扩展
1. 打开 Chrome 浏览器
2. 导航到 `chrome://extensions/`
3. 启用"开发者模式"
4. 点击"加载已解压的扩展程序"
5. 选择 `src` 目录

### 2. 测试功能
1. **基本测试**:
- 右键点击页面,检查是否出现 MarkDownload 上下文菜单
- 点击扩展图标,检查弹出窗口是否正常显示

2. **核心功能测试**:
- 测试"Download Tab As Markdown"
- 测试"Copy Tab As Markdown"
- 测试选中文本后的"Copy Selection As Markdown"

3. **调试检查**:
- 打开 Chrome 开发者工具
- 检查 Console 标签页中的 MarkDownload 日志输出
- Service Worker 日志可在扩展管理页面的"Service Worker"链接中查看

### 3. 常见问题排查

#### 如果扩展无法加载:
1. 检查 manifest.json 语法是否正确
2. 确保所有引用的文件都存在
3. 查看扩展管理页面的错误信息

**已修复的常见错误:**
- ✅ "The chrome_style option cannot be used with manifest version 3" - 已从 `options_ui` 中移除 `chrome_style` 和 `browser_style`
- ✅ "_execute_browser_action command not recognized" - 已更改为 `_execute_action`

#### 如果功能不工作:
1. 检查 Service Worker 是否运行(在扩展管理页面)
2. 查看浏览器控制台的错误信息
3. 检查 MarkDownload 的调试日志

#### 如果权限问题:
1. 确保网站允许执行脚本
2. 检查是否在受限页面(如 chrome://)上使用
3. 验证 host_permissions 是否正确设置

## 技术细节

### Service Worker 变化
- 不再是持久的背景页面,而是事件驱动的
- 需要使用 `importScripts()` 导入依赖
- API 调用从 `browser.*` 改为 `chrome.*`

### 内容脚本注入
- 从动态注入改为声明式注入
- 使用 `chrome.scripting.executeScript()` 进行必要时的动态注入
- 改进了脚本可用性检查

### 权限模型
- `<all_urls>` 权限移至 `host_permissions`
- 添加了 `scripting` 权限支持动态脚本执行

## 已知限制
- 在某些受保护的页面(如 chrome:// 页面)上无法工作
- Service Worker 在空闲时会被暂停,但会在需要时自动恢复

## 版本兼容性
- 支持 Chrome 88+ (Manifest V3 最低要求)
- 向后兼容原有功能
- 保持与 Firefox 的兼容性(通过 browser-polyfill)
Loading