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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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' },
],
},
],
});
});
});

124
yarn.lock
View File

@ -4104,11 +4104,6 @@ array-includes@^3.0.3, array-includes@^3.1.1:
es-abstract "^1.17.0"
is-string "^1.0.5"
array-iterate@^1.0.0:
version "1.1.4"
resolved "https://registry.yarnpkg.com/array-iterate/-/array-iterate-1.1.4.tgz#add1522e9dd9749bb41152d08b845bd08d6af8b7"
integrity sha512-sNRaPGh9nnmdC8Zf+pT3UqP8rnWj5Hf9wiFGsX3wUQ2yVSIhO2ShFwCoceIPpB41QF6i2OEmrHmCo36xronCVA==
array-union@^1.0.1, array-union@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
@ -8906,14 +8901,6 @@ hast-util-has-property@^1.0.0:
resolved "https://registry.yarnpkg.com/hast-util-has-property/-/hast-util-has-property-1.0.4.tgz#9f137565fad6082524b382c1e7d7d33ca5059f36"
integrity sha512-ghHup2voGfgFoHMGnaLHOjbYFACKrRh9KFttdCzMCbFoBMJXiNi2+XTrPP8+q6cDJM/RSqlCfVWrjp1H201rZg==
hast-util-is-body-ok-link@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/hast-util-is-body-ok-link/-/hast-util-is-body-ok-link-1.0.3.tgz#752b16a7ebd6d73d35dde55c02742c934a1aa47b"
integrity sha512-NB8jW4iqT+iVld2oCjSk0T2S2FyR86rDZ7nKHx3WNf/WX16fjjdfoog6T+YeJFsPzszVKsNlVJL+k5c4asAHog==
dependencies:
hast-util-has-property "^1.0.0"
hast-util-is-element "^1.0.0"
hast-util-is-element@^1.0.0:
version "1.0.4"
resolved "https://registry.yarnpkg.com/hast-util-is-element/-/hast-util-is-element-1.0.4.tgz#059090a05cc02e275df1ad02caf8cb422fcd2e02"
@ -8956,27 +8943,33 @@ hast-util-to-html@^7.0.0:
unist-util-is "^4.0.0"
xtend "^4.0.0"
hast-util-to-mdast@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/hast-util-to-mdast/-/hast-util-to-mdast-4.0.0.tgz#835b0d75febc34d95d83cd0c72b349385768db8f"
integrity sha512-3mHEoA5UF0imbdSFR6hhKKzDLF4m5G4nlNziAYS7wdN0ySetgAZT/5moFjWaYfnxPnY/3Ml5li7/ika2cVL+qg==
hast-util-to-mdast@^7.0.0:
version "7.1.1"
resolved "https://registry.yarnpkg.com/hast-util-to-mdast/-/hast-util-to-mdast-7.1.1.tgz#1fc4440fc670273a1a7041584be08e5bb1d037ac"
integrity sha512-MXD6n7sxvmg1ntpugcGAE0AD+SrZWUqlJgLjYZr93697s3TWgsrs/PGXcgk/E7mvcj4q85tZy5grsMDKzmqBxA==
dependencies:
extend "^3.0.0"
hast-util-has-property "^1.0.0"
hast-util-is-element "^1.0.0"
hast-util-to-string "^1.0.0"
mdast-util-phrasing "^1.0.0"
mdast-util-to-string "^1.0.4"
rehype-minify-whitespace "^2.0.3"
hast-util-to-text "^2.0.0"
mdast-util-phrasing "^2.0.0"
mdast-util-to-string "^1.0.0"
rehype-minify-whitespace "^4.0.3"
repeat-string "^1.6.1"
trim-trailing-lines "^1.1.0"
unist-util-visit "^1.1.1"
unist-util-visit "^2.0.0"
xtend "^4.0.1"
hast-util-to-string@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/hast-util-to-string/-/hast-util-to-string-1.0.3.tgz#897d4bbd0dc7a9b0765a943a82fa38136277de1f"
integrity sha512-3lDgDE5OdpTfP3aFeKRWEwdIZ4vprztvp+AoD+RhF7uGOBs1yBDWZFadxnjcUV4KCoI3vB9A7gdFO98hEXA90w==
hast-util-to-text@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/hast-util-to-text/-/hast-util-to-text-2.0.0.tgz#c59afa8798145c10d40c2f34f92900f4dfc8ac69"
integrity sha512-idXqFGmKInLKcFMbLvh0fldmV94o+aOdXL/z5H5XhPhUp/5vzycu7i15c8V9kC6W3XgGHg2uuiIcRJlWtESVfQ==
dependencies:
hast-util-is-element "^1.0.0"
repeat-string "^1.0.0"
unist-util-find-after "^3.0.0"
hast-util-whitespace@^1.0.0:
hast-util-whitespace@^1.0.0, hast-util-whitespace@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-1.0.4.tgz#e4fe77c4a9ae1cb2e6c25e02df0043d0164f6e41"
integrity sha512-I5GTdSfhYfAPNztx2xJRQpG8cuDSNt599/7YUn7Gx/WxNMsG+a835k97TDkFgk123cwjfwINaZknkKkphx/f2A==
@ -9111,11 +9104,6 @@ html-webpack-plugin@^4.0.0-beta.2:
tapable "^1.1.3"
util.promisify "1.0.0"
html-whitespace-sensitive-tag-names@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/html-whitespace-sensitive-tag-names/-/html-whitespace-sensitive-tag-names-1.0.2.tgz#799324c6b1d8b4ada6af1d6d8e068abad79303fa"
integrity sha512-9jCcAq9ZsjUkZjNFDvxalDPhktOijpfzLyzBcqMLOFSbtcDNrPlKDvZeH7KdEbP7C6OjPpIdDMMPm0oq2Dpk0A==
htmlparser2@^3.10.0, htmlparser2@^3.3.0:
version "3.10.1"
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f"
@ -11424,12 +11412,12 @@ mdast-util-definitions@^1.2.0, mdast-util-definitions@^1.2.3:
dependencies:
unist-util-visit "^1.0.0"
mdast-util-phrasing@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/mdast-util-phrasing/-/mdast-util-phrasing-1.0.3.tgz#f71626caa78394a748a082ecae084de17af5520f"
integrity sha512-b1Ar28MjmPMMnTDUApnL1AUJY1L/KmBg5+iBLMd8/+0JqXh1sENow9+wj8Mp/SZBYtMlGRUQ1PkBWinPEDVeNQ==
mdast-util-phrasing@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/mdast-util-phrasing/-/mdast-util-phrasing-2.0.0.tgz#57e61f2be908be9f5fce54fcc2fa593687986267"
integrity sha512-G1rNlW/sViwzbBYD7+k3mKGtoWV2v4GBFky66OYHfktHe7Hg9R+hH4xpeoOtjYiwTvle8C8wlKMpgqPCkaeK8Q==
dependencies:
unist-util-is "^3.0.0"
unist-util-is "^4.0.0"
mdast-util-to-hast@^4.0.0:
version "4.0.0"
@ -11448,7 +11436,7 @@ mdast-util-to-hast@^4.0.0:
unist-util-visit "^1.1.0"
xtend "^4.0.1"
mdast-util-to-string@^1.0.4, mdast-util-to-string@^1.0.5:
mdast-util-to-string@^1.0.0, mdast-util-to-string@^1.0.5:
version "1.1.0"
resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz#27055500103f51637bd07d01da01eb1967a43527"
integrity sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==
@ -14642,19 +14630,16 @@ regjsparser@^0.6.4:
dependencies:
jsesc "~0.5.0"
rehype-minify-whitespace@^2.0.3:
version "2.0.4"
resolved "https://registry.yarnpkg.com/rehype-minify-whitespace/-/rehype-minify-whitespace-2.0.4.tgz#954bd07b42633566f198df12cb7d816cc3b793bd"
integrity sha512-TQVOvOSURaWNbYepVgSzUofSTRsaAVQe/dH01Mo44u+Gr221jTmUem8l0jlJBAfSOHNaUF4jfDDbyEeb4ueAmA==
rehype-minify-whitespace@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/rehype-minify-whitespace/-/rehype-minify-whitespace-4.0.3.tgz#8cd309f20669e25c7c1b7f33e457eabcb1c3e8ef"
integrity sha512-Iih7mVAJpSv3nNbpxgIKpxkJMfBljZDNW16zlMcADTyQR/WBnpvOGKSWFfw3DIxtYaYNStVNICfoH0Pba5hM1g==
dependencies:
collapse-white-space "^1.0.0"
hast-util-embedded "^1.0.0"
hast-util-has-property "^1.0.0"
hast-util-is-body-ok-link "^1.0.0"
hast-util-is-element "^1.0.0"
html-whitespace-sensitive-tag-names "^1.0.0"
unist-util-is "^3.0.0"
unist-util-modify-children "^1.0.0"
hast-util-whitespace "^1.0.4"
unist-util-is "^4.0.0"
rehype-parse@^6.0.0:
version "6.0.2"
@ -14665,12 +14650,12 @@ rehype-parse@^6.0.0:
parse5 "^5.0.0"
xtend "^4.0.0"
rehype-remark@^5.0.1:
version "5.0.2"
resolved "https://registry.yarnpkg.com/rehype-remark/-/rehype-remark-5.0.2.tgz#541d6e7bc11d98bac3536831fe052e52157228ce"
integrity sha512-ppbJ8cgFeB2uFugT8jaEifqo6qA+fcFAwnQ4DNWdXC2+Si7CMvGhreeflG8mTTNWVnFSP4xu04ZSZnubZiOpfw==
rehype-remark@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/rehype-remark/-/rehype-remark-8.0.0.tgz#66233e5b6e096419353f4c5c0fb6808f7924dd57"
integrity sha512-d1EmgsqWc1v9E/URuzozU8pa4AYHIcfOMLhgzQRHeaxYyMHJKIrpBMdRhl+IbqcHLD699Ho/vO+DpSZgKsGM8Q==
dependencies:
hast-util-to-mdast "^4.0.0"
hast-util-to-mdast "^7.0.0"
rehype-stringify@^5.0.0:
version "5.0.0"
@ -14780,7 +14765,7 @@ repeat-element@^1.1.2:
resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce"
integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==
repeat-string@^1.5.4, repeat-string@^1.6.1:
repeat-string@^1.0.0, repeat-string@^1.5.4, repeat-string@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"
integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc=
@ -17056,6 +17041,13 @@ unist-builder@^1.0.1, unist-builder@^1.0.3:
dependencies:
object-assign "^4.1.0"
unist-util-find-after@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/unist-util-find-after/-/unist-util-find-after-3.0.0.tgz#5c65fcebf64d4f8f496db46fa8fd0fbf354b43e6"
integrity sha512-ojlBqfsBftYXExNu3+hHLfJQ/X1jYY/9vdm4yZWjIbf0VuWF6CRufci1ZyoD/wV2TYMKxXUoNuoqwy+CkgzAiQ==
dependencies:
unist-util-is "^4.0.0"
unist-util-find-all-after@^1.0.2:
version "1.0.5"
resolved "https://registry.yarnpkg.com/unist-util-find-all-after/-/unist-util-find-all-after-1.0.5.tgz#5751a8608834f41d117ad9c577770c5f2f1b2899"
@ -17083,13 +17075,6 @@ unist-util-is@^4.0.0:
resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-4.0.2.tgz#c7d1341188aa9ce5b3cff538958de9895f14a5de"
integrity sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==
unist-util-modify-children@^1.0.0:
version "1.1.6"
resolved "https://registry.yarnpkg.com/unist-util-modify-children/-/unist-util-modify-children-1.1.6.tgz#1587130ca0ab5c56155fa60837ff524c3fbfbfaa"
integrity sha512-TOA6W9QLil+BrHqIZNR4o6IA5QwGOveMbnQxnWYq+7EFORx9vz/CHrtzF36zWrW61E2UKw7sM1KPtIgeceVwXw==
dependencies:
array-iterate "^1.0.0"
unist-util-position@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/unist-util-position/-/unist-util-position-3.1.0.tgz#1c42ee6301f8d52f47d14f62bbdb796571fa2d47"
@ -17121,13 +17106,30 @@ unist-util-visit-parents@^2.0.0, unist-util-visit-parents@^2.0.1:
dependencies:
unist-util-is "^3.0.0"
unist-util-visit@^1.0.0, unist-util-visit@^1.1.0, unist-util-visit@^1.1.1, unist-util-visit@^1.4.0:
unist-util-visit-parents@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-3.0.2.tgz#d4076af3011739c71d2ce99d05de37d545f4351d"
integrity sha512-yJEfuZtzFpQmg1OSCyS9M5NJRrln/9FbYosH3iW0MG402QbdbaB8ZESwUv9RO6nRfLAKvWcMxCwdLWOov36x/g==
dependencies:
"@types/unist" "^2.0.0"
unist-util-is "^4.0.0"
unist-util-visit@^1.0.0, unist-util-visit@^1.1.0, unist-util-visit@^1.4.0:
version "1.4.1"
resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.4.1.tgz#4724aaa8486e6ee6e26d7ff3c8685960d560b1e3"
integrity sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==
dependencies:
unist-util-visit-parents "^2.0.0"
unist-util-visit@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-2.0.2.tgz#3843782a517de3d2357b4c193b24af2d9366afb7"
integrity sha512-HoHNhGnKj6y+Sq+7ASo2zpVdfdRifhTgX2KTU3B/sO/TTlZchp7E3S4vjRzDJ7L60KmrCPsQkVK3lEF3cz36XQ==
dependencies:
"@types/unist" "^2.0.0"
unist-util-is "^4.0.0"
unist-util-visit-parents "^3.0.0"
universal-user-agent@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-4.0.1.tgz#fd8d6cb773a679a709e967ef8288a31fcc03e557"