Skip to content

Conversation

@dyc3
Copy link
Contributor

@dyc3 dyc3 commented Nov 27, 2025

Summary

Prettier 3.7 changed how iframe allow attributes are formatted. Prettier also changes it's behavior for some other attributes, and this PR lays out some infra to help with that in future PRs.

See: https://prettier.io/blog/2025/11/27/3.7.0#change-17879

Test Plan

added snapshot test.

Docs

@changeset-bot
Copy link

changeset-bot bot commented Nov 27, 2025

🦋 Changeset detected

Latest commit: 22d6847

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added A-Core Area: core A-Parser Area: parser A-Formatter Area: formatter L-HTML Language: HTML and super languages labels Nov 27, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 27, 2025

CodSpeed Performance Report

Merging #8290 will not alter performance

Comparing dyc3/html-fmt-iframe-allow (22d6847) with main (2a229e4)1

Summary

✅ 58 untouched
⏩ 95 skipped2

Footnotes

  1. No successful run was found on main (893e36c) during the generation of this report, so 2a229e4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 95 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 51959 51959 0
Passed 50746 50746 0
Failed 1171 1171 0
Panics 42 42 0
Coverage 97.67% 97.67% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6323 6323 0
Passed 2106 2106 0
Failed 4217 4217 0
Panics 0 0 0
Coverage 33.31% 33.31% 0.00%

ts/babel

Test result main count This PR count Difference
Total 835 835 0
Passed 742 742 0
Failed 93 93 0
Panics 0 0 0
Coverage 88.86% 88.86% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18823 18823 0
Passed 14069 14069 0
Failed 4753 4753 0
Panics 1 1 0
Coverage 74.74% 74.74% 0.00%

Copy link
Contributor Author

dyc3 commented Nov 27, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Walkthrough

The pull request updates the HTML formatter to align with Prettier 3.7's handling of iframe allow attributes. Changes include modifying attribute formatting to support multi-line, indented blocks for specific attribute types, introducing configuration options for attribute initializer clause formatting, and extending the TokenText API with methods for splitting, trimming, and range operations. New helper methods were added to retrieve token text from attribute names and tag names, and a test file covers iframe allow attribute edge cases.

Suggested labels

A-Formatter, L-HTML, A-Tooling

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding special formatting handling for iframe allow attributes in HTML formatting.
Description check ✅ Passed The description is well-related to the changeset, explaining the motivation (Prettier 3.7 changes), the scope of infrastructure changes, and references the relevant changelog.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/html-fmt-iframe-allow

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 444d5c5 and 22d6847.

⛔ Files ignored due to path filters (1)
  • crates/biome_html_formatter/tests/specs/html/elements/iframe-allow.html.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (7)
  • .changeset/busy-zebras-begin.md (1 hunks)
  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs (2 hunks)
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs (2 hunks)
  • crates/biome_html_formatter/tests/specs/html/elements/iframe-allow.html (1 hunks)
  • crates/biome_html_syntax/src/attr_ext.rs (2 hunks)
  • crates/biome_html_syntax/src/element_ext.rs (2 hunks)
  • crates/biome_rowan/src/token_text.rs (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: Write changeset descriptions that are concise, use past tense for actions, use present tense for Biome behavior, and include code examples for new rules and formatter changes
Use only #### or ##### headers in changeset descriptions to avoid breaking the CHANGELOG and upstream tools

Files:

  • .changeset/busy-zebras-begin.md
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files using just format before committing

Files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
  • crates/biome_rowan/src/token_text.rs
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use the dbg!() macro for debugging in Rust code, and run tests with --show-output flag to see debug output

Files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
  • crates/biome_rowan/src/token_text.rs
🧠 Learnings (28)
📚 Learning: 2025-11-27T15:53:30.817Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T15:53:30.817Z
Learning: Applies to .changeset/*.md : Write changeset descriptions that are concise, use past tense for actions, use present tense for Biome behavior, and include code examples for new rules and formatter changes

Applied to files:

  • .changeset/busy-zebras-begin.md
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Define `FormatHtmlSyntaxNode` struct in a `cst.rs` file implementing `FormatRule<HtmlSyntaxNode>`, `AsFormat<HtmlFormatContext>`, and `IntoFormat<HtmlFormatContext>` traits using the provided boilerplate code

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
  • crates/biome_rowan/src/token_text.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
  • crates/biome_rowan/src/token_text.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Expose a public `format_node` function that accepts formatting options and a root syntax node, returning a `FormatResult<Formatted<Context>>` with appropriate documentation

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
📚 Learning: 2025-11-27T15:53:30.817Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T15:53:30.817Z
Learning: Applies to **/crates/biome_analyze/**/*.rs : Update inline rustdoc documentation for rules, assists, and their options when implementing new features or changes

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
  • crates/biome_rowan/src/token_text.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Create a new formatter crate using the command `just new-crate biome_<language>_formatter` where `<language>` is the target language (e.g., `biome_html_formatter` for HTML)

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Define a type alias `<Language>Formatter<'buf>` as `Formatter<'buf, <Language>FormatContext>` in the main formatter crate

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option fields should be wrapped in 'Option<_>' to properly track set and unset options during configuration merging

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'use_options' must follow a preceding configuration block marked with 'options' or 'full_options'

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Implement the `FormatNodeRule<N>` trait with `fmt_fields` as the only required method; default implementations of `fmt`, `is_suppressed`, `fmt_leading_comments`, `fmt_dangling_comments`, and `fmt_trailing_comments` are provided

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: The formatter foundation relies on using the generic `Format` trait and `FormatNode` for nodes, with creation of an intermediate IR via a series of helpers

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use the `dbg_write!` macro to debug formatter output instead of other logging methods

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Implement the `AsFormat<Context>` trait in `lib.rs` with generic implementations for references, `SyntaxResult`, and `Option` types as provided in the formatter boilerplate code

Applied to files:

  • crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs
📚 Learning: 2025-10-03T12:28:56.788Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7670
File: crates/biome_service/src/file_handlers/html.rs:744-748
Timestamp: 2025-10-03T12:28:56.788Z
Learning: In Biome's codebase, when creating tokens with new text content, use the factory pattern with functions like `ident(text)` from the respective `*_factory` crates (e.g., `biome_html_factory::make::ident`). There is no `.with_text()` method on tokens. The `ident()` function creates a new detached token with the IDENT kind, which is the standard approach for token construction.

Applied to files:

  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Implement a token source struct that wraps the lexer and implements `TokenSourceWithBufferedLexer` and `LexerWithCheckpoint` for lookahead and re-lexing capabilities

Applied to files:

  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
  • crates/biome_rowan/src/token_text.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`

Applied to files:

  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : All grammar nodes must start with the prefix of the language, e.g., `HtmlSimpleAttribute`

Applied to files:

  • crates/biome_html_syntax/src/attr_ext.rs
  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : When checking string values in rules, prefer using '&str' or 'TokenText' comparisons instead of calling 'to_string()' to avoid unnecessary heap allocations

Applied to files:

  • crates/biome_html_syntax/src/element_ext.rs
  • crates/biome_rowan/src/token_text.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new variant to `LanguageKind` enum in `language_kind.rs` file and implement all methods for the new language variant

Applied to files:

  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant

Applied to files:

  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule implementation should use 'Type Query = Ast<NodeType>' to query the AST/CST for specific node types

Applied to files:

  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead

Applied to files:

  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops

Applied to files:

  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported

Applied to files:

  • crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/lexer/mod.rs : Implement a `Lexer` trait from `biome_parser` crate for the lexer struct that consumes characters from source code and emits tokens

Applied to files:

  • crates/biome_rowan/src/token_text.rs
🧬 Code graph analysis (4)
crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs (5)
crates/biome_rowan/src/token_text.rs (4)
  • fmt (142-144)
  • fmt (148-150)
  • split (193-203)
  • trim_token (96-130)
crates/biome_html_formatter/src/html/auxiliary/attribute.rs (1)
  • with_options (31-35)
crates/biome_html_syntax/src/element_ext.rs (1)
  • value_token (294-299)
crates/biome_formatter/src/builders.rs (4)
  • soft_line_break_or_space (188-190)
  • soft_block_indent (1260-1265)
  • format_with (2304-2312)
  • located_token_text (358-371)
crates/biome_formatter/src/formatter.rs (1)
  • join_with (104-112)
crates/biome_html_syntax/src/attr_ext.rs (2)
crates/biome_html_syntax/src/lib.rs (1)
  • inner_string_text (120-129)
crates/biome_html_syntax/src/element_ext.rs (2)
  • token_text (211-213)
  • token_text_trimmed (216-220)
crates/biome_html_syntax/src/element_ext.rs (1)
crates/biome_html_syntax/src/attr_ext.rs (2)
  • token_text (38-40)
  • token_text_trimmed (43-47)
crates/biome_rowan/src/token_text.rs (2)
crates/biome_text_size/src/range.rs (5)
  • new (66-69)
  • start (143-145)
  • end (149-151)
  • at (87-94)
  • len (155-160)
crates/biome_rowan/src/text.rs (2)
  • text (204-212)
  • len (309-311)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Parser conformance
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Documentation
  • GitHub Check: autofix
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: End-to-end tests
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Bench (biome_tailwind_parser)
  • GitHub Check: Bench (biome_configuration)
🔇 Additional comments (13)
crates/biome_html_syntax/src/attr_ext.rs (1)

36-48: LGTM! Clean API addition.

The new token text accessors follow the same pattern as HtmlTagName and provide a consistent API for retrieving token text. The delegation to value_token() is appropriate.

crates/biome_html_syntax/src/element_ext.rs (1)

209-221: LGTM! Consistent with attribute name API.

The implementation mirrors HtmlAttributeName::token_text() and HtmlAttributeName::token_text_trimmed(), providing a consistent API surface across tag names and attribute names.

crates/biome_rowan/src/token_text.rs (5)

60-71: LGTM! Useful range utilities.

The relative_range() and source_range() methods provide clean abstractions for working with token text ranges. The arithmetic in source_range() correctly translates relative positions to absolute source positions.


88-130: LGTM! Solid whitespace trimming implementation.

The Unicode-aware trimming using char::is_whitespace() is correct, and the clamping logic properly handles the all-whitespace edge case. The zero-allocation approach via range slicing is efficient.


221-229: Good defensive handling of empty pattern.

Treating empty patterns as no-op (returning None) avoids infinite splitting behaviour, which is sensible. This differs from Rust's standard library (which yields individual characters), but is appropriate for this use case.


239-266: LGTM! Iterator implementation is correct.

The state machine properly handles:

  • Match found: yield substring, advance past delimiter
  • No match: yield remaining, set finished
  • Already finished: return None

The range arithmetic correctly maintains the slice boundaries.


268-389: Excellent test coverage.

The tests thoroughly cover edge cases including adjacent delimiters, empty strings, whitespace-only content, and iterator exhaustion. The test names clearly document the expected behaviour.

.changeset/busy-zebras-begin.md (1)

1-19: Changeset looks good.

The description is concise, uses past tense appropriately, and the diff example clearly demonstrates the formatting change. Well done.

crates/biome_html_formatter/tests/specs/html/elements/iframe-allow.html (1)

1-19: Comprehensive test coverage.

Excellent variety of test cases covering edge cases (empty, whitespace-only, multiple semicolons) and real-world scenarios (long URLs, complex permissions). The non-iframe anchor tag test confirms the formatting is correctly scoped to iframe elements only.

crates/biome_html_formatter/src/html/auxiliary/attribute.rs (1)

42-66: Clean refactoring to support options-based formatting.

The two-step approach (format name, then conditionally format initializer with options) is well-structured. Deriving tag_name and attribute_name from the token text enables context-aware formatting decisions downstream.

crates/biome_html_formatter/src/html/auxiliary/attribute_initializer_clause.rs (3)

8-35: LGTM! Standard options pattern.

The struct and options definitions follow Biome's established pattern for FormatRuleWithOptions. The fields are appropriately documented.


63-100: Special formatting implementation looks solid.

The iframe allow formatting correctly:

  • Splits on semicolons and trims whitespace
  • Filters empty items
  • Uses located_token_text() to preserve source ranges
  • Employs soft breaking with group(&soft_block_indent(...))
  • Adds conditional trailing semicolon via if_group_breaks

The use of format_removed(&value_token) properly marks the original token as removed before emitting the reformatted version.


45-108: Well-structured conditional formatting.

The three-tier logic is clear:

  1. If string value on iframe allow → special formatting
  2. If string value but different tag/attribute → default formatting
  3. If non-string value → default formatting

This preserves existing behaviour for all other cases whilst enabling the new iframe allow formatting.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Comment @coderabbitai help to get the list of available commands and usage tips.

@dyc3 dyc3 requested review from a team November 27, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Core Area: core A-Formatter Area: formatter A-Parser Area: parser L-HTML Language: HTML and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants