Resource: Text Formatting in Markdown
Written on September 9th, 2016 by Paul LeMarkdown Support
As always, Jekyll offers support for GitHub Flavored Markdown, which allows you to format your posts using the Markdown syntax. Examples of these text formatting features can be seen below. You can find this post in the _posts
directory.
Basic Formatting
With Markdown, it is possible to emphasize words by making them italicized, using astericks or underscores, or making them bold, using double astericks or double underscores. Of course, you can combine those two formats, with both bold and italicized text, using any combination of the above syntax. You can also add a strikethrough to text using a double tilde.
Paragraphs
This is what a paragraph looks like. For the purpose of demonstration, the rest of this paragraph and the next paragraph after will mean absolutely nothing. Proin eget nibh a massa vestibulum pretium. Suspendisse eu nisl a ante aliquet bibendum quis a nunc. Praesent varius interdum vehicula. Aenean risus libero, placerat at vestibulum eget, ultricies eu enim. Praesent nulla tortor, malesuada adipiscing adipiscing sollicitudin, adipiscing eget est. Praesent nulla tortor, malesuada adipiscing adipiscing sollicitudin, adipiscing eget est.
Proin eget nibh a massa vestibulum pretium. Suspendisse eu nisl a ante aliquet bibendum quis a nunc. Mauris lobortis nulla et felis ullamcorper bibendum. Phasellus et hendrerit mauris. Proin eget nibh a massa vestibulum pretium. Suspendisse eu nisl a ante aliquet bibendum quis a nunc. Praesent varius interdum vehicula. Aenean risus libero, placerat at vestibulum eget, ultricies eu enim. Praesent nulla tortor, malesuada adipiscing adipiscing sollicitudin, adipiscing eget est.
Headings
Sometimes it is useful to have different levels of headings to structure your documents. Start lines with #
to create headings. Multiple ##
in a row denote smaller heading size. The following demonstrate the full range of heading sizes:
Heading One (h1)
Heading Two (h2)
Heading Three (h3)
Heading Four (h4)
Heading Five (h5)
Heading Six (h6)
Links
You can create an inline link by wrapping link text in square brackets [ ]
, and then wrapping the URL in parentheses ( )
. For example, it is very easy to link to Google!.
Blockquotes
Blockquotes are useful for denoting quotes, or highlighting a large block of text. Single line blockquote:
This quote will change your life. Multi line blockquote with a cite reference:
People think focus means saying yes to the thing you’ve got to focus on. But that’s not what it means at all. It means saying no to the hundred other good ideas that there are. You have to pick carefully. I’m actually as proud of the things we haven’t done as the things I have done. Innovation is saying no to 1,000 things.
Code and Syntax Highlighting
Code blocks are part of the Markdown spec, but syntax highlighting isn’t. However, many renderers - like GitHub or most Jekyll themes - support syntax highlighting. Which languages are supported and how those language names should be written will vary from renderer to renderer. You can find the full list of supported programming languages here. Also, it is possible to do inline code blocks
, by wrapping the text in ` ` ` quotations.
No language indicated, so no syntax highlighting.
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
Another option is to embed your code through Gist.
Unordered and Numbered Lists
You can make an unordered and nested list by preceding one or more lines of text with -
, *
, or +
, and indenting sublists. The following lists show the full range of possible list formats.
- List item one
- List item one
- List item one
- List item two
- List item three
- List item four
- List item two
- List item three
- List item four
- List item one
- List item two
- List item three
- List item four
Numbered lists are made by using numbers instead of bullet points.
- List item one
- List item one
- List item one
- List item two
- List item three
- List item four
- List item two
- List item three
- List item four
- List item one
- List item two
- List item three
- List item four
MathJax Example
The Schrödinger equation is a partial differential equation that describes how the quantum state of a quantum system changes with time:
\[i\hbar\frac{\partial}{\partial t} \Psi(\mathbf{r},t) = \left [ \frac{-\hbar^2}{2\mu}\nabla^2 + V(\mathbf{r},t)\right ] \Psi(\mathbf{r},t)\]Joseph-Louis Lagrange was an Italian mathematician and astronomer who was responsible for the formulation of Lagrangian mechanics, which is a reformulation of Newtonian mechanics.
\[\frac{\mathrm{d}}{\mathrm{d}t} \left ( \frac {\partial L}{\partial \dot{q}_j} \right ) = \frac {\partial L}{\partial q_j}\]Tables
Title 1 | Title 2 | Title 3 | Title 4 |
---|---|---|---|
lorem | lorem ipsum | lorem ipsum dolor | lorem ipsum dolor sit |
lorem ipsum dolor sit | lorem ipsum dolor sit | lorem ipsum dolor sit | lorem ipsum dolor sit |
lorem ipsum dolor sit | lorem ipsum dolor sit | lorem ipsum dolor sit | lorem ipsum dolor sit |
lorem ipsum dolor sit | lorem ipsum dolor sit | lorem ipsum dolor sit | lorem ipsum dolor sit |
Embedding
Plenty of social media sites offer the option of embedding certain parts of their site on your own site, such as YouTube and Twitter:
Inline HTML elements
HTML defines a long list of available inline tags, which you can mix with Markdown if you like. A complete list of which can be found on the Mozilla Developer Network.
Useful Resources
More information on Markdown can be found at the following links: