Support for target attribute for links
Closed this issue · 2 comments
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.
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.
Closing until the spec is updated.