gonzalezreal / swift-markdown-ui

Display and customize Markdown text in SwiftUI
MIT License
2.26k stars 267 forks source link

Refactor MarkdownStyle with a protocol and a default implementation #38

Closed gonzalezreal closed 3 years ago

gonzalezreal commented 3 years ago

This is a breaking change. MarkdownStyle is now a protocol with a default implementation DefaultMarkdownStyle. This new protocol has methods to customise the attributes of each of the different blocks and inlines in a markdown file.

To customise the font, foreground color, code font or heading font sizes you can use the markdownStyle(_:) view modifier:

Markdown(
    #"""
    ## Inline code
    If you have inline code blocks, wrap them in backticks: `var example = true`.
    """#
)
.markdownStyle(
    DefaultMarkdownStyle(
        font: .system(.body, design: .serif),
        codeFontName: "Menlo",
        codeFontSizeMultiple: 0.88
    )
)