Docs: shortcode transforms with wrapped content + rawHandler JSDoc#78003
Conversation
|
Size Change: 0 B Total Size: 7.95 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 47b0fe5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25430203245
|
kadamwhite
left a comment
There was a problem hiding this comment.
@Mamaduka Thank you for documenting a more generalized way to approach this
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @efc. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| }, | ||
| ``` | ||
|
|
||
| `rawHandler` recurses into the content, so nested shortcodes and HTML are converted to blocks the same way pasted content is. |
There was a problem hiding this comment.
@Mamaduka Tested with a variety of shortcodes. Nested shortcodes of the same type (e.g. [section]...[section]...[/section]...[/section] fail, but I think that's expected w/ the shortcode API and core's existing processing; it's non-greedy matching after all.
The more normal case of e.g.
[section][section2]<p>more-nested content</p>[/section2]<p>slightly-nested content</p>[/section]
transforming into a wrapper block works both in pasted content and when converting to blocks. 🙌
|
Thanks for testing and review, @kadamwhite! |
What?
Closes #17758.
PR adds shortcode type transforms example that covers wrapped inner content transformation. I've also updated the
rawHandlerexample, so that reference is more helpful.Testing Instructions
Confirm docs make sense.
Use of AI Tools
Claude generated a test code example, then adopted it into the docs example.