diff --git a/changelog_unreleased/html/pr-7867.md b/changelog_unreleased/html/pr-7867.md new file mode 100644 index 000000000..bc58f2fe0 --- /dev/null +++ b/changelog_unreleased/html/pr-7867.md @@ -0,0 +1,23 @@ +#### Fix ignored empty inline element print ([#7867](https://github.com/prettier/prettier/pull/7867) by [@fisker](https://github.com/fisker)) + + +```html + + +_ + + + +_ + + + +_ + + + +_ +``` diff --git a/src/language-html/printer-html.js b/src/language-html/printer-html.js index 5451c1be5..721e07e7a 100644 --- a/src/language-html/printer-html.js +++ b/src/language-html/printer-html.js @@ -554,12 +554,13 @@ function printChildren(path, options, print) { ? hardline : softline : (needsToBorrowNextOpeningTagStartMarker(prevNode) && - /** - * 123 - */ - (nextNode.firstChild || + (hasPrettierIgnore(nextNode) || + /** + * 123 + */ + nextNode.firstChild || /** * 123456 +> ================================================================================ `; diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js index 3b8888a79..050aafe2d 100644 --- a/tests_config/run_spec.js +++ b/tests_config/run_spec.js @@ -34,7 +34,6 @@ const unstableTests = new Map( "html_angular/attributes.component.html", (options) => options.printWidth === 1, ], - "html_prettier_ignore/cases.html", "js_empty/semicolon.js", "jsx_ignore/jsx_ignore.js", "markdown_footnoteDefinition/multiline.md",