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

linking marked-up text generates multiple <a> tags #360

Closed
bantic opened this issue Apr 14, 2016 · 0 comments
Closed

linking marked-up text generates multiple <a> tags #360

bantic opened this issue Apr 14, 2016 · 0 comments

Comments

@bantic
Copy link
Collaborator

bantic commented Apr 14, 2016

Example text, where "BOLD" is bolded:

one BOLD two

Selecting this text and adding a link to it will generate HTML with 3 <a> tags, e.g.:

<a href="...">one </a><strong><a href='...'>BOLD</a></strong><a href='...'> two</a>

The rendered HTML should be:

<a href="...">one <strong>BOLD</strong> two</a>

This can interfere with styling and is not great for SEO.

courajs added a commit to courajs/mobiledoc-kit that referenced this issue Jun 23, 2016
Specify behavior for adding markups that surround, are surrounded by, or
are interleaved with existing markups.

Failing tests for bustle#360
courajs added a commit to courajs/mobiledoc-kit that referenced this issue Jun 23, 2016
Fixes bustle#360

We insert the new markup at a consistent index across the range.
If we just push on the end of the list, it can end up in different positions
of the markup stack. This results in unnecessary closing and re-opening of
the markup each time it changes position.
If we just push it at the beginning of the list, this causes unnecessary closing
and re-opening of surrounding tags.
So, we look for any tags open across the whole range, and push into the stack
at the end of those.
@courajs courajs mentioned this issue Jun 23, 2016
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

1 participant