-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add string interpolatability to InlineHTML
.
#277
Conversation
#Conflicts: # Sources/Ignite/Elements/CodeBlock.swift # Sources/Ignite/Elements/Dropdown.swift # Sources/Ignite/Elements/HTMLBody.swift
I'm going to resubmit with a better approach. |
Okay. I did read this through and didn't feel comfortable about the publishing context being optional when really it's always present, but it made me wonder whether the publishing context is really some sort of singleton – it would allow us to remove it from the |
I was wondering that too while putting this together. I honestly think that is the better implementation. The alternative is making But every property of I'll reopen this PR with that approach for you to review. |
Meaner and leaner. |
@@ -1,35 +0,0 @@ | |||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come the subsite tests went away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can re-add them, but I think that might be best in a separate PR. I think the subset tests need to be rethought a little. All but one of the subsite tests were testing elements that weren't tested for the regular site, so I moved them over there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Rather than re-add them, I wonder whether they could use Swift Testing's parameterized test system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent idea. I think that should be possible. I'll put something together in a small follow-up PR. 🙌🏼
This has a couple of conflicts, but otherwise I think it's good to merge. |
#Conflicts: # Sources/Ignite/Elements/Slide.swift # Tests/IgniteTesting/Elements/Attributes.swift
All set. |
Thank you! |
String Interpolation Support for InlineHTML
This PR introduces string interpolation capabilities for
InlineHTML
, similar to SwiftUI'sText
view. This enhancement allows for more expressive and dynamic HTML content creation within string literals.Example Usage
You can now use this custom
InlineHTML
element directly within strings:Implementation Details
The changes to make this work are actually very small. The reason so many files are touched is because:
Has become:
Most HTML elements don't utilize the context during rendering. Making the context optional enables string interpolation for inline elements with minimal changes to the current architecture.