diff options
author | Ferdinand Thiessen <rpm@fthiessen.de> | 2022-07-11 20:30:49 +0300 |
---|---|---|
committer | Ferdinand Thiessen <rpm@fthiessen.de> | 2022-07-19 12:24:58 +0300 |
commit | e5f773bc895c1ee04ba8d42505c562e6efc4dea3 (patch) | |
tree | a03630ad8fb1609d09c2ad946ca94dd1d7e4a378 /src/tests | |
parent | d363e831582a1b0c29ddbc100df4293e36186429 (diff) |
Added markdown parsing rules to tag special syntax to be not modified when saved
Added a markdown-it and tiptap extension to tag special, unknown,
markdown syntax which would be escaped by prosemirror-markdown on save.
The tagged part is not touched while saving if they are not modified manually.
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/markdown.spec.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tests/markdown.spec.js b/src/tests/markdown.spec.js index a682111a3..e6ce10819 100644 --- a/src/tests/markdown.spec.js +++ b/src/tests/markdown.spec.js @@ -45,7 +45,8 @@ describe('Commonmark', () => { const expected = entry.markdown.includes('__') ? entry.html.replace(/<strong>/g, '<u>').replace(/<\/strong>/g, '</u>') : entry.html - expect(markdownit.render(entry.markdown)).toBe(expected) + // Ignore special markup for untouched markdown + expect(markdownit.render(entry.markdown).replace(/<span class="keep-md">([^<]+)<\/span>/g, '$1')).toBe(expected) }) }) }) @@ -95,6 +96,12 @@ describe('Markdown though editor', () => { test('code block', () => { expect(markdownThroughEditor('```\n<?php echo "Hello World";\n```')).toBe('```\n<?php echo "Hello World";\n```') }) + test('markdown untouched', () => { + // Issue #2703 + expect(markdownThroughEditor('[bar\\\\]: /uri\n\n[bar\\\\]')).toBe('[bar\\\\](/uri)') + expect(markdownThroughEditor('## Test \\')).toBe('## Test \\') + expect(markdownThroughEditor('- [ [asd](sdf)')).toBe('* [ [asd](sdf)') + }) test('checkboxes', () => { // Invalid ones but should be syntactical unchanged expect(markdownThroughEditor('- [F] asd')).toBe('* [F] asd') |