indragiek / CocoaMarkdown

Markdown parsing and rendering for iOS and OS X
MIT License
1.2k stars 158 forks source link

Links are white #31

Closed adamdahan closed 4 years ago

adamdahan commented 8 years ago

let attributes = CMTextAttributes() attributes.linkAttributes = [ NSForegroundColorAttributeName: UIColor.redColor() ]

Will render white links if the window.tintColor property is set...

Aside from that the code above actually doesn't work at all. Starting to think the external tints colors are causing this issue?

Any solid explanation why?

ryang1428 commented 8 years ago

I am also seeing a similar issue, but my links are always blue, even when setting

        CMTextAttributes *cmAttrs = [[CMTextAttributes alloc] init];
        cmAttrs.linkAttributes = @{NSForegroundColorAttributeName: [UIColor fp_pink]};
indragiek commented 8 years ago

@adamdahan While I wish I could resolve every issue in a timely manner, I realistically cannot when I have other things to prioritize. I don't have any obligation or incentive to put this ahead of anything else. It's open source for a reason: you can read, extend, and modify the code on your own to suit your purposes rather than waiting on me to fix it for you.

@ryang1428 It looks like this may be an issue with a behavioural change in UIKit, I will investigate soon.

anton-barkov commented 5 years ago

To anyone who still struggles with this issue - try setting NSTextView/UITextView linkTextAttribues to an empty dictionary and set all the needed attributes through CMTextAttributes linkAttributes.

In my case the link always stayed blue. It appears as though the view overrides attributed string's attributes.

iby commented 5 years ago

@anton-barkov Thanks for the tips! Any idea how to do the same for NSTextField?

anton-barkov commented 5 years ago

@ianbytchek I'm not sure that links will work properly with NSTextField, you should probably consider using NSTextView. See this thread.

iby commented 5 years ago

@anton-barkov They work perfectly fine. The only issue is they are always displayed in blue while the attributed string specifies a different color.

indragiek commented 4 years ago

The conclusion here seems to be that the view being used to render the attributed string seems to override attributes that are set by CocoaMarkdown when generating the attributed string. Since this is a UIKit problem and not an issue with CMAttributedStringRenderer, I am closing this issue.