diff options
Diffstat (limited to 'Hutch')
| -rw-r--r-- | Hutch/Views/Settings/SettingsView.swift | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/Hutch/Views/Settings/SettingsView.swift b/Hutch/Views/Settings/SettingsView.swift index 802e12d..9b7d41f 100644 --- a/Hutch/Views/Settings/SettingsView.swift +++ b/Hutch/Views/Settings/SettingsView.swift @@ -1,6 +1,10 @@ import PhotosUI import SwiftUI +private let settingsBioMarkdownOptions = AttributedString.MarkdownParsingOptions( + interpretedSyntax: .inlineOnlyPreservingWhitespace +) + struct SettingsView: View { @Environment(AppState.self) private var appState @Environment(\.colorScheme) private var colorScheme @@ -163,13 +167,7 @@ struct SettingsView: View { Text("Bio") .font(.caption) .foregroundStyle(.secondary) - RenderedMarkupContentView( - content: .markdown(bio), - readmePath: nil, - colorScheme: colorScheme, - ownerCanonicalName: "", - repositoryName: "" - ) + SettingsBioView(markdown: bio) } } @@ -424,6 +422,27 @@ struct SettingsView: View { } } +private struct SettingsBioView: View { + let markdown: String + + var body: some View { + Text(settingsBioAttributedString(markdown)) + .frame(maxWidth: .infinity, alignment: .leading) + .tint(.accentColor) + .textSelection(.enabled) + } +} + +func settingsBioAttributedString(_ markdown: String) -> AttributedString { + guard let attributed = try? AttributedString( + markdown: markdown, + options: settingsBioMarkdownOptions + ) else { + return AttributedString(markdown) + } + return attributed +} + // MARK: - Edit Profile Sheet private struct EditProfileSheet: View { |
