A Markdown cheat sheet

This is a simple Markdown cheat sheet. I created it for my own needs, so I can find what I use and need quickly. If it’s a helpful resource for you too, cool.

Back to top

Headers

# H1
## H2
### H3
#### H4

This is also an H1
==================

And this is an H2
-----------------
Back to top

Paragraphs

  • A paragraph is one or more consecutive lines.
  • One or more empty lines marks the end of a paragraph.
  • 2+ blank spaces at the end of a line create an HTML break (<BR> tag)
Back to top

Lists

  • Use * with no indentation for unordered list. (Can use + or - instead, if preferred.)
  • Use 1. with no indentation for ordered lists. Can be (1,1,1) or (1,2,3).
  • The markers you use can be indented up to three spaces.
Back to top

Code blocks (PRE and CODE)

PRE blocks (technically <pre><code>...</code></pre> blocks):

  • Either (a) indent code by 4 spaces or 1 tab, or (b) use four backtick marks on the lines before and after your code block
  • An improved form is to create a PRE block is this: ```scala ... code in here ... ```
  • Special characters &, <, and > are automatically handled
this shows the four-space approach:

    this is some code
    some more code

this shows the backtick approach:

````
some code here ...
some more code ...
````

Here’s the form that lets you specify a PRE/CODE block and the programming language or environment inside of it:

```scala
println("Hello, World")
```

CODE spans:

  • Use backticks around code: `doFoo()`
Back to top
This is [an example](http://example.com/) link
This is [an example](http://example.com/ "Title") with a title
Back to top

Blockquotes

  • Prefix each blockquote line with a greater-than symbol >
  • Add additional > symbols for more indentation levels.

Example:

> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Back to top

Fonts

_emphasis_
__strong__

`doFoo()`  // code

It’s actually a bit more flexible:

*single asterisks*        // em
_single underscores_      // em

**double asterisks**      // strong
__double underscores__    // strong

If you really need asterisks use a backslash:

\*this text is surrounded by literal asterisks\*
Back to top

Images

![Alt text](/path/to/img.jpg)
![Alt text](/path/to/img.jpg "Optional title")
Back to top

Tables

Tables don’t seem to be a standard in Markdown, but these days I use the MacDown editor, and this table format works fine with MacDown:

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |

I found that syntax on this Markdown cheat sheet. That link notes that the outer pipe symbols are optional, and there must be at least three dashes (---) in each header cell.

Back to top

Comments

When you’re working with a large Markdown document it’s nice to be able to include comments inside your Markdown text. You can do this by putting your comments inside HTML comment tags:

<!---
your comment goes here
and here
-->

I found this tip here on SO, where the author suggests using triple dashes so your comments will be safe when your Markdown is used with other tools like Pandoc.

Back to top

Miscellaneous

  • Create a horizontal rule (<HR> tag) with three or more asterisks, hyphens, or underscores.
Back to top

More Markdown information

Back to top

An example

Here's a Markdown example from one of my Github projects. It doesn't use all of the Markdown functionality, but it's a start.

Akka Remote "Hello, world" Example
==================================

As it's name indicates, this is a simple "Hello, world" example
for Akka remote actors. It shows how to create a local actor,
a remote actor, and send messages between them.

Assumptions
-----------

For the purposes of this code, I assume you know the following:

1. Scala
1. SBT (the Simple Build Tool)
1. How to use Akka actors within one JVM (i.e., the actor basics)

Running the Code
----------------

Follow these steps to run the code:

1. `cd` into the _HelloRemote_ directory.
1. Type `sbt run` to start the remote actor system.
1. In a separate terminal window, `cd` into the _HelloLocal_ directory.
1. Type `sbt run` to start the local actor system.

When the local actor system starts, it will send an initial message
to the remote actor system. The remote actor will send a reply through
its `sender` reference, and this will continue five times. When the
action stops, stop each system by pressing Ctrl-C.

Problems?
---------

If you're having any problems with this code, edit the _application.conf_
file in the _src/main/resources_ directory of each project, and remove the
comments from the debug-related lines.

More Information
----------------

See the following URL for more information:

http://alvinalexander.com/scala/simple-akka-actors-remote-example
Back to top

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.