Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a class attribute to a hyperlink in Markdown [duplicate]

Possible Duplicate:
How do I set an HTML class attribute in Markdown?

In my original link done in plain HTML I have a class attribute like so:

<a href="http://example.com" class="noborder">my link</a> 

How do I translate it to Markdown? I don't know how to put the class in.

[mylink](http://example.com) 
like image 699
Barbara Avatar asked Jan 06 '10 22:01

Barbara


People also ask

Can you add classes to Markdown?

No. But... No, Markdown's syntax can't. You can set ID values with Markdown Extra through.


2 Answers

Brian is right. The standard Markdown dialect does not let you add classes, attributes, or ids to elements. That said, there are other dialects such as Maruku that do you give this sort of flexibility by introducing a meta-data syntax. Here's a couple example of what it looks like:

## A header with an id  ##  {: #the-head} // => <h2 id="the-head">A header with an id</h2>  [a special url](/my-special-place.html){: .special} // => <a href="/my-special-place.html" class="special">a special url</a>  A paragraph with a random attribute {: random=attribute} // => <p random="attribute">A paragraph with a random attribute</p> 

For more information check out the Maruku meta-data proposal.

like image 134
Xavi Avatar answered Nov 17 '22 11:11

Xavi


You can't put a class into Markdown syntax. In most Markdown implementations you can embed HTML, so using your original HTML might work.

John Gruber (creator of Markdown) even does it this way:

http://daringfireball.net/projects/markdown/syntax.text

like image 42
Brian McKenna Avatar answered Nov 17 '22 09:11

Brian McKenna