Author Carpentry logo

Markdown Syntax

20 minutes


Learning Objectives


Creating a Markdown Document

So far, you have just written markdown in an online editor. Start by creating a local file. The file extension for markdown is .md. You can just open a text editor and create a file or do this from the commandline. use cd to go to the folder you want to work in. Then use atom myresume.md to create a markdown file.

Working with Markdown in Atom

You can skip this section if you are using a different text editor.

Type some text into markdown. Now put some text into italics and bold using * as you learned in the last lesson. What do you notice? One of the benefits of using Atom is that it gives you this syntax highlighting to make it easier for you to spot any problems in your text formatting.

Now press ctrl+shift+m (or select “Toggle Preview” under “Markdown Preview Plus” in the “Packages” menu). You will see your text formatted, just like you did in the online editor during the last lesson.

Markdown syntax

You have already learned the two commands for bold and italics. Let’s look at some other basics:

    - Topic 1
    - Topic 2  
    - Topic 3
      - Topic 3a
  > This is a Quote
  [This is a link](http://www.example.com)

Excercise

Now let’s try this. Create your Resume using markdown following the template below. Fill in the data relevant to you.


Resume of John Doe

Objective

To boldly go where no author has gone before

Experience

Publications

(paste the output from DOI content negotiation here and mark it up with italics as appropriate)

Karcher, S., & Steinberg, D. A. (2013). Assessing the Causes of Capital Account Liberalization: How Measurement Matters. International Studies Quarterly, 57(1), 128–137. https://doi.org/10.1111/isqu.12001

Karcher, S., & Schneider, B. R. (2012). Business politics in Latin America: Investigating structure, preferences, and influence. In P. R. Kingstone & D. J. Yashar (Eds.), Routledge Handbook of Latin American Politics (pp. 273–284). New York, NY: Routledge.

Schneider, B. R., & Karcher, S. (2010). Complementarities and Continuities in the Political Economy of Labor Markets in Latin America. Socio-Economic Review, 8(4), 623–651. https://doi.org/10.1093/ser/mwq022

Code samples

Here is how to use curl to get a bibliographic reference for a DOI in APA style:

curl -LH "Accept: text/x-bibliography; style=apa" https://doi.org/10.1126/science.169.3946.635

Solution: If you run into trouble, you can check the syntax for the above here.


Markdown and html

Now let’s look at how the markdown you wrote corresponds to html. Right-click on the preview window, select “Save as HTML” and save the file myresume.md.html somewhere on your computer. Now open a browser (Firefox or Chrome) and open that file. Right-click somewhere in the web document that open and select “Inspect Element”.

Challenge

Can you match markdown and html elements? How are they different? What do you think are the advantages of each format?

Solution

Markdown and html translate neatly: e.g. the headings are the same as h1, h2, h3, italics are the same as <i> tags, etc. But note how hard the html is to right, with the need to get all the tags right, and how hard to read it is for you. On the other hand, note all the additional information the HTML is able to include that isn’t printed. That can be very useful, e.g. to include even more structure in a page or to add metadata.

Previous: Getting Started with Markdown Next: Github Pages