From 21a522bcaa62bee5ad65dfeb9546d74bf32fd3a5 Mon Sep 17 00:00:00 2001 From: ddshi <8811906+ddshi@user.noreply.gitee.com> Date: Fri, 23 Jan 2026 15:12:45 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0README=E4=B8=BA?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- README.md | 120 +++++++++++++++++++++++++++--------------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index d2e7761..5dc41af 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,73 @@ -# React + TypeScript + Vite +# ReadMD - 网页转Markdown -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. +一个Chrome浏览器扩展,用于将网页内容提取并导出为Markdown文件。 -Currently, two official plugins are available: +## 功能特性 -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh +- **自动提取**:使用Mozilla Readability算法自动识别页面主要内容 +- **手动选择**:支持选中特定区域进行提取 +- **图片处理**:保留图片URL链接(不转换为Base64) +- **多种导出**:支持复制到剪贴板或下载为.md文件 +- **元数据**:自动提取标题、URL、描述等元信息 +- **不修改原页**:提取过程不影响原始网页内容 -## React Compiler +## 技术栈 -The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). +- React 18 + TypeScript +- Vite + @crxjs/vite-plugin +- Tailwind CSS +- @mozilla/readability(内容提取) +- Turndown(HTML转Markdown) -## Expanding the ESLint configuration +## 安装方法 -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: +1. 克隆项目 -```js -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... + ```bash + git clone <项目地址> + cd readmd + ``` - // Remove tseslint.configs.recommended and replace with this - tseslint.configs.recommendedTypeChecked, - // Alternatively, use this for stricter rules - tseslint.configs.strictTypeChecked, - // Optionally, add this for stylistic rules - tseslint.configs.stylisticTypeChecked, +2. 安装依赖 - // Other configs... - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) + ```bash + npm install + ``` + +3. 构建扩展 + + ```bash + npm run build + ``` + +4. 在Chrome中加载扩展 + - 打开 `chrome://extensions/` + - 启用「开发者模式」 + - 点击「加载已解压的扩展程序」 + - 选择 `dist` 文件夹 + +## 使用方法 + +1. 点击浏览器工具栏中的扩展图标 +2. 点击「提取文章」自动提取页面主要内容,或选中部分内容后点击「提取选中区域」 +3. 在弹窗中预览提取结果 +4. 点击「复制到剪贴板」或「下载.md文件」导出 + +## 项目结构 + +```text +readmd/ +├── src/ +│ ├── content/ # Content Script(注入到网页) +│ ├── popup/ # 弹出窗口 +│ ├── background/ # Service Worker +│ ├── options/ # 设置页面 +│ ├── utils/ # 工具函数 +│ └── types/ # TypeScript类型定义 +├── manifest.json # 扩展配置 +└── vite.config.ts # Vite配置 ``` -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: +## License -```js -// eslint.config.js -import reactX from 'eslint-plugin-react-x' -import reactDom from 'eslint-plugin-react-dom' - -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - // Enable lint rules for React - reactX.configs['recommended-typescript'], - // Enable lint rules for React DOM - reactDom.configs.recommended, - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` +MIT