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

Support for target attribute for links #101

Closed
jochenwezel opened this issue Sep 30, 2016 · 2 comments
Closed

Support for target attribute for links #101

jochenwezel opened this issue Sep 30, 2016 · 2 comments

Comments

@jochenwezel
Copy link

There is a need for implementation of the target attribut for links

Given is a common real-world scenario like this

<a href="http://example.com/" target="_blank">Hello, world!</a>

Currently supported syntax style in CommonMark.Net is at maximum:

[link](url "title")

http://stackoverflow.com/questions/4425198/markdown-target-blank already suggests several possible solutions for the different (common) markup versions.

As of above article, the most probably answer might be one of these syntax variants:

Maybe too simple solution ;-)

[link](url "title" "_blank")

With Markdown-2.5.2, you can use this:

[link](url){:target="_blank"}

Some projects use this style of extended attribution: {[attr]="[prop]"}

[link](url){target="_blank"}

Kramdown/standard common mark

[link](url){:target="_blank"}

https://talk.commonmark.org/t/multimarkdown-link-and-reference-image-attributes/1916
http://fletcher.github.io/MultiMarkdown-5/syntax.html#linkandimageattributes
https://talk.commonmark.org/t/links-with-attributes-like-target-class-etc/2246

After reading the specs and many discussion threads, I'd suggest following the [attr]="[prop]" system and keeping backwards compatibility to today's title definition:

[link](url "title")
[link](url title="title")
[link](url "title" target="_blank")
[link](url target="_blank" "title")
[link](url title="title" target="_blank")
[link](url "title" target="_blank" class="footer")
[link](url title="title" target="_blank" class="footer")

Everything additional must follow the [attr]="[prop]" standard,
everything else must be in quotation marks and represents the title attribute,
everything else is invalid.

@Knagis
Copy link
Owner

Knagis commented Oct 14, 2016

It seems that there is a PR pending in the specification: commonmark/commonmark-spec#105

If that PR would be merged, then that would mean that CommonMark.NET would also implement the attributes in the way it specifies.

@Knagis
Copy link
Owner

Knagis commented Apr 19, 2017

Closing until the spec is updated.

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