johnxnguyen / Down

Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.
Other
2.24k stars 319 forks source link

Tag <blockquote> is not being properly converted to NSAttributedString #259

Open antoniogonzalezromero opened 3 years ago

antoniogonzalezromero commented 3 years ago

Please help prevent duplicate issues before submitting a new one:

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

johnxnguyen commented 3 years ago

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

CallMeLaNN commented 3 years ago

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.