Computer Science

Markdown

Markdown is the name of a markup system for taking notes in a text editor.

"Marking up" a document is the process of commenting on a text-document—on paper, on the computer—with suggestions for edits, formatting, etc.

Markdown is a play on that expression, and the name of a system for indicating formatting in a text-based document. It was formalized by John Gruber and has become a standard system among developers for quickly and simply creating text-based documents that can be easily converted to documents with some degree of formatting.

It's harder to explain than to show you. Let's see how it works.

How Markdown works

In writing notes on the computer or by hand, you might conceivable write something like the hand-written notes shown to the right down below.

It's text, but I've underlined the sections to identify them as headings, and indicated little numbers or bullets for series of items that I want to address.

Nothing fancy.

Below and on the left is how I might conceivably write the same thing as notes on my phone or on my computer.

They're pretty much exactly the same, right?

Notes for Speech ================ Thank you all for coming today. I've got just a few things to say. History ------- There are three significant events in the history of our company. 1. asdf;lkjh;hjasf 2. asdfl;sjdlkjasdf 3. ;asdf;lkajsf;jkasd Where We Are ------------ Things are good. Things are *really* good. Let's talk about that. Where We Are Going ------------------ The future is bright! Let's talk about that. * This thing * That thing * Another thing Q and A ------- Any questions?
 

The notes on the left are obviously written in text, but they also have some minimal indication of how the text should be interpreted: there's a header at the top, and sub-headings below, and a numbered list, and a bullet list...

It turns out that those notations above—asterisks for bullets, numbers for numbers, underlines for headers—is exactly what Markdown uses. That text-based "markup" works in a regular text document just fine. You don't need to have Microsoft Word to tell you that those asterisks indicate a bulleted list.

Ordinarily text-based documents produced by a text editor have an extension of .txt if they're text, or .py or .java if their Python or Java code. For a Markup document, you'll want to save the file with an extension of .markdown or .md, to indicate to your text editor that it should interpret that file using Markdown's syntax.

While you're editing your file in the text editor it will just look like standard text, with maybe a little colored "syntax highlighting" once you've saved the file as a .markdown document. If you do want to see the markup in a more finished form, you can easily do so by using some tool to present the document in that way. Most current text editors support converting Markdown documents to HTML for presentation.

Here's what Markdown text looks like in the BBEdit text editor, along with its "pretty" version once it's been converted.

Here's what Markdown text looks like in VS Code, along with its "pretty" version (as interpreted by the Markdown All-in-One extension):

Why Use Markdown

People use Markdown for all sorts of reasons, from taking simple notes to building entire websites. If you need to take notes and you're not using a pencil-and-paper, it's a painless way to add a little more information to what you're writing down.

If you're a coder, Markdown has some features that go beyond the simple "headings and lists" formatting features. Here's a brief note I wrote using Markdown in the text editor Atom, along with its syntax highlighting for the text itself, and the Preview mode showing in the right window.

You can see that the code part of my document—indicated by indenting in a Markdown file—is highlighted and offset from the standard text. I've also given an example of how you can include a link in your Markdown documents using [ ] and ( ).

Below is another example of using Markdown to take notes for a Physics class, using the VS Code text editor along with the Markdown All in One extension by Yu Zhang. This version of Markdown supports LaTeX style markup of mathematical expressions (which some math students use in college to take notes on their computers). Check out my notes on the left, and the resulting HTML version of those notes on the right.

I know, right?!

Mostly, though, if you're taking notes on your computer, it's just a super easy way to add a little more formatting to your documents.

I use Markdown for taking notes at meetings, among other things, and usually save the file with a title like 2019-01-19-science_dept_meeting.markdown, and that way it will be sorted in whatever folder I put it in along with all the other dated meetings.

Give it a try!

Printing your Markdown document

If you want to print your Markdown document, you've got two options: print the text version of your document as it is, or print the formatted version after converting it into something else.

Resources

Learn more about Markdown: