Render markdown in the login disclaimer#2053
Open
mvanhorn wants to merge 1 commit into
Open
Conversation
2 tasks
LePips
requested changes
Jun 15, 2026
| return evaluatedPolicy | ||
| } | ||
|
|
||
| private func disclaimerText(_ disclaimer: String) -> Text { |
Member
There was a problem hiding this comment.
Some cleanup that can happen, or inline this if let to the section.
@ViewBuilder
private func disclaimerText(_ disclaimer: String) -> some View {
if let attributedString = try? AttributedString(
markdown: disclaimer,
options: .init(interpretedSyntax: .inlineOnlyPreservingWhitespace)
) {
Text(attributedString)
} else {
Text(disclaimer)
}
}
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
The login disclaimer now renders markdown. The server's
BrandingOptions.loginDisclaimeris configured on the Jellyfin server and supports markdown, so a disclaimer that contains a markdown link (for example, a link to a Jellyseerr instance) renders as a tappable link instead of raw[text](url)syntax.In
Shared/Views/UserSignInView.swift, theserverDisclaimersection previously usedText(disclaimer), which renders the string as plain text. This adds a smalldisclaimerText(_:)helper that builds anAttributedString(markdown:)using.inlineOnlyPreservingWhitespaceparsing options, and falls back to the plain string if parsing fails. Because this is a single shared view, the change covers both iOS and tvOS. TheSection(L10n.disclaimer)wrapper is unchanged.Why this matters
Closes the gap reported in #2039, where the disclaimer showed raw markdown syntax in Swiftfin. Jellyfin Web and the Jellyfin mobile app both render the disclaimer as markdown, and the reporter confirmed this with a screenshot, so this brings Swiftfin to parity with the other clients.
Testing
[text](url)..inlineOnlyPreservingWhitespace.if let disclaimerguard is untouched).swiftformat --lintpasses on the changed file.Fixes #2039