Overview
MarkdownTheme.Fonts defines the font styles used for rendering different markdown text elements. It provides separate font configurations for body text, code, headings, and text emphasis.
Declaration
Properties
Text Fonts
The default font for body text.Default (iOS/visionOS):
UIFont.preferredFont(forTextStyle: .body)Default (macOS): NSFont.systemFont(ofSize: NSFont.systemFontSize)Font used for bold text (strong emphasis).Default (iOS/visionOS): Bold variant of the body fontDefault (macOS): Bold variant of the system font
Font used for italic text (emphasis).Default (iOS/visionOS): Italic variant of the body fontDefault (macOS): Italic variant of the system font
Code Fonts
Font used for inline code spans within paragraphs.Default (iOS/visionOS):
UIFont.monospacedSystemFont at body text sizeDefault (macOS): NSFont.monospacedSystemFont at system font sizeFont used for code blocks.Default (iOS/visionOS):
UIFont.monospacedSystemFont scaled by codeScale (0.85)Default (macOS): NSFont.monospacedSystemFont scaled by codeScale (0.85)Code blocks use a slightly smaller font size than body text by default.Heading Fonts
Font used for large title headings (typically H1).Default (iOS/visionOS): Bold variant of the body fontDefault (macOS): Bold variant of the system font
Font used for title headings (typically H2-H6).Default (iOS/visionOS): Bold variant of the body fontDefault (macOS): Bold variant of the system font
Other Fonts
Font used for footnotes and small text.Default (iOS/visionOS):
UIFont.preferredFont(forTextStyle: .footnote)Default (macOS): NSFont.systemFont(ofSize: NSFont.smallSystemFontSize)Platform Types
- iOS/visionOS: Uses
UIFontfrom UIKit - macOS: Uses
NSFontfrom AppKit
Example
Notes
- All fonts default to system fonts with Dynamic Type support on iOS
- Code fonts automatically use monospaced variants
- The
scaleFont(by:)method onMarkdownThemeadjusts all font sizes proportionally - The
align(to:)method onMarkdownThemesets all fonts to a base point size