release: v0.1.2 — readOnly, new syntax, plugins, optimizations
Features: - feat(core): readOnly mode with config option and setReadOnly() API - feat(parser): superscript ^text^ and subscript ~text~ support - feat(parser): highlight/mark ==text== syntax - feat(parser): table column alignment with colons (:---, :---:, ---:) - feat(parser): emoji shortcodes 😄 → 😊 (80+ common emojis) - feat(plugins): imagePaste preset — paste clipboard images as base64 - feat(core): instance-level beforeRender/afterRender events - feat(styles): print stylesheet (@media print) - feat(styles): mark element CSS styling - feat(styles): readOnly mode CSS (.me-readonly) Optimizations: - perf(core): history debounce now configurable via historyDebounce option - perf(core): skip _render() in edit-only mode (already guarded) - fix(core): divider drag division-by-zero guard - fix(core): config.style deep merge with DEFAULTS - fix(core): scroll position preserved across mode switches Tests: - 9 new test cases: readOnly (3), parser syntax (6) - Total: 418 tests passing (+9 from v0.1.1) Chores: - version bump 0.1.1 → 0.1.2 - TypeScript definitions updated for new APIs
This commit is contained in:
+39
-4
@@ -228,10 +228,10 @@ describe('parseMarkdown - 表格', () => {
|
||||
const html = parseMarkdown(md);
|
||||
expect(html).toContain('<table>');
|
||||
expect(html).toContain('<thead>');
|
||||
expect(html).toContain('<th>a</th>');
|
||||
expect(html).toContain('<th>b</th>');
|
||||
expect(html).toContain('<td>1</td>');
|
||||
expect(html).toContain('<td>2</td>');
|
||||
expect(html).toContain('<th style="text-align:left">a</th>');
|
||||
expect(html).toContain('<th style="text-align:left">b</th>');
|
||||
expect(html).toContain('<td style="text-align:left">1</td>');
|
||||
expect(html).toContain('<td style="text-align:left">2</td>');
|
||||
});
|
||||
|
||||
test('表格被 me-table-wrap 包裹', () => {
|
||||
@@ -351,3 +351,38 @@ describe('slugify', () => {
|
||||
expect(slugify('-hello-')).toBe('hello');
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseMarkdown - v0.1.2 新语法', () => {
|
||||
test('高亮标记 ==text==', () => {
|
||||
const html = parseMarkdown('==highlight==');
|
||||
expect(html).toContain('<mark>highlight</mark>');
|
||||
});
|
||||
|
||||
test('上标 ^text^', () => {
|
||||
const html = parseMarkdown('x^2^');
|
||||
expect(html).toContain('<sup>2</sup>');
|
||||
});
|
||||
|
||||
test('下标 ~text~', () => {
|
||||
const html = parseMarkdown('H~2~O');
|
||||
expect(html).toContain('<sub>2</sub>');
|
||||
});
|
||||
|
||||
test('Emoji 短码 :smile:', () => {
|
||||
const html = parseMarkdown(':smile: :rocket:');
|
||||
expect(html).toContain('😊');
|
||||
expect(html).toContain('🚀');
|
||||
});
|
||||
|
||||
test('未知 Emoji 短码保留原文', () => {
|
||||
const html = parseMarkdown(':unknown_emoji:');
|
||||
expect(html).toContain(':unknown_emoji:');
|
||||
});
|
||||
|
||||
test('表格对齐 :---: 居中', () => {
|
||||
const md = '| a | b |\n| :---: | ---: |\n| 1 | 2 |';
|
||||
const html = parseMarkdown(md);
|
||||
expect(html).toContain('text-align:center');
|
||||
expect(html).toContain('text-align:right');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user