Skip to content

fix(ansi): don't add a blank line before a leading reference link - #586

Open
larrasket wants to merge 1 commit into
charmbracelet:mainfrom
larrasket:fix/reference-link-leading-blank
Open

fix(ansi): don't add a blank line before a leading reference link#586
larrasket wants to merge 1 commit into
charmbracelet:mainfrom
larrasket:fix/reference-link-leading-blank

Conversation

@larrasket

Copy link
Copy Markdown

Fixes #304
Skip empty text blocks when deciding whether a node is the first rendered child, so a leading reference definition no longer changes the output.

  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features).

A link reference definition at the top of a document (for example
"[id]: https://example.com" before the first heading) leaves an empty text
block as the document's first child. That made the first heading or
paragraph compute First=false and emit a leading newline, so the rendered
output started with a stray blank line.

Skip empty text blocks when deciding whether a node is the first rendered
child, so a leading reference definition no longer changes the output.

Fixes charmbracelet#304
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reference-style links above document add line break

1 participant