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

Question: how to convert Markup string to AttributedString #63

Open
kvaDrug opened this issue Jul 23, 2022 · 3 comments
Open

Question: how to convert Markup string to AttributedString #63

kvaDrug opened this issue Jul 23, 2022 · 3 comments

Comments

@kvaDrug
Copy link

kvaDrug commented Jul 23, 2022

I have a simple question. Can you please explain briefly, how to convert a Markup string to AttributedString using this lib? Ideally, with a simple function call. I scrolled the documentation and found that it specialised on DOM model, which is overkill for my case. But probably the function I'm looking for is hidden somewhere.

@franklinsch
Copy link
Contributor

Hi @kvaDrug, there is an AttributedString API in Foundation that takes a Markdown string: https://developer.apple.com/documentation/foundation/attributedstring/instantiating_attributed_strings_with_markdown_syntax. You don't need to import Swift-Markdown to use it.

@kvaDrug
Copy link
Author

kvaDrug commented Jul 26, 2022

@franklinsch, unfortunately it works only on iOS 15 or later. I'll consult my manager whether he want's to ditch 14. Meanwhile I'm looking for solution which is compatible with this version.

@matijag1
Copy link

Hi @kvaDrug,

This is great example how to use it:
https://github.com/christianselig/Markdownosaur

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

3 participants