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

-[NSAttributedString markdownRepresentation] doesn't handle overlapping bold and italic if they don't have the same range. #4

Open
simonward opened this issue May 11, 2020 · 1 comment

Comments

@simonward
Copy link

simonward commented May 11, 2020

See attached unit tests.

NSAttributedString+Markdown_Tests.m.txt

@simonward simonward changed the title -[NSAttributedString markdownRepresentation] doesn't handle overlapping italic and italic if they don't have the same range. -[NSAttributedString markdownRepresentation] doesn't handle overlapping bold and italic if they don't have the same range. May 11, 2020
@chockenberry
Copy link
Owner

I'm not sure the assertion for @"_Italic **Bold**_" is valid. The Markdown syntax documentation makes no mention of scoping being a requirement (nor does HTML). It's more visual than structural: <i>Italic <strong>Bold</i></strong> looks the same as <i>Italic <strong>Bold</strong></i>.

The order operations in emitMarkdown could be changed to make the first test pass, but then the second one fails. The underlying cause is that the rich text representation doesn't have a notion of one style wrapping another (to give scope). It seems like a hard problem to solve and considering the spec doesn't require this, it feels like more a "nice to have" than "this is broken".

I'm going to leave this issue open and think about it more. Thanks for the unit tests, in any case!

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