blob: 1e2bd4b5ac88c7d1c48d0b9d74efab7feb9345eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
//
// AttributedString+Helpers.swift
// MullvadVPN
//
// Created by Andrew Bulhak on 2025-08-22.
// Copyright © 2025 Mullvad VPN AB. All rights reserved.
//
import SwiftUI
extension AttributedString {
/// Construct an AttributedString from text assumed to be in Markdown. If Markdown parsing fails, constructs one treating the text as plain text.
static func fromMarkdown(_ markdown: String) -> AttributedString {
(try? AttributedString(markdown: markdown)) ?? AttributedString(markdown)
}
}
|