fix: update rehype-remark (#3864)

This commit is contained in:
Erez Rokah
2020-06-07 14:01:50 +03:00
committed by GitHub
parent 8ccbb3489f
commit 53cba02244
3 changed files with 87 additions and 63 deletions

View File

@ -29,7 +29,7 @@
"react-monaco-editor": "^0.25.1",
"react-select": "^2.4.3",
"rehype-parse": "^6.0.0",
"rehype-remark": "^5.0.1",
"rehype-remark": "^8.0.0",
"rehype-stringify": "^7.0.0",
"remark-parse": "^6.0.3",
"remark-rehype": "^4.0.0",

View File

@ -1,6 +1,6 @@
import path from 'path';
import fs from 'fs';
import { markdownToSlate } from '../';
import { markdownToSlate, htmlToSlate } from '../';
describe('markdownToSlate', () => {
it('should not add duplicate identical marks under the same node (GitHub Issue 3280)', () => {
@ -41,3 +41,25 @@ describe('markdownToSlate', () => {
});
});
});
describe('htmlToSlate', () => {
it('should preserve spaces in rich html (GitHub Issue 3727)', () => {
const html = `<strong>Bold Text</strong><span><span> </span>regular text<span> </span></span>`;
const actual = htmlToSlate(html);
expect(actual).toEqual({
object: 'block',
type: 'root',
nodes: [
{
object: 'block',
type: 'paragraph',
nodes: [
{ object: 'text', text: 'Bold Text', marks: [{ type: 'bold' }] },
{ object: 'text', text: ' regular text' },
],
},
],
});
});
});