Example Markdown



Example Markdown

Markdown for the component era. MDX is an authorable format that lets you seamlessly write JSX in your Markdown documents. You can import components, such as interactive charts or alerts, and embed them within your content.

Markdown is probably the most commonly-used plain text markup used online, and is easy to get started with. The specific flavor of Markdown that Rippledoc uses is Pandoc-Markdown. Here’s a quick example of some pandoc-markdown -formatted text: first as the source you’d put into your file, then rendered as html.

And here’s that text rendered as html:

  • Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz created Markdown in 2004 as a markup language that is appealing to human readers in its source code form. Markdown is widely used in blogging, instant messaging, online.
  • Originally published at on February 11, 2020.Read this article on by blog with proper syntax highlighting. As developers, we rely on static analysis tools to check, lint.

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, and monospace. Itemized lists look like:

  • this one
  • that one
  • the other one

Note that — not considering the asterisk — the actual text content starts at 4-columns in.

Block quotes are written like so.

They can span multiple paragraphs, if you like.

Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., “it’s all in chapters 12–14”). Three dots … will be converted to an ellipsis. Unicode is supported. ☺

An h2 header

Here’s a numbered list:

  1. first item
  2. second item
  3. third item

Note again how the actual text starts at 4 columns in (4 characters from the left side). Here’s a code sample:

As you probably guessed, indented 4 spaces. By the way, instead of indenting the block, you can use delimited blocks, if you like:

(which makes copying & pasting easier). You can optionally mark the delimited block for Pandoc to syntax highlight it:

An h3 header

Now a nested list:

  1. First, get these ingredients:

    • carrots
    • celery
    • lentils
  2. Boil some water.

  3. Dump everything in the pot and follow this algorithm:

    Do not bump wooden spoon or it will fall.

Notice again how text always lines up on 4-space indents (including that last line which continues item 3 above).

Code

Here’s a link to a website, to a local doc, and to a section heading in the current doc. Here’s a footnote 1.

Tables can look like this:

Markdown Tutorial

Markdown
Shoes sizes, materials, and colors.
NameSizeMaterialColor
All Business9leatherbrown
Roundabout10hemp canvasnatural
Cinderella11glasstransparent

(The above is the caption for the table.) Pandoc also supports multi-line tables:

KeywordText
redSunsets, apples, and other red or reddish things.
greenLeaves, grass, frogs and other things it’s not easy being.

A horizontal rule follows.

Here’s a definition list:

apples
Good for making applesauce.
oranges
Citrus!
tomatoes
There’s no “e” in tomatoe.

Again, text is indented 4 spaces. (Put a blank line between each term and its definition to spread things out more.)

Here’s a “line block” (note how whitespace is honored):

Line one
Line too
Line tree

and images can be specified like so:

Inline math equation: (omega = dphi / dt). Display math should get its own line like so:

Example

[I = int rho R^{2} dV]

And note that you can backslash-escape any punctuation characters which you wish to be displayed literally, ex.: `foo`, *bar*, etc.

Pandoc also allows you to do a few more things besides. You can read more about that in the Pandoc Manual.

  1. Some footnote text.↩

Example

R-markdown code chunks

R-markdown is a markdown file with embedded blocks of R code called chunks. There are two types of R code chunks: inline and block.

Inline chunks are added using the following syntax:

They are evaluated and inserted their output answer in place.

Block chunks have a different syntax:

And they come with several possible options. Here are the main ones (but there are many others):

  • echo (boolean) controls wether the code inside chunk will be included in the document
  • include (boolean) controls wether the output should be included in the document
  • fig.width (numeric) sets the width of the output figures
  • fig.height (numeric) sets the height of the output figures
  • fig.cap (character) sets the figure captions
Readme

They are written in a simple tag=value format like in the example above.

R-markdown document example

Below is a basic example of R-markdown file illustrating the way R code chunks are embedded inside r-markdown.

Converting R-markdown to other formats

The R knitr package can be used to evaluate R chunks inside R-markdown file and turn it into a regular markdown file.

Markdown Example File

The following steps are needed in order to turn R-markdown file into pdf/html:

  1. Convert R-markdown file to markdown file using knitr.
  2. Convert the obtained markdown file to pdf/html using specialized tools like pandoc.

In addition to the above knitr package has wrapper functions knit2html() and knit2pdf() that can be used to produce the final document without the intermediate step of manually converting it to the markdown format:

If the above example file was saved as income.Rmd it can be converted to a pdf file using the following R commands:

The final document will be similar to the one below.


Example Markdown File