You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our API gets strings accepts strings of text and we would like to render any markdown within. The problem is, if I switch Text to Markdown I lose any specified formatting.
What I would like is to honor the formatting given, unless overridden by Markdown.
Example:
Text("This is text") .font(.largeTitle) Markdown("This is markdown text") .font(.largeTitle)
In this case, there is no markdown at all, so I would want the strings to render identically. However, the Markdown version ignores the font attribute (see attached)
Is there any way I can make this work? Alternatively, is there any way to ask MarkdownUI if a string contains markdown, and in the case it does not I can just use a standard SwiftUI.Text?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Our API gets strings accepts strings of text and we would like to render any markdown within. The problem is, if I switch
Text
toMarkdown
I lose any specified formatting.What I would like is to honor the formatting given, unless overridden by Markdown.
Example:
Text("This is text") .font(.largeTitle) Markdown("This is markdown text") .font(.largeTitle)
In this case, there is no markdown at all, so I would want the strings to render identically. However, the Markdown version ignores the

font
attribute (see attached)Is there any way I can make this work? Alternatively, is there any way to ask MarkdownUI if a string contains markdown, and in the case it does not I can just use a standard
SwiftUI.Text
?Beta Was this translation helpful? Give feedback.
All reactions