From 88d31b5db083ee0b58b9fd1155e0b67fba35e8eb Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Mon, 9 Nov 2020 10:31:50 +0100 Subject: [PATCH] WIP children tags rework Goals: - switch logic around: prepare nodes before printing docs, try to avoid modifying printed result - respect user's wish to have line breaks #143 #117 - generally try to be more in line with how prettier formats things TODO: - either get tag break logic on par with prettier (breaking > into new lines etc) or adjust tests - more readable tag breaking logic for multiple children tags - tidy up --- src/print/doc-helpers.ts | 51 +-- src/print/helpers.ts | 10 + src/print/index.ts | 372 ++++++++---------- src/print/node-helpers.ts | 53 ++- src/print/nodes.ts | 6 + .../input.html | 8 + .../output.html | 6 + .../output.html | 6 +- .../samples/prettier-ignore-nested.html | 8 +- 9 files changed, 280 insertions(+), 240 deletions(-) diff --git a/src/print/doc-helpers.ts b/src/print/doc-helpers.ts index 662a4609..73130cca 100644 --- a/src/print/doc-helpers.ts +++ b/src/print/doc-helpers.ts @@ -1,42 +1,43 @@ import { Doc, doc } from 'prettier'; +import { findLastIndex } from './helpers'; -export function isLine(doc: Doc) { - return typeof doc === 'object' && doc.type === 'line' -} +export function isLine(doc: Doc) { + return typeof doc === 'object' && doc.type === 'line'; +} export function isLineDiscardedIfLonely(doc: Doc) { - return isLine(doc) && !(doc as doc.builders.Line).keepIfLonely + return isLine(doc) && !(doc as doc.builders.Line).keepIfLonely; } /** * Check if the doc is empty, i.e. consists of nothing more than empty strings (possibly nested). */ export function isEmptyDoc(doc: Doc): boolean { - if (typeof doc === 'string') { - return doc.length === 0; - } + if (typeof doc === 'string') { + return doc.length === 0; + } - if (doc.type === 'line') { - return !doc.keepIfLonely; - } + if (doc.type === 'line') { + return !doc.keepIfLonely; + } - const { contents } = doc as { contents?: Doc }; + const { contents } = doc as { contents?: Doc }; - if (contents) { - return isEmptyDoc(contents); - } + if (contents) { + return isEmptyDoc(contents); + } - const { parts } = doc as { parts?: Doc[] }; + const { parts } = doc as { parts?: Doc[] }; - if (parts) { - return isEmptyGroup(parts); - } + if (parts) { + return isEmptyGroup(parts); + } - return false; + return false; } export function isEmptyGroup(group: Doc[]): boolean { - return !group.find(doc => !isEmptyDoc(doc)) + return !group.find((doc) => !isEmptyDoc(doc)); } /** @@ -95,13 +96,3 @@ function getParts(doc: Doc): Doc[] | undefined { return doc.parts; } } - -function findLastIndex(isMatch: (item: T) => boolean, items: T[]) { - for (let i = items.length - 1; i >= 0; i--) { - if (isMatch(items[i])) { - return i; - } - } - - return -1; -} diff --git a/src/print/helpers.ts b/src/print/helpers.ts index ec326e40..ce6854ba 100644 --- a/src/print/helpers.ts +++ b/src/print/helpers.ts @@ -23,3 +23,13 @@ export function isPreTagContent(path: FastPath): boolean { export function flatten(arrays: T[][]): T[] { return ([] as T[]).concat.apply([], arrays); } + +export function findLastIndex(isMatch: (item: T) => boolean, items: T[]) { + for (let i = items.length - 1; i >= 0; i--) { + if (isMatch(items[i])) { + return i; + } + } + + return -1; +} diff --git a/src/print/index.ts b/src/print/index.ts index 8ae032c9..97bfa26a 100644 --- a/src/print/index.ts +++ b/src/print/index.ts @@ -1,33 +1,28 @@ -import { FastPath, Doc, doc, ParserOptions } from 'prettier'; -import { Node, IfBlockNode, AttributeNode } from './nodes'; -import { isASTNode, isPreTagContent, flatten } from './helpers'; +import { Doc, doc, FastPath, ParserOptions } from 'prettier'; +import { formattableAttributes, selfClosingTags } from '../lib/elements'; import { extractAttributes } from '../lib/extractAttributes'; import { getText } from '../lib/getText'; -import { parseSortOrder, SortOrderPart } from '../options'; import { hasSnippedContent, unsnipContent } from '../lib/snipTagContent'; -import { selfClosingTags, formattableAttributes } from '../lib/elements'; +import { parseSortOrder, SortOrderPart } from '../options'; +import { isLine, trim } from './doc-helpers'; +import { flatten, isASTNode, isPreTagContent } from './helpers'; import { - canBreakBefore, - canBreakAfter, - isInlineElement, - isInlineNode, + doesEmbedStartAt, + getUnencodedText, isEmptyNode, - printRaw, - isNodeSupportedLanguage, + isIgnoreDirective, + isInlineElement, isLoneMustacheTag, + isNodeSupportedLanguage, isOrCanBeConvertedToShorthand, - isIgnoreDirective, - doesEmbedStartAt, - getUnencodedText, + isTextNodeEndingWithLinebreak, + isTextNodeStartingWithLinebreak, + printRaw, + trimChildren, + trimTextNodeLeft, + trimTextNodeRight, } from './node-helpers'; -import { - isLine, - isLineDiscardedIfLonely, - trim, - trimLeft, - trimRight, - isEmptyDoc, -} from './doc-helpers'; +import { AttributeNode, ElementType, IfBlockNode, Node, TextNode } from './nodes'; const { concat, @@ -57,8 +52,6 @@ declare module 'prettier' { let ignoreNext = false; -const keepIfLonelyLine = { ...line, keepIfLonely: true, hard: true }; - export function print(path: FastPath, options: ParserOptions, print: PrintFn): Doc { const n = path.getValue(); if (!n) { @@ -121,34 +114,38 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D if (children.length === 0 || children.every(isEmptyNode)) { return ''; } - if (!isPreTagContent(path)) { - return concat([...trim(printChildren(path, print), isLine), hardline]); + trimChildren(node.children, path); + return concat([ + ...trim( + [printChildren2('inlineEl', path, print, options)], + (n) => isLine(n) || (typeof n === 'string' && n.trim() === ''), + ), + hardline, + ]); } else { - return concat(printChildren(path, print)); + return printChildren2('inlineEl', path, print, options); } case 'Text': if (!isPreTagContent(path)) { if (isEmptyNode(node)) { - return { - /** - * Empty (whitespace-only) text nodes are collapsed into a single `line`, - * which will be rendered as a single space if this node's group fits on a - * single line. This follows how vanilla HTML is handled both by browsers and - * by Prettier core. - */ - ...line, - - /** - * A text node is considered lonely if it is in a group without other inline - * elements, such as the line breaks between otherwise consecutive HTML tags. - * Text nodes that are both empty and lonely are discarded unless they have at - * least one empty line (i.e. at least two linebreak sequences). This is to - * allow for flexible grouping of HTML tags in a particular indentation level, - * and is similar to how vanilla HTML is handled in Prettier core. - */ - keepIfLonely: /\n\r?\s*\n\r?/.test(getUnencodedText(node)), - }; + if (node.isFirstInsideParent || node.isLastInsideParent) { + return ''; // correct handling done by parent already + } + const hasWhiteSpace = + getUnencodedText(node).trim().length < getUnencodedText(node).length; + const hasOneOrMoreNewlines = /\n/.test(getUnencodedText(node)); + const hasTwoOrMoreNewlines = /\n\r?\s*\n\r?/.test(getUnencodedText(node)); + if (node.isBetweenTags && hasTwoOrMoreNewlines) { + return concat([hardline, hardline]); + } + if (hasOneOrMoreNewlines) { + return hardline; + } + if (hasWhiteSpace) { + return line; + } + return node.parentType === 'inlineEl' ? '' : softline; } /** @@ -157,7 +154,7 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D * until this node's current line is out of room, at which `fill` will break at the * most convenient instance of `line`. */ - return fill(splitTextToDocs(getUnencodedText(node))); + return fill(splitTextToDocs(node)); } else { return getUnencodedText(node); } @@ -187,9 +184,9 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D } else if (!isSupportedLanguage) { body = printRaw(node, options.originalText); } else if (isInlineElement(node) || isPreTagContent(path)) { - body = printIndentedPreservingWhitespace(path, print); + body = printChildren2('inlineEl', path, print, options); } else { - body = printIndentedWithNewlines(path, print); + body = printChildren2('blockEl', path, print, options); } return group( @@ -272,7 +269,7 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D '{#if ', printJS(path, print, 'expression'), '}', - printIndentedWithNewlines(path, print), + printChildren2('svelteExpr', path, print, options), ]; if (node.else) { @@ -297,7 +294,10 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D '{:else if ', path.map((ifPath) => printJS(path, print, 'expression'), 'children')[0], '}', - path.map((ifPath) => printIndentedWithNewlines(ifPath, print), 'children')[0], + path.map( + (ifPath) => printChildren2('svelteExpr', ifPath, print, options), + 'children', + )[0], ]; if (ifNode.else) { @@ -306,7 +306,7 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D return group(concat(def)); } - return group(concat(['{:else}', printIndentedWithNewlines(path, print)])); + return group(concat(['{:else}', printChildren2('svelteExpr', path, print, options)])); } case 'EachBlock': { const def: Doc[] = [ @@ -324,7 +324,7 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D def.push(' (', printJS(path, print, 'key'), ')'); } - def.push('}', printIndentedWithNewlines(path, print)); + def.push('}', printChildren2('svelteExpr', path, print, options)); if (node.else) { def.push(path.call(print, 'else')); @@ -352,19 +352,19 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D '}', ]), ), - indent(path.call(print, 'then')), + path.call(print, 'then'), ); } else { block.push(group(concat(['{#await ', printJS(path, print, 'expression'), '}']))); if (hasPendingBlock) { - block.push(indent(path.call(print, 'pending'))); + block.push(path.call(print, 'pending')); } if (hasThenBlock) { block.push( group(concat(['{:then', expandNode(node.value), '}'])), - indent(path.call(print, 'then')), + path.call(print, 'then'), ); } } @@ -372,7 +372,7 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D if (hasCatchBlock) { block.push( group(concat(['{:catch', expandNode(node.error), '}'])), - indent(path.call(print, 'catch')), + path.call(print, 'catch'), ); } @@ -385,7 +385,7 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D '{#key ', printJS(path, print, 'expression'), '}', - printIndentedWithNewlines(path, print), + printChildren2('svelteExpr', path, print, options), ]; def.push('{/key}'); @@ -395,11 +395,7 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D case 'ThenBlock': case 'PendingBlock': case 'CatchBlock': - return concat([ - softline, - ...trim(printChildren(path, print), isLine), - dedent(softline), - ]); + return printChildren2('svelteExpr', path, print, options); case 'EventHandler': return concat([ line, @@ -530,174 +526,152 @@ function printAttributeNodeValue( } } -function printChildren(path: FastPath, print: PrintFn): Doc[] { - let childDocs: Doc[] = []; - let currentGroup: { doc: Doc; node: Node }[] = []; - // the index of the last child doc we could add a linebreak after - let lastBreakIndex = -1; - - const isPreformat = isPreTagContent(path); - - /** - * Call when reaching a point where a linebreak is possible. Will - * put all `childDocs` since the last possible linebreak position - * into a `concat` to avoid them breaking. - */ - function linebreakPossible() { - if (lastBreakIndex >= 0 && lastBreakIndex < childDocs.length - 1) { - childDocs = childDocs - .slice(0, lastBreakIndex) - .concat(concat(childDocs.slice(lastBreakIndex))); - } - - lastBreakIndex = -1; +function printChildren2( + elementType: ElementType, + path: FastPath, + print: PrintFn, + options: ParserOptions, +): Doc { + // Rules: + // Parent is SvelteBlock: + // - if newline at start or end + // -> newlines at start/end + // Parent is Block: + // - if newline at start or end + // -> newlines at start/end. trim rest at start/end + // -> else trim all whitespaces at start/end + do softline + // - if has more than one child + // -> break into new lines according to whitespace sensitivity + // Parent is InlineBlock: + // - if newline at start and end + // -> newlines at start/end. trim rest at start/end. + // -> else trim all whitespace except one at start/end -> line or nothing + // All Text: + // - if a child and followed/preceeded by non-text, keep at most two newlines + + if (isPreTagContent(path)) { + return concat(path.map(print, 'children')); } - /** - * Add a document to the output. - * @param childDoc undefined means do not add anything but allow for the possibility of a linebreak here. - * @param fromNode the Node the doc was generated from. undefined if childDoc is undefined. - */ - function outputChildDoc(childDoc?: Doc, fromNode?: Node) { - if (!isPreformat) { - if (!childDoc || !fromNode || canBreakBefore(fromNode)) { - linebreakPossible(); - - const lastChild = childDocs[childDocs.length - 1]; - - // separate children by softlines, but not if the children are already lines. - // one exception: allow for a line break before "keepIfLonely" lines because they represent an empty line - if ( - childDoc != null && - !isLineDiscardedIfLonely(childDoc) && - lastChild != null && - !isLine(lastChild) - ) { - childDocs.push(softline); - } - } + const children: Node[] = path.getValue().children; + if (children.length === 0) { + return ''; + } - if (lastBreakIndex < 0 && childDoc && fromNode && !canBreakAfter(fromNode)) { - lastBreakIndex = childDocs.length; - } + children.forEach((child: any) => (child.parentElType = elementType)); + children.slice(1, -1).forEach((child) => { + if (child.type === 'Text') { + child.isBetweenTags = true; } + }); - if (childDoc) { - childDocs.push(childDoc); - } - } + const hasOnlyTextAndMoustacheChildren = children.every( + (child) => child.type === 'Text' || child.type === 'MustacheTag', + ); + const firstChild = children[0]; + const lastChild = children[children.length - 1]; - function lastChildDocProduced() { - // line breaks are ok after last child - outputChildDoc(); + if (firstChild.type === 'Text') { + firstChild.isFirstInsideParent = true; + } + if (lastChild.type === 'Text') { + lastChild.isLastInsideParent = true; } - /** - * Sequences of inline nodes (currently, `TextNode`s and `MustacheTag`s) are collected into - * groups and printed as a single `Fill` doc so that linebreaks as a result of sibling block - * nodes (currently, all HTML elements) don't cause those inline sequences to break - * prematurely. This is particularly important for whitespace sensitivity, as it is often - * desired to have text directly wrapping a mustache tag without additional whitespace. - */ - function flush() { - for (let { doc, node } of currentGroup) { - for (const childDoc of extractOutermostNewlines(doc)) { - outputChildDoc(childDoc, node); + if (elementType === 'svelteExpr') { + // Is a {#if/each/await/key} block + const parentOpeningEnd = options.originalText.lastIndexOf('}', children[0].start); + let line: Doc = softline; + if (parentOpeningEnd > 0 && firstChild.start > parentOpeningEnd + 1) { + const textBetween = options.originalText.substring( + parentOpeningEnd + 1, + firstChild.start, + ); + if (textBetween.trim() === '') { + line = hardline; } } - - currentGroup = []; + if (isTextNodeStartingWithLinebreak(firstChild)) { + trimTextNodeLeft(firstChild); + line = hardline; + } + if (isTextNodeEndingWithLinebreak(lastChild)) { + trimTextNodeRight(lastChild); + line = hardline; + } + return concat([ + indent(concat([line, group(concat(trim(path.map(print, 'children'), isLine)))])), + line, + ]); } - path.each((childPath) => { - const childNode = childPath.getValue() as Node; - const childDoc = childPath.call(print); - - if (isInlineNode(childNode)) { - currentGroup.push({ doc: childDoc, node: childNode }); + if (elementType === 'blockEl') { + let line: Doc = softline; + if (firstChild === lastChild && firstChild.type === 'Text') { + trimTextNodeLeft(firstChild); + trimTextNodeRight(firstChild); } else { - flush(); - - if (childDoc !== '') { - outputChildDoc( - isLine(childDoc) ? childDoc : concat([breakParent, childDoc]), - childNode, - ); + if (isTextNodeStartingWithLinebreak(firstChild)) { + trimTextNodeLeft(firstChild); + line = hardline; + } + if (isTextNodeEndingWithLinebreak(lastChild)) { + trimTextNodeRight(lastChild); } } - }, 'children'); - - flush(); - lastChildDocProduced(); - - return childDocs; -} - -/** - * Print the nodes in `path` indented and with leading and trailing newlines. - */ -function printIndentedWithNewlines(path: FastPath, print: PrintFn): Doc { - return indent( - concat([softline, ...trim(printChildren(path, print), isLine), dedent(softline)]), - ); -} -/** - * Print the nodes in `path` indented but without adding any leading or trailing newlines. - */ -function printIndentedPreservingWhitespace(path: FastPath, print: PrintFn) { - return indent(concat(dedentFinalNewline(printChildren(path, print)))); + return concat([ + indent( + concat([ + line, + ...path.map(print, 'children'), + // TODO not that simple unfortunately: only break around block elements when there's more than one + // hasOnlyTextAndMoustacheChildren ? '' : breakParent, + ]), + ), + line, + ]); + } else { + if ( + firstChild !== lastChild && + isTextNodeStartingWithLinebreak(firstChild) && + isTextNodeEndingWithLinebreak(lastChild) + ) { + trimTextNodeLeft(firstChild); + trimTextNodeRight(lastChild); + return concat([indent(concat([hardline, ...path.map(print, 'children')])), hardline]); + } + return concat(path.map(print, 'children')); + } } /** * Split the text into words separated by whitespace. Replace the whitespaces by lines, * collapsing multiple whitespaces into a single line. * - * If the text starts or ends with multiple newlines, those newlines should be "keepIfLonely" - * since we want double newlines in the output. + * If the text starts or ends with multiple newlines, two of those should be kept. */ -function splitTextToDocs(text: string): Doc[] { +function splitTextToDocs(node: TextNode): Doc[] { + const text = getUnencodedText(node); let docs: Doc[] = text.split(/[\t\n\f\r ]+/); docs = join(line, docs).parts.filter((s) => s !== ''); - // if the text starts with two newlines, the first doc is already a newline. make it "keepIfLonely" - if (text.match(/^([\t\f\r ]*\n){2}/)) { - docs[0] = keepIfLonelyLine; + if (text.match(/^([\t\f\r ]*\n)/)) { + docs[0] = hardline; } - - // if the text ends with two newlines, the last doc is already a newline. make it "keepIfLonely" - if (text.match(/(\n[\t\f\r ]*){2}$/)) { - docs[docs.length - 1] = keepIfLonelyLine; + if (text.match(/^([\t\f\r ]*\n){2}/) && (node.isBetweenTags || node.isLastInsideParent)) { + docs = [hardline, ...docs]; } - return docs; -} - -/** - * If there is a trailing newline, pull it out and put it inside a `dedent`. This is used - * when we want to preserve whitespace, but still indent the newline if there is one - * (e.g. for `1\n` the `` will be on its own line; for `1` it can't - * because it would introduce new whitespace) - */ -function dedentFinalNewline(docs: Doc[]): Doc[] { - const trimmedRight = trimRight(docs, isLine); - - if (trimmedRight) { - return [...docs, dedent(trimmedRight[trimmedRight.length - 1])]; - } else { - return docs; + if (text.match(/(\n[\t\f\r ]*)$/)) { + docs[docs.length - 1] = hardline; + } + if (text.match(/(\n[\t\f\r ]*){2}$/) && node.isBetweenTags) { + docs = [...docs, hardline]; } -} - -/** - * Pull out any nested leading or trailing lines and put them at the top level. - */ -function extractOutermostNewlines(doc: Doc): Doc[] { - const leadingLines: Doc[] = trimLeft([doc], isLine) || []; - const trailingLines: Doc[] = trimRight([doc], isLine) || []; - return [...leadingLines, ...(!isEmptyDoc(doc) ? [doc] : ([] as Doc[])), ...trailingLines]; + return docs; } function printJS(path: FastPath, print: PrintFn, name?: string) { diff --git a/src/print/node-helpers.ts b/src/print/node-helpers.ts index 7252dae3..0c47b7c2 100644 --- a/src/print/node-helpers.ts +++ b/src/print/node-helpers.ts @@ -13,7 +13,7 @@ import { } from './nodes'; import { inlineElements, TagName } from '../lib/elements'; import { FastPath } from 'prettier'; -import { isASTNode } from './helpers'; +import { findLastIndex, isASTNode } from './helpers'; const unsupportedLanguages = ['coffee', 'coffeescript', 'pug', 'styl', 'stylus', 'sass']; @@ -106,7 +106,7 @@ export function doesEmbedStartAt(position: number, path: FastPath) { return embeds.find((n) => n && n.start === position) != null; } -export function isEmptyNode(node: Node): boolean { +export function isEmptyNode(node: Node): node is TextNode { return node.type === 'Text' && getUnencodedText(node).trim() === ''; } @@ -204,3 +204,52 @@ export function getUnencodedText(node: TextNode) { // `raw` will contain HTML entities in unencoded form return node.raw || node.data; } + +export function isTextNodeStartingWithLinebreak(node: Node): node is TextNode { + return node.type === 'Text' && /^\s*\n/.test(getUnencodedText(node)); +} + +export function isTextNodeEndingWithLinebreak(node: Node): node is TextNode { + return node.type === 'Text' && /\s*\n\s*$/.test(getUnencodedText(node)); +} + +export function trimTextNodeRight(node: TextNode): void { + node.raw = node.raw && node.raw.trimRight(); + node.data = node.data && node.data.trimRight(); +} + +export function trimTextNodeLeft(node: TextNode): void { + node.raw = node.raw && node.raw.trimLeft(); + node.data = node.data && node.data.trimLeft(); +} + +/** + * Remove all leading whitespace up until the first non-empty text node, + * and all trailing whitepsace from the last non-empty text node onwards. + */ +export function trimChildren(children: Node[], path: FastPath): void { + let firstNonEmptyNode = children.findIndex( + (n) => !isEmptyNode(n) && !doesEmbedStartAt(n.end, path), + ); + firstNonEmptyNode = firstNonEmptyNode === -1 ? children.length - 1 : firstNonEmptyNode; + + let lastNonEmptyNode = findLastIndex( + (n) => !isEmptyNode(n) && !doesEmbedStartAt(n.end, path), + children, + ); + lastNonEmptyNode = lastNonEmptyNode === -1 ? 0 : lastNonEmptyNode; + + for (let i = 0; i <= firstNonEmptyNode; i++) { + const n = children[i]; + if (n.type === 'Text') { + trimTextNodeLeft(n); + } + } + + for (let i = children.length - 1; i >= lastNonEmptyNode; i--) { + const n = children[i]; + if (n.type === 'Text') { + trimTextNodeRight(n); + } + } +} diff --git a/src/print/nodes.ts b/src/print/nodes.ts index 38861eff..8999d3d8 100644 --- a/src/print/nodes.ts +++ b/src/print/nodes.ts @@ -1,6 +1,9 @@ +export type ElementType = 'blockEl' | 'inlineEl' | 'svelteExpr'; + export interface BaseNode { start: number; end: number; + parentType?: ElementType; isJS?: boolean; } @@ -20,6 +23,9 @@ export interface TextNode extends BaseNode { type: 'Text'; data: string; raw: string; + isBetweenTags?: boolean; + isFirstInsideParent?: boolean; + isLastInsideParent?: boolean; } export interface MustacheTagNode extends BaseNode { diff --git a/test/formatting/samples/inline-element-with-children-ws/input.html b/test/formatting/samples/inline-element-with-children-ws/input.html index 13b0fa72..b33733ba 100644 --- a/test/formatting/samples/inline-element-with-children-ws/input.html +++ b/test/formatting/samples/inline-element-with-children-ws/input.html @@ -4,4 +4,12 @@ + + + + Foo + + + + \ No newline at end of file diff --git a/test/formatting/samples/inline-element-with-children-ws/output.html b/test/formatting/samples/inline-element-with-children-ws/output.html index 2e6a55c1..10ae26bc 100644 --- a/test/formatting/samples/inline-element-with-children-ws/output.html +++ b/test/formatting/samples/inline-element-with-children-ws/output.html @@ -1,3 +1,9 @@ + + Foo + + + + Foo diff --git a/test/formatting/samples/no-html-whitespace-inside-inline-element/output.html b/test/formatting/samples/no-html-whitespace-inside-inline-element/output.html index 90ab3551..e2e76717 100644 --- a/test/formatting/samples/no-html-whitespace-inside-inline-element/output.html +++ b/test/formatting/samples/no-html-whitespace-inside-inline-element/output.html @@ -1,8 +1,4 @@

- Apples, - Orange, - Bananas, - Pineapples, - Grapefruit, + Apples, Orange, Bananas, Pineapples, Grapefruit, Kiwi

diff --git a/test/printer/samples/prettier-ignore-nested.html b/test/printer/samples/prettier-ignore-nested.html index 58a833ab..e862ac43 100644 --- a/test/printer/samples/prettier-ignore-nested.html +++ b/test/printer/samples/prettier-ignore-nested.html @@ -1,8 +1,8 @@
- + d + d +