It doesn't indent properly when rendering nested <ul> or <ol>
Closed this issue · 4 comments
It's a good tool to render HTML as attributedString.
But I found a issue when rendering list.
When I writing
<ul>
<li>item1</li>
<ul>
<li>item2</li>
</ul>
</ul>
It doesn't indent properly.
Any idea on this?
When I was implementing list items, I found that NSAttributedString couldn't perfectly match list items as in HTML UL LI.
As a result, I'm using whitespace for indentation because I've hardcoded the implementation, without considering nested cases.
I'll continue my research, and if you have any implementation references, please provide them.
Thank you.
Thanks for your reply. NSParagraphStyle has property called headIndent and firstLineHeadIndent. Can we do something on that? Actually, it shows a wrong head intent when encountering line break in LI.
Thanks for your reply. NSParagraphStyle has property called headIndent and firstLineHeadIndent. Can we do something on that? Actually, it shows a wrong head intent when encountering line break in LI.
I previously studied headIndent and firstLineHeadIndent (ref: https://www.objc.io/issues/9-strings/string-rendering/), but the results were not as expected. It is not as easy as HTML UL/LI to format the text. I remember having to calculate pixels to control the layout, which makes the scenario very complex, especially considering that the spacing between different languages may vary. In the end, I did not implement it.
If you have any demo code, I would appreciate it if you could provide it. I would be happy to study it again. Thank you.