Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DownStylerConfiguration not working for link in UILabel #285

Open
1 task done
AbhijeetCherungottil opened this issue Jun 4, 2022 · 2 comments
Open
1 task done

Comments

@AbhijeetCherungottil
Copy link

AbhijeetCherungottil commented Jun 4, 2022

Please help prevent duplicate issues before submitting a new one:

  • I've searched other open/closed issues for duplicates before opening up this new issue.

Report

What did you do?

  let configuration = DownStylerConfiguration()
   let fonts = StaticFontCollection(heading1: UIFont.preferredFont(forTextStyle: .largeTitle), heading2:     UIFont.preferredFont(forTextStyle: .title1), heading3: UIFont.preferredFont(forTextStyle: .title2), heading4: UIFont.preferredFont(forTextStyle: .title3), heading5: UIFont.preferredFont(forTextStyle: .headline), heading6: UIFont.preferredFont(forTextStyle: .subheadline), body: UIFont.preferredFont(forTextStyle: .body), code: UIFont.preferredFont(forTextStyle: .body), listItemPrefix: UIFont.preferredFont(forTextStyle: .body))
    let colors = StaticColorCollection(heading1:  .black, heading2: .black, heading3:  .black, heading4: .black, heading5:  .black, heading6: .black, body: .black, code: .black, link: DownColor.systemPink, quote:.darkGray, quoteStripe: .darkGray, thematicBreak: .init(white: 0.9, alpha: 1), listItemPrefix: .lightGray, codeBlockBackground: .green)
    let paragraphStyles = configuration.paragraphStyles
    let quoteStripeOptions = configuration.quoteStripeOptions
    let thematicBreakOptions = configuration.thematicBreakOptions
    let codeBlockOptions = configuration.codeBlockOptions
    let itemParagraphStyler = ListItemOptions()
  guard let markdownAttributedString = try? down.toAttributedString(.smartUnsafe, styler: DownStyler(configuration: .init(fonts: fonts, colors: colors, paragraphStyles: paragraphStyles, listItemOptions: itemParagraphStyler, quoteStripeOptions: quoteStripeOptions, thematicBreakOptions: thematicBreakOptions, codeBlockOptions: codeBlockOptions) ))else { return NSAttributedString(string: self) }
  return markdownAttributedString

What did you expect to happen?

  • Link with pink color

What happened instead?

  • Link with default tint color
@sergeymild
Copy link

The same error, link shows always blue

@AbhijeetCherungottil
Copy link
Author

The same error, link shows always blue

I am not 100% sure, but when UILabel has an NSLink, no matter what we do, the compiler converts the link on runtime. I'm not sure if it can be fixed because it's a UILabel default behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants