Closed AliceAponasko closed 6 years ago
@AliceAponasko thanks for pointing this out. I like both of your proposed solutions. Do you think one is more beneficial than the other?
@chrisdhaan I think it's better to provide an optional frame, so developers have less work to do. If set, the image will resize to fit in that frame.
I also think it is beneficial to parse custom elements first because some developers might have their own implementations of library's classes.
I submitted a PR, let me know if oyu have any questions!
@AliceAponasko I've pushed up a commit with this functionality. Would it be alright to close out this issue?
Haven't heard anything back and this seems to be working now so closing issue.
What did you do?
Parsed an image link with a large image.
What did you expect to happen?
The image to fit in the textView.
What happened instead?
The image was too large and didn't scale.
CDMarkdownKit Environment
CDMarkdownKit version: 0.9.7
Xcode version: 9.2 (9C40b)
Swift version: 3.2
Platform(s) running CDMarkdownKit: iOS
macOS version running Xcode: MacOS Sierra 10.12.6
Possible solution to this is to pass a desired frame to
CDMarkdownParser
and initializeCDMarkdownImage
with it. Then, scale the attachment size to fit the passed frame.Another possible solution is to parse
customElements
beforedefaultElements
inCDMarkdownParser
. Then developers have an option to create a custom class for scaled images and pass that as a custom element.