Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/print/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D
* 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(node.data),
keepIfLonely: /\n\r?\s*\n\r?/.test((node.raw || node.data)),
};
}

Expand All @@ -108,7 +108,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 convienient instance of `line`.
*/
return fill(join(line, node.data.split(/[\t\n\f\r ]+/)).parts);
return fill(join(line, (node.raw || node.data).split(/[\t\n\f\r ]+/)).parts);
case 'Element':
case 'InlineComponent':
case 'Slot':
Expand Down Expand Up @@ -519,5 +519,5 @@ function isInlineNode(node: Node): boolean {
}

function isEmptyNode(node: Node): boolean {
return node.type === 'Text' && node.data.trim() === '';
return node.type === 'Text' && (node.raw || node.data).trim() === '';
}
1 change: 1 addition & 0 deletions src/print/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface ElementNode extends BaseNode {
export interface TextNode extends BaseNode {
type: 'Text';
data: string;
raw: string;
}

export interface MustacheTagNode extends BaseNode {
Expand Down