Tagged: MarkDown

CommonMark Ready Reference – The first book on CommonMark standard of MarkDown has been published

UPDATED: The MarkDown ebook ($1) and paperback ($4) are available on Amazon.com.

CommonMark (https://CommonMark.org) is replacing Markdown as the de facto standard for low-markup text. CommonMark hit the ground with a well-defined standard from Day 1 and is set to replace and overtake MarkDown. StackOverFlow.com and other sites have already adopted it. This book provides a tutorial, hacks collection and a ready reference for the new standard.

Book cover of CommonMark Ready Reference

The covers of the book is a more robust MarkDown cheatsheet or quick reference card.

On VSubhash.com, I provide Linux and Windows executables that I built from the CommonMark C code. The executables are several times faster than the perl program at DaringFireball.net, where the original MarkDown is hosted.

I am also providing a free download of the black-n-white version of the CommmonMark reference card.

http://www.vsubhash.com/sss-dls/commonmark-quick-reference.pdf

How to write citations with Markdown & retain links in your article’s references section

I use Markdown to write articles but it surprisingly does not support citations. Markdown simply removes all references after it creates hyperlinks in the output. Today, I was writing an article today with markdown and decided to find a solution.

I found that markdown references need not always be to an external URL – they could also be referring to intra-document anchors. So, I used an HTML-style anchor (prefixed with # character) in the markdown reference. Then, I placed an empty HTML SPAN tag before the citation with the anchor name set as the value of the tag’s ID attribute. This trick takes advantage of the fact that markdown ignores HTML tags and outputs them without processing. Here is the markdown.

By the [1920s][nbc], commercial radio networks run by the National Broadcasting Corporation (NBC) had become popular. Although the television was invented in the 1930s, it did not take off as factories and materials were diverted for war production. Thus, radio enjoyed two decades as the most popular medium for news and entertainment. It was known as the *[golden age of radio][golden_age]*. After World War II, TV displaced radio in popularity. Radio served a niche segment of people on their commute. In the age of the Internet,

...

[nbc]: #nbc
[golden_age]: #golden_age
 
References
----------
  * <span id="nbc"></span>
  National Broadcasting Company history files - [https://lccn.loc.gov/2002660093](https://lccn.loc.gov/2002660093)
  * <span id="golden_age"></span> 
  Golden Age of American radio - [http://www.britannica.com/topic/Golden-Age-of-American-radio](http://www.britannica.com/topic/Golden-Age-of-American-radio)
 
...

In other words, markdown references link to SPAN tags instead of external URLs. The span tags are located in the citations. So, the links lead to the citations and the citations then lead to the external URLs.

The markdown references can be placed even outside the references section, as the former gets completely removed from the output. For readability, just add a newline after the SPAN tag.

HTML output with the citations still intact.

HTML output with the citations still intact.