Repository navigation
Conversation
Contributor
Author
Member
|
Thanks for the quick implementation! I'll be happy to try it out in the Showcase app and play around with it a bit once it's available! 👍🏻 |
Contributor
Author
|
@fhasse95 Use my showcase branch (pinned to the patched |
tifroz
force-pushed
the
tifroz/attributed-text
branch
from
October 23, 2026 03:16
f3f7c27 to
53f03aa
Compare
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.
Thank you for contributing to the Skip project! Please review the contribution guide at https://skip.dev/docs/contributing/ for advice and guidance on making high-quality PRs.
Use this space to describe your change and add any labels (bug, enhancement, documentation, etc.) to help categorize your contribution.
Skip Pull Request Checklist:
swift testCodex generated the code, validated by testing manually
Summary
This PR will be accompanied by a SkipFuseUI companion PR (depends on this PR, will be submitted later), and a ShowCase update (same comment), but adding an attributed string preview here:
Render attributed segments supplied by native Swift
Add
Text(attributedRuns:)so callers can pass literal segments with their own fonts, colors, inline styles, links, and baseline offsets. The renderer uses these attributes directly without reparsing the segment text. Run-based text now applies text case and placeholder colors, and shares link handling with Markdown text.Source files:
Sources/SkipUI/SkipUI/Text/AttributedText.swiftSources/SkipUI/SkipUI/Text/Text.swiftSources/SkipUI/Skip/AttributedTextBaseline.ktTests:
Tests/SkipUITests/TextTests.swift:testTextConcatenationLaysOutAsSingleStringchecks layout against a joined literal;testTextConcatenationAppliesPerSegmentFontchecks that segment font sizes survive concatenation.Parse inline Markdown while preserving whitespace and literal content
Add
AttributedTextRun.markdownRuns(_:), using the existing CommonMark dependency to produce segments for nested emphasis, code, strikethrough, and links. Preserve inline HTML as literal text and normalize null characters and CR/CRLF line endings before parsing, keeping source-span lookups aligned with the normalized input.Source files:
Sources/SkipUI/SkipUI/Text/AttributedText.swiftSources/SkipUI/Skip/InlineMarkdown.ktTests:
Tests/SkipUITests/AttributedTextTests.swiftwith nine tests:testNestedMarkdownLinksandtestCombinedInlineStyles: nested styles and link destinations.testWhitespaceAndUnicodeandtestInlineParsingPreservesWhitespaceWithinEmphasis: whitespace, Unicode, multiline emphasis, and inline code.testEscapesAndEntitiesandtestLiteralPercentAndPlainText: escaped markup, entities, literal percent signs, plain and empty input.testInlineHTMLIsPreservedAsLiteralText,testNullCharactersDoNotTruncateText, andtestLineEndingsAreNormalizedWithoutLosingWhitespace: literal HTML, text after null characters, normalized line endings, and source-span alignment.Usage Example
On Android, inline Markdown can produce the same run representation:
API Shape
Limitations
AttributedStringconversion belongs to the calling layer; this change supplies the bridge-facing run API.