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

Blockquote does not work in NSAttributedString #106

Closed
1 task done
jdisho opened this issue Sep 22, 2018 · 3 comments
Closed
1 task done

Blockquote does not work in NSAttributedString #106

jdisho opened this issue Sep 22, 2018 · 3 comments

Comments

@jdisho
Copy link

jdisho commented Sep 22, 2018

Hello 👋,

I am having an issue with blockquote (>), which does not render when I use NSAttributedString

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?

private let markdownString = """
    The quote

    > Somewhere, something incredible is waiting to be known

    has been ascribed to Carl Sagan.
    """

let down = Down(markdownString: markdownString)
let attrString = try! down.toAttributedString()

textView.attributedText = attrString

What did you expect to happen?

I expect to see something like this:

screenshot 2018-09-22 at 15 26 00

What happened instead?

However, I see this:

screenshot 2018-09-22 at 15 26 12

@iwasrobbed
Copy link
Collaborator

iwasrobbed commented Nov 10, 2018

I spoke too soon, and missed that you were rendering an attributed string.

I think for this scenario you'd need to render the blockquote yourself by parsing the attributed string styling (i.e. https://stackoverflow.com/a/46164623/308315). Attributed strings aren't well handled in terms of what happens under-the-hood since it's not converting the HTML string properly. This is more an issue you'd have to file with Apple

e.g. the rendered HTML is

<p>The quote</p>\n<blockquote>\n<p>Somewhere, something incredible is waiting to be known</p>\n</blockquote>\n<p>has been ascribed to Carl Sagan.</p>\n

and attributed string's view doesn't render the blockquote.

@iwasrobbed
Copy link
Collaborator

FYI, you can customize this more using the new AST API: #132

@iwasrobbed
Copy link
Collaborator

FYI: this is further possible via the default Styler via #177

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