Skip to content

Render markdown in the login disclaimer#2053

Open
mvanhorn wants to merge 1 commit into
jellyfin:mainfrom
mvanhorn:feat/2039-markdown-login-disclaimer
Open

Render markdown in the login disclaimer#2053
mvanhorn wants to merge 1 commit into
jellyfin:mainfrom
mvanhorn:feat/2039-markdown-login-disclaimer

Conversation

@mvanhorn

Copy link
Copy Markdown

Summary

The login disclaimer now renders markdown. The server's BrandingOptions.loginDisclaimer is 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, the serverDisclaimer section previously used Text(disclaimer), which renders the string as plain text. This adds a small disclaimerText(_:) helper that builds an AttributedString(markdown:) using .inlineOnlyPreservingWhitespace parsing 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. The Section(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

  • A disclaimer containing a markdown link renders as a tappable link rather than raw [text](url).
  • A plain-text disclaimer with no markdown renders unchanged, with whitespace preserved via .inlineOnlyPreservingWhitespace.
  • An empty or nil disclaimer hides the section as before (the if let disclaimer guard is untouched).
  • Malformed markdown falls back to the raw string instead of crashing or rendering nothing.
  • swiftformat --lint passes on the changed file.

Fixes #2039

@JPKribs JPKribs added enhancement New feature or request iOS Impacts iOS or iPadOS tvOS Impacts tvOS labels Jun 15, 2026
return evaluatedPolicy
}

private func disclaimerText(_ disclaimer: String) -> Text {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request iOS Impacts iOS or iPadOS tvOS Impacts tvOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support markdown text for login disclaimer

4 participants