release: v0.1.4 — parser enhancement, new syntax, performance optimization

feat(parser): comprehensive Markdown parser enhancement
- Add nested list support (multi-level unordered/ordered, mixed nesting)
- Add Setext headings (=== / ---)
- Add indented code blocks (4-space indent)
- Add HTML comment passthrough (<!-- -->)
- Add entity reference protection (&amp; &#169;)
- Add ordered list start attribute
- Add link title single-quote support
- Add LaTeX math formulas ($inline$ / $$block$$)
- Add footnote support ([^1] ref + [^1]: definition)
- Add definition lists (term\n: definition)
- Extend emoji map from 85 to 150+ common emojis
- Fix backtick code block matching (CommonMark spec)
- Fix italic regex character truncation (lookbehind assertions)
- Fix superscript/subscript/strikethrough ambiguity
- Fix blockquote prefix handling (>text without space)
- Enhance safeUrl filtering (additional protocol checks)
- Enhance slugify (Unicode NFKC normalization)

perf(parser): single-pass inline scanning, render cache, pre-compiled regex
- Replace 14-step chained regex with unified single-pass scanInline()
- Add cachedRenderInline() with FIFO LRU eviction (300-entry cap)
- Pre-compile 15+ static regex constants for block boundary detection
- Skip redundant style='text-align:left' on default-aligned table cells

style(parser): add CSS for footnotes, definition lists, math formulas, sup/sub

test(parser): 44 new test cases covering all v0.1.4 syntax additions (469 total)

chore: bump version 0.1.3 → 0.1.4 across all source files, docs, site pages
This commit is contained in:
2026-07-24 09:35:51 +08:00
parent 2eb86d29b6
commit f8b9f4a761
19 changed files with 1128 additions and 198 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Animations - 动画管理
* @module animations
* @version 0.1.3
* @version 0.1.4
* @description 动画注册与管理(当前为 CSS 动画元数据管理,供未来扩展如 Toast/通知组件的进出场动画使用;
* 内置 7 种预设动画曲线配置;编辑器核心当前未直接调用此模块)
*/
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Constants - 常量定义
* @module constants
* @version 0.1.3
* @version 0.1.4
* @description 默认配置、主题、动画、工具栏等常量
*/
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Core - 编辑器核心
* @module core
* @version 0.1.3
* @version 0.1.4
* @description MarkdownEditor 类实现:DOM 构建、事件、渲染、历史栈、选区操作、模式切换
*/
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor i18n - 国际化管理
* @module i18n
* @version 0.1.3
* @version 0.1.4
* @description 多语言支持、语言切换和翻译管理
*/
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Icons — 工具栏图标SVG定义
* @module icons
* @version 0.1.3
* @version 0.1.4
* @description 工具栏格式化按钮 SVG 图标
*/
+5 -3
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor - 轻量级 Markdown Editor 库
* @module metona-editor
* @version 0.1.3
* @version 0.1.4
* @author thzxx
* @description 现代化、零依赖、易扩展、易维护、易使用的 Markdown 编辑器库。单文件,开箱即用。
* @license MIT
@@ -21,7 +21,7 @@
*/
import { MarkdownEditor } from './core.js';
import { parseMarkdown, safeUrl, slugify } from './parser.js';
import { parseMarkdown, safeUrl, slugify, clearRenderCache } from './parser.js';
import { themeUtils } from './themes.js';
import { i18nUtils } from './i18n.js';
import { pluginUtils, presetPlugins } from './plugins.js';
@@ -29,7 +29,7 @@ import { animationUtils } from './animations.js';
import { DEFAULTS, ICONS, THEMES, EDIT_MODES, DEFAULT_TOOLBAR, TOOLBAR_ACTIONS } from './constants.js';
// 版本信息
const VERSION = '0.1.3';
const VERSION = '0.1.4';
/**
* 全局默认插件队列
@@ -193,6 +193,7 @@ const api = {
parseMarkdown,
safeUrl,
slugify,
clearRenderCache,
// 工具集
themes: themeUtils,
@@ -233,6 +234,7 @@ export {
parseMarkdown,
safeUrl,
slugify,
clearRenderCache,
themeUtils,
i18nUtils,
pluginUtils,
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Locales — 国际化翻译数据
* @module locales
* @version 0.1.3
* @version 0.1.4
* @description 内置 zh-CN / en-US 完整翻译
*/
+697 -160
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Plugins - 插件系统
* @module plugins
* @version 0.1.3
* @version 0.1.4
* @description 插件管理器 + 预设插件(autoSave / exportTool / searchReplace
*
* 插件约定:
+51 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Styles - 编辑器样式
* @module styles
* @version 0.1.3
* @version 0.1.4
* @description 编辑器 UI 样式注入与管理
*/
@@ -342,6 +342,56 @@ const generateCSS = () => {
border-radius: 3px;
}
/* ============ 上标/下标 ============ */
.me-preview sup { font-size: 0.75em; vertical-align: super; line-height: 1; }
.me-preview sub { font-size: 0.75em; vertical-align: sub; line-height: 1; }
/* ============ 数学公式 ============ */
.me-preview .me-math-block {
display: block;
margin: 1.2em 0;
padding: 12px 16px;
background: var(--md-code-bg);
border-radius: 8px;
overflow-x: auto;
font-family: var(--md-mono);
font-size: 0.95em;
text-align: center;
}
.me-preview .me-math-inline {
font-family: var(--md-mono);
font-size: 0.95em;
padding: 0.05em 0.2em;
}
/* ============ 定义列表 ============ */
.me-preview dl { margin: 0.8em 0; }
.me-preview dt { font-weight: 650; margin: 0.6em 0 0.2em; }
.me-preview dd { margin: 0 0 0.3em 1.6em; color: var(--md-text); }
/* ============ 脚注 ============ */
.me-preview .me-footnote-ref a {
font-size: 0.75em;
vertical-align: super;
text-decoration: none;
color: var(--md-accent);
}
.me-preview .me-footnotes {
margin-top: 2em;
border-top: 1px solid var(--md-border);
padding-top: 0.8em;
font-size: 0.9em;
color: var(--md-muted);
}
.me-preview .me-footnotes hr { display: none; }
.me-preview .me-footnotes ol { padding-left: 1.2em; }
.me-preview .me-footnote-item { margin: 0.3em 0; }
.me-preview .me-footnote-backref {
text-decoration: none;
color: var(--md-accent);
margin-right: 0.4em;
}
/* ============ 打印样式 ============ */
@media print {
.me-wrapper { border: 0 !important; box-shadow: none !important; }
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Themes - 主题管理
* @module themes
* @version 0.1.3
* @version 0.1.4
* @description 主题系统、自定义主题和主题切换
*/
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Utils - 工具函数
* @module utils
* @version 0.1.3
* @version 0.1.4
* @description 通用工具函数集合
*/