chore: update prettier (#5412)
This commit is contained in:
committed by
GitHub
parent
46738492a0
commit
39f113715a
@ -40,10 +40,7 @@ describe.skip('slate', () => {
|
||||
);
|
||||
|
||||
function fn(editor) {
|
||||
editor
|
||||
.deleteBackward()
|
||||
.insertText('b')
|
||||
.setBlocks('heading-one');
|
||||
editor.deleteBackward().insertText('b').setBlocks('heading-one');
|
||||
}
|
||||
|
||||
const [actual, expected] = run(input, output, fn);
|
||||
|
@ -19,16 +19,10 @@ function ForceInsert({ defaultType }) {
|
||||
forceInsertBeforeNode(editor, node) {
|
||||
const block = { type: defaultType, object: 'block' };
|
||||
const parent = editor.value.document.getParent(node.key);
|
||||
return editor
|
||||
.insertNodeByKey(parent.key, 0, block)
|
||||
.moveToStartOfNode(parent)
|
||||
.focus();
|
||||
return editor.insertNodeByKey(parent.key, 0, block).moveToStartOfNode(parent).focus();
|
||||
},
|
||||
forceInsertAfterNode(editor, node) {
|
||||
return editor
|
||||
.moveToEndOfNode(node)
|
||||
.insertBlock(defaultType)
|
||||
.focus();
|
||||
return editor.moveToEndOfNode(node).insertBlock(defaultType).focus();
|
||||
},
|
||||
moveToEndOfDocument(editor) {
|
||||
const lastBlock = editor.value.document.nodes.last();
|
||||
|
@ -7,10 +7,7 @@ function LineBreak() {
|
||||
if (!isShiftEnter) {
|
||||
return next();
|
||||
}
|
||||
return editor
|
||||
.insertInline('break')
|
||||
.insertText('')
|
||||
.moveToStartOfNextText();
|
||||
return editor.insertInline('break').insertText('').moveToStartOfNextText();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -25,24 +25,7 @@ const skips = [
|
||||
{ number: 507, reason: 'Remark allows a space between link alt and url' },
|
||||
{
|
||||
number: [
|
||||
511,
|
||||
516,
|
||||
525,
|
||||
528,
|
||||
529,
|
||||
530,
|
||||
532,
|
||||
533,
|
||||
534,
|
||||
540,
|
||||
541,
|
||||
542,
|
||||
543,
|
||||
546,
|
||||
548,
|
||||
560,
|
||||
565,
|
||||
567,
|
||||
511, 516, 525, 528, 529, 530, 532, 533, 534, 540, 541, 542, 543, 546, 548, 560, 565, 567,
|
||||
],
|
||||
reason: 'we convert link references to standard links, but Remark also fails these',
|
||||
},
|
||||
@ -81,7 +64,7 @@ const parse = flow([markdownToSlate, slateToMarkdown]);
|
||||
* tests, of which we're passing about 300 as of introduction of this suite. To
|
||||
* work on improving Commonmark support, update __fixtures__/commonmarkExpected.json
|
||||
*/
|
||||
describe.skip('Commonmark support', function() {
|
||||
describe.skip('Commonmark support', function () {
|
||||
const specs =
|
||||
onlys.length > 0
|
||||
? commonmarkSpec.filter(({ number }) => onlys.includes(number))
|
||||
|
@ -23,8 +23,7 @@ describe('markdownToSlate', () => {
|
||||
},
|
||||
{
|
||||
object: 'text',
|
||||
text:
|
||||
'this_mark, and your charge is but a penny; tothisa penny more; and so on to the full glass—the Cape Horn measure, which you may gulp down for a shilling.\\n\\nUpon entering the place I found a number of young seamen gathered about a table, examining by a dim light divers specimens ofskrimshander',
|
||||
text: 'this_mark, and your charge is but a penny; tothisa penny more; and so on to the full glass—the Cape Horn measure, which you may gulp down for a shilling.\\n\\nUpon entering the place I found a number of young seamen gathered about a table, examining by a dim light divers specimens ofskrimshander',
|
||||
marks: [
|
||||
{
|
||||
type: 'italic',
|
||||
|
@ -3,10 +3,7 @@ import markdownToRemark from 'remark-parse';
|
||||
import remarkAllowHtmlEntities from '../remarkAllowHtmlEntities';
|
||||
|
||||
function process(markdown) {
|
||||
const mdast = unified()
|
||||
.use(markdownToRemark)
|
||||
.use(remarkAllowHtmlEntities)
|
||||
.parse(markdown);
|
||||
const mdast = unified().use(markdownToRemark).use(remarkAllowHtmlEntities).parse(markdown);
|
||||
|
||||
/**
|
||||
* The MDAST will look like:
|
||||
|
@ -4,9 +4,7 @@ import remarkEscapeMarkdownEntities from '../remarkEscapeMarkdownEntities';
|
||||
|
||||
function process(text) {
|
||||
const tree = u('root', [u('text', text)]);
|
||||
const escapedMdast = unified()
|
||||
.use(remarkEscapeMarkdownEntities)
|
||||
.runSync(tree);
|
||||
const escapedMdast = unified().use(remarkEscapeMarkdownEntities).runSync(tree);
|
||||
|
||||
return escapedMdast.children[0].value;
|
||||
}
|
||||
|
@ -12,10 +12,7 @@ function input(markdown) {
|
||||
}
|
||||
|
||||
function output(markdown) {
|
||||
return unified()
|
||||
.use(markdownToRemark)
|
||||
.use(remarkToMarkdown)
|
||||
.processSync(markdown).contents;
|
||||
return unified().use(markdownToRemark).use(remarkToMarkdown).processSync(markdown).contents;
|
||||
}
|
||||
|
||||
describe('remarkPaddedLinks', () => {
|
||||
|
@ -4,9 +4,7 @@ import remarkStripTrailingBreaks from '../remarkStripTrailingBreaks';
|
||||
|
||||
function process(children) {
|
||||
const tree = u('root', children);
|
||||
const strippedMdast = unified()
|
||||
.use(remarkStripTrailingBreaks)
|
||||
.runSync(tree);
|
||||
const strippedMdast = unified().use(remarkStripTrailingBreaks).runSync(tree);
|
||||
|
||||
return strippedMdast.children;
|
||||
}
|
||||
|
@ -72,9 +72,7 @@ export function markdownToRemark(markdown) {
|
||||
/**
|
||||
* Further transform the MDAST with plugins.
|
||||
*/
|
||||
const result = unified()
|
||||
.use(remarkSquashReferences)
|
||||
.runSync(parsed);
|
||||
const result = unified().use(remarkSquashReferences).runSync(parsed);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -173,9 +171,7 @@ export function markdownToHtml(markdown, { getAsset, resolveWidget } = {}) {
|
||||
* pastes.
|
||||
*/
|
||||
export function htmlToSlate(html) {
|
||||
const hast = unified()
|
||||
.use(htmlToRehype, { fragment: true })
|
||||
.parse(html);
|
||||
const hast = unified().use(htmlToRehype, { fragment: true }).parse(html);
|
||||
|
||||
const mdast = unified()
|
||||
.use(rehypePaperEmoji)
|
||||
|
@ -233,11 +233,8 @@ export default function slateToRemark(raw, { voidCodeBlock }) {
|
||||
const node = markNodes[0];
|
||||
convertedNodes.push(convertInlineNode(node, convertInlineAndTextChildren(node.nodes)));
|
||||
} else {
|
||||
const {
|
||||
leadingWhitespace,
|
||||
trailingWhitespace,
|
||||
centerNodes,
|
||||
} = normalizeFlankingWhitespace(markNodes);
|
||||
const { leadingWhitespace, trailingWhitespace, centerNodes } =
|
||||
normalizeFlankingWhitespace(markNodes);
|
||||
const children = convertInlineAndTextChildren(centerNodes);
|
||||
const markNode = u(markMap[markType], children);
|
||||
|
||||
|
Reference in New Issue
Block a user