johnxnguyen / Down

Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tag <blockquote> is not being properly converted to NSAttributedString

antoniogonzalezromero opened this issue · comments

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

When using mark "> " in markdown string, then it is not properly rendered into UITextView or UILabel attributedText property. Vertical gray line does not appear and paragraph headIndent and firstLineHeadIndent are not set.

What did you do?

Markdown text includes blockquote mark and it is being added into UITextView attributed text:

let text = """
#### Lorem ipsum dolor

Lorem ipsum dolor sit amet, **consectetur** adipiscing elit. Nullam consequat diam arcu, a ultrices libero lobortis ut. Aliquam non odio quam. _Nunc rhoncus a ligula eget ornare_ Nulla consectetur nibh vel neque ultrices laoreet. Etiam eget urna lectus.
> Morbi egestas ultrices purus, sit amet fringilla nisi. Duis erat nulla, blandit at odio et, fringilla vehicula enim
"""
let parser = Down(markdownString: text)
bodyTextView.attributedText = parser.toAttributedString()

What did you expect to happen?

Final result should look like:
Screenshot 2021-05-28 at 17 48 11

What happened instead?

Text appears as any other paragraph

Hi @antoniogonzalezromero , thanks for the report. I'll take a look and get back to you.

What happened if you try to put a blank line in between blockqoutes? It become a practice to put a blank line between blocks to maintain consistency across renderer.