docs: fix README CDN URLs, remove non-existent CSS link, update test counts

This commit is contained in:
2026-07-23 16:32:05 +08:00
parent 22e867eda8
commit a08d8571cb
+27 -7
View File
@@ -14,7 +14,7 @@
- **零依赖** — 单文件打包,无任何运行时依赖,UMD/ESM/CJS 三种格式 - **零依赖** — 单文件打包,无任何运行时依赖,UMD/ESM/CJS 三种格式
- **现代化** — 原生 ES2020+ 实现,CSS 变量主题系统,响应式布局,无障碍支持 - **现代化** — 原生 ES2020+ 实现,CSS 变量主题系统,响应式布局,无障碍支持
- **易扩展** — 完整插件系统(install/destroy 生命周期),自定义工具栏按钮,预设插件开箱即用 - **易扩展** — 完整插件系统(install/destroy 生命周期),自定义工具栏按钮,预设插件开箱即用
- **易维护** — 模块化源码,JSDoc 注释完整,TypeScript 类型声明,291 个单元测试覆盖 - **易维护** — 模块化源码,JSDoc 注释完整,TypeScript 类型声明,407 个单元测试覆盖
- **易使用** — 工厂函数 `create()` 一行接入,链式 API,中文优先文档与翻译 - **易使用** — 工厂函数 `create()` 一行接入,链式 API,中文优先文档与翻译
- **安全** — 内置 XSS 防护(`javascript:`/`vbscript:`/`file:` 协议过滤),HTML 转义,`safeUrl` 净化 - **安全** — 内置 XSS 防护(`javascript:`/`vbscript:`/`file:` 协议过滤),HTML 转义,`safeUrl` 净化
- **内置解析器** — 自研 CommonMark 子集 + GFM 扩展(表格、任务列表、删除线、自动链接),可整体替换 - **内置解析器** — 自研 CommonMark 子集 + GFM 扩展(表格、任务列表、删除线、自动链接),可整体替换
@@ -54,16 +54,23 @@ npm install @metona-team/metona-editor
### 浏览器直接引入(UMD ### 浏览器直接引入(UMD
> 样式由 JS 自动注入(`styles.js` 运行时动态创建 `<style>` 标签),无需单独引入 CSS 文件。
```html ```html
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="stylesheet" href="https://unpkg.com/@metona-team/metona-editor/dist/metona-editor.min.css" />
</head> </head>
<body> <body>
<div id="editor"></div> <div id="editor"></div>
<script src="https://unpkg.com/@metona-team/metona-editor/dist/metona-editor.min.js"></script>
<!-- CDN UMD 开发版 -->
<script src="https://git.metona.cn/MetonaTeam/MetonaEditor/raw/branch/master/dist/metona-editor.js"></script>
<!-- CDN 压缩版(生产环境推荐) -->
<!-- <script src="https://git.metona.cn/MetonaTeam/MetonaEditor/raw/branch/master/dist/metona-editor.min.js"></script> -->
<script> <script>
const editor = MeEditor.create('#editor', { const editor = MeEditor.create('#editor', {
value: '# Hello World', value: '# Hello World',
@@ -74,6 +81,19 @@ npm install @metona-team/metona-editor
</html> </html>
``` ```
### CDN ES Module
```html
<script type="module">
import MeEditor from 'https://git.metona.cn/MetonaTeam/MetonaEditor/raw/branch/master/dist/metona-editor.esm.js';
const editor = MeEditor.create('#editor', {
value: '# Hello World',
mode: 'split',
});
</script>
```
### ES Module ### ES Module
```javascript ```javascript
@@ -760,11 +780,11 @@ npm run test:coverage
| utils.js | 96.2% | 87.1% | 100% | | utils.js | 96.2% | 87.1% | 100% |
| themes.js | 92.9% | 84.2% | 96.7% | | themes.js | 92.9% | 84.2% | 96.7% |
| i18n.js | 86.6% | 69.5% | 93.9% | | i18n.js | 86.6% | 69.5% | 93.9% |
| plugins.js | 79.9% | 59.6% | 73.8% | | plugins.js | 99.6% | 96.7% | 98.5% |
| core.js | 72.9% | 60.9% | 69.4% | | core.js | 99.5% | 96.6% | 98.2% |
| **总体** | **80.6%** | **67.8%** | **79.3%** | | **总体** | **96.9%** | **80.3%** | **94.6%** |
测试文件位于 [tests/](./tests) 目录,共 **291 个测试用例**,覆盖: 测试文件位于 [tests/](./tests) 目录,共 **407 个测试用例**,覆盖:
- `parser.test.js` — Markdown 解析器全部语法 + XSS 防护 - `parser.test.js` — Markdown 解析器全部语法 + XSS 防护
- `utils.test.js` — 工具函数(generateId / escapeHTML / debounce / throttle / deepMerge 等) - `utils.test.js` — 工具函数(generateId / escapeHTML / debounce / throttle / deepMerge 等)