gonzalezreal / swift-markdown-ui

Display and customize Markdown text in SwiftUI
MIT License
2.44k stars 298 forks source link

SwiftUI Dynamic Type Size Question #301

Open chaseklingelzen opened 7 months ago

chaseklingelzen commented 7 months ago

Thank you for contributing to MarkdownUI!

Before you submit an issue, please complete the report with all the relevant details for your bug and go through every item in the checklist.

Describe the bug

First off, this is a pretty incredible library! Thank you for all the hard work on it. We'd like to use this in our SwiftUI project, but are currently wrestling with issues around dynamic type size.

Video demonstrating the issue:

https://github.com/gonzalezreal/swift-markdown-ui/assets/94926620/0f66b2b0-04af-4c0e-962c-9d7d362e7434

struct ContentView: View {
    var body: some View {
        Markdown("You may be excluded from filing a Beneficial Owner Report if your company is one of the following. Check out the [FinCEN Beneficial Ownership Guide](https://www.fincen.gov/sites/default/files/shared/BOI_Small_Compliance_Guide.v1.1-FINAL.pdf) if you think you may be exempt.")
            .markdownTextStyle {
                FontSize(12)
            }

    Text("You may be excluded from filing a Beneficial Owner Report if your company is one of the following. Check out the [FinCEN Beneficial Ownership Guide](https://www.fincen.gov/sites/default/files/shared/BOI_Small_Compliance_Guide.v1.1-FINAL.pdf) if you think you may be exempt.")
        .font(.system(size: 12))
    }
}

It seems that Markdown and Text view increase/decrease dramatically different. I would expect that they scale proportionally. I've tried this across several different iOS simulators. Can you help me understand why they don't scale proportionally?

Any help here is greatly appreciated!

Checklist

Steps to reproduce Explanation of how to reproduce the incorrect behavior. This could include an attached project, a link to code, or a Markdown-formatted text exhibiting the issue.

  1. Download this zip
  2. Launch the app
  3. Increase/Decrease dynamic type size w/ cmd + option + "+" / cmd + option + "-"

Markdown-Testing.zip

Expected behavior

Markdown and Text view would scale proportionally when increasing/decreasing dynamic type size.

Screenshots

Same video as above:

https://github.com/gonzalezreal/swift-markdown-ui/assets/94926620/0f66b2b0-04af-4c0e-962c-9d7d362e7434

Version information

Additional context Add any other context about the problem here.