Repository navigation
fix: list items keep class and style; anchors become ids (#344) - #363
Merged
Merged
Conversation
- core/list-item is built with the same class and style helpers as every other text block, so a className reaches the <li> on the page. - Every static block writes its anchor as the outer tag's id, and keeps it in the comment so later Saddle edits keep it. - edit-block with attrs only recomposes a paragraph, heading, list item, separator or spacer from its current text, so new classes, a drop cap or a heading level reach the markup. An id made in the editor is carried into the anchor first. Image, button and code keep their saved markup. Closes #344 Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # readme.txt
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #344
What
Blocks an AI app writes now carry their class, style and anchor on the page, not only in the block comment.
Why
On stage (page 264),
edit-blockwithattrs: {"className": "s-ico-shield"}reported success, but the<li>had no class and the step lost its icon. Ananchoron a group stayed in the comment and never became anid, so#works-withwent nowhere. Both also make the editor see the block as changed.How
core/list-itemusestag( 'li', classnames(), inline_style() ), like every other text block.anchor()helper putsid="…"on the outer tag of every static block Saddle composes (all of them support anchors exceptcore/html, which Saddle doesn't compose). The anchor also stays in the comment, so a later Saddle edit keeps it; the editor reads it from theid.edit-blockwith attrs only kept a leaf's saved markup, so a drop cap, heading level or class never reached the page. It now recomposes a paragraph, heading, list item, separator or spacer from its current text (inline markup kept). Image, button and code still keep their markup, because their content isn't plain inner text.idmade in the block editor (which leaves it out of the comment) is carried intoanchorbefore recomposing, so it isn't dropped.Testing
vendor/bin/phpunit: 1519 tests, 8701 assertions, 1 skipped (PHP 8.2)vendor/bin/phpcs: no new findingstests/blocks-test.php: list item class and style (leaf and nested), the edit-block path from the issue, anchor → id on group, heading, paragraph, list item, spacer, separator, button and image, anchor escaping, attrs-only drop cap and heading level with inline markup kept, an editor-made anchor surviving an attrs-only edit on a heading and a group.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.