feat(content): rewrite :icon-name: syntax in local dev#2759
Open
shsteimer wants to merge 1 commit into
Open
Conversation
`aem up` serves DA-cloned content directly from content/, which holds raw HTML the same way DA storage does. helix-html-pipeline rewrites :icon-name: text into <span class="icon icon-name"> server-side, but helix-cli had no local equivalent, so local previews showed literal colon syntax instead of the icon. Reuses @adobe/helix-html-pipeline's own rewrite-icons.js step directly against a locally parsed HAST tree rather than porting the regex, to avoid drift from the production behavior it mirrors. Fixes #2755 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
shsteimer
commented
Jul 6, 2026
| import rehypeParse from 'rehype-parse'; | ||
| import { toHtml } from 'hast-util-to-html'; | ||
| // eslint-disable-next-line import/no-unresolved, import/extensions | ||
| import rewriteIcons from '@adobe/helix-html-pipeline/src/steps/rewrite-icons.js'; |
Contributor
Author
There was a problem hiding this comment.
flagging this deep import for review/discussion. Would it make sense to change helix-html-pipeline to provide these as exports for re-use? Note we'll need a similar thing to handle #2756
Contributor
|
I think this gets more and more complicated. next, you need metadata injection and the section metadata decoration etc... maybe it would be better to run the however, is this really a usecase to render from a DA content checkout? |
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.
Summary
aem upserves DA-cloned content directly fromcontent/, which holds raw HTML in the same unprocessed form DA stores it.helix-html-pipelinerewrites:icon-name:text into<span class="icon icon-name">server-side for all content, but helix-cli had no local equivalent, so:icon-name:showed as literal text when previewing locally.HelixServer.js, alongside the existing page-metadata handling, that mirrors this.@adobe/helix-html-pipeline's ownsrc/steps/rewrite-icons.jsdirectly against a locally parsed HAST tree, rather than hand-porting the regex, so local behavior can't drift from what production actually does.Fixes #2755. Follow-up for
section-metadatablocks tracked in #2756.Test plan
test/content-icons-html.test.jsbefore implementingsrc/content/content-icons-html.js, then made them passtest/server.test.jsbefore wiring the transform intoHelixServer.js, then made it passnpm run lintnpm test🤖 Generated with Claude Code