Wednesday, 27 April 2016

Markdown: links

Markdown supports two kinds of links.
a.   Inline links
b.   Reference links

a. Inline links
Link text is delimited by square brackets []. You can create inline link by using parentheses immediately after the link text’s closing square bracket. Inside the parentheses, you can provide the link url with optional title.


inline.md
[Self learn java](https://self-learning-java-tutorial.blogspot.com/) is the Java tutorial website for beginners.

[Java Tutorial](https://self-learning-java-tutorial.blogspot.com/ "Java Tutorial for beginners") is the Advanced Java tutorial website for Experienced.

Following is the preview for above markdown.


Following is the html code for above markdown file.
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
  <p>
    <a href="https://self-learning-java-tutorial.blogspot.com/">Self
      learn java</a> is the Java tutorial website for beginners.
  </p>
  <p>
    <a href="https://self-learning-java-tutorial.blogspot.com/"
      title="Java Tutorial for beginners">Java Tutorial</a> is the Advanced
    Java tutorial website for Experienced.
  </p>
</body>
</html>


Note
There is no space between closing square bracket ‘]’ and opening parenthesis ‘(‘.

b. Reference links
Link text is delimited by square brackets []. You can create Reference links by using a second set of square brackets, inside which you place a label of your choosing to identify the link.

b.1 Define an identifier for your domain first.
[id]: https://self-learning-java-tutorial.blogspot.com/  "Java Tutorial for beginners"

1.   [] define link identifier
2.   Followed by colon:
3.   Followed by space, followed by URL.
4.   Optionally followed by title of the link. Title can be enclosed in double, single quotes (or) parenthesis.

b.2 Use the identifier in your markdown document.
This is [Java Tutorial][id] reference-style link.

reference_link.md
[id]: https://self-learning-java-tutorial.blogspot.com/  "Java Tutorial for beginners"

This is [Java Tutorial][id] reference-style link.

Following is the preview for above markdown file.



Following is the html for above mark down file.
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
  <p>
    This is <a href="https://self-learning-java-tutorial.blogspot.com/"
      title="Java Tutorial for beginners">Java Tutorial</a> reference-style
    link.
  </p>
</body>
</html>


Note
a. Link URL can be optionally surrounded by <>.
[id]: <https://self-learning-java-tutorial.blogspot.com/>  "Java Tutorial for beginners"

In addition to above approach, you can define link definitions like below also.

Define the link text itself as the identifier.

[google]: https://self-learning-java-tutorial.blogspot.com/  "Goolge Search Engine"
[bing]: http://www.bing.com/ "Bing Search Engine"
[yahoo]: https://yahoo.com "Yahoo Search Engine"
[Ask]: http://ask.com/ "Ask search Engine"

Use the link name itself like [google][] to access the link.

1. [google][]       : 64.0%       
2. [bing][]  : 20.3% 
3. [yahoo][] :      12.7% 
4. [Ask][]    : 1.7%

search_engine.md
# Search Engines Market share 2015

[google]: https://self-learning-java-tutorial.blogspot.com/  "Goolge Search Engine"
[bing]: http://www.bing.com/ "Bing Search Engine"
[yahoo]: https://yahoo.com "Yahoo Search Engine"
[Ask]: http://ask.com/ "Ask search Engine"


1. [google][] : 64.0%      
2. [bing][] : 20.3%  
3. [yahoo][] :   12.7%  
4. [Ask][]  : 1.7%
Following is the preview for above markdown file.


Following is the html code for above markdown file.
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
  <h1 id="search-engines-market-share-2015">Search Engines Market
    share 2015</h1>
  <ol>
    <li><a href="https://self-learning-java-tutorial.blogspot.com/"
      title="Goolge Search Engine">google</a> : 64.0%</li>
    <li><a href="http://www.bing.com/" title="Bing Search Engine">bing</a>
      : 20.3%<br /></li>
    <li><a href="https://yahoo.com" title="Yahoo Search Engine">yahoo</a>
      : 12.7%<br /></li>
    <li><a href="http://ask.com/" title="Ask search Engine">Ask</a> :
      1.7%</li>
  </ol>
</body>
</html>



Previous                                                 Next                                                 Home

No comments:

Post a Comment