Skip to content

Cannot read property 'end' of undefined in html with front matter #9042

@domoritz

Description

@domoritz

Prettier 2.0.5
Playground link

--parser html

Input:

---
layout: foo
---

Test <a href="https://prettier.io">abc</a>.

Output:

TypeError: Cannot read property 'end' of undefined
    at hasLeadingLineBreak (https://prettier.io/lib/standalone.js:21471:71)
    at hasSurroundingLineBreak (https://prettier.io/lib/standalone.js:21467:12)
    at preferHardlineAsTrailingSpaces (https://prettier.io/lib/standalone.js:21463:108)
    at preferHardlineAsLeadingSpaces (https://prettier.io/lib/standalone.js:21459:68)
    at printBetweenLine (https://prettier.io/lib/standalone.js:22701:155)
    at https://prettier.io/lib/standalone.js:22623:48
    at FastPath.map (https://prettier.io/lib/standalone.js:16730:23)
    at printChildren$1 (https://prettier.io/lib/standalone.js:22600:26)
    at Object.genericPrint$2 [as print] (https://prettier.io/lib/standalone.js:22491:41)
    at callPluginPrintFunction (https://prettier.io/lib/standalone.js:16921:20)

Expected behavior:
I would expect prettier to format the html file with yaml front matter.

Metadata

Metadata

Assignees

Labels

lang:htmlIssues affecting HTML (and SVG but not JSX)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions