Skip to content

Remove extra linebreak from core Block and python PythonBlock components - #285

Open
bterlson wants to merge 2 commits into
alloy-framework:mainfrom
bterlson:block-closer
Open

Remove extra linebreak from core Block and python PythonBlock components#285
bterlson wants to merge 2 commits into
alloy-framework:mainfrom
bterlson:block-closer

Conversation

@bterlson

@bterlson bterlson commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @alloy-js/core
  • @alloy-js/python
Show changes

@alloy-js/core - feature ✏️

The <Block> component no longer emits an empty line when the closer prop is `false.

@alloy-js/python - feature ✏️

The <PythonBlock> component no longer emits an empty line after it. Use an explicit <hbr /> or <List doubleHardline> to recover the old formatting.

@jongio jongio left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design makes sense: distinguishing "no visible closer" (closer="") from "no closer AND no trailing break" (closer={false}) is a clean way to fix the extra blank lines Python blocks were emitting. Tests are thorough and the migration path is documented in the chronus changefiles.

Two small items below.

Note: this PR has merge conflicts with main that'll need resolving before merge.

* no closing punctuation will be added and there will be no trailing newline.
*/
closer?: string;
closer?: string | boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider narrowing this to string | false instead of string | boolean. Only alse has defined special semantics here (suppress trailing break + render nothing). Passing rue would silently produce no visible closer but still emit a trailing break, which is an odd state that's hard to distinguish from the default. string | false communicates intent more precisely and prevents accidental misuse.

- "@alloy-js/core"
---

The `<Block>` component no longer emits an empty line when the `closer` prop is `false. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: missing closing backtick after alse - should be alse with the closing tick.

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.

2 participants