Explore Courses Blog Tutorials Interview Questions
0 votes
in Web Technology by (20.3k points)

Is there markdown syntax for the equivalent of:

Take me to <a href="#pookie">pookie</a>


<a name="pookie">this is pookie</a>

1 Answer

0 votes
by (40.7k points)

Try this: 

Take me to [pookie](#pookie)

It can be the correct markdown syntax to jump to the anchor point named Pookie.

For inserting an anchor point of that name, you can try using HTML:

<a name="pookie"></a>

Markdown doesn't bother about where you are putting the anchor point. However, a useful place to put it is in a header. 

As for example:

### <a name="tith"></a>This is the Heading

Note: On self-closing tags and id= versus name=

An earlier version of this post suggested using <a id='tith' />, using the self-closing syntax for XHTML, and using the id attribute instead of the name. XHTML allows for any tag to be 'empty' and 'self-closed'. That is, <tag /> is short-hand for <tag></tag>, a matched pair of tags with an empty body. Most browsers will accept XHTML, but some of them do not. To avoid cross-browser problems, you can close the tag explicitly using <tag></tag>.

Finally, the attribute name= was deprecated in XHTML, hence, you can use id=, which everyone recognizes. 

However, HTML5 now creates a global variable in JavaScript when using id=, and this may not necessarily be what you want. Therefore, using name= is now likely to be more friendly.

Browse Categories