Markdown is the lightweight markup language that powers the content of a Grav page. It’s simple to understand, human readable, and is used in an ever growing number of applications.
In this video, we’ll look at some of the most common markdown examples and how you can use them to create brilliant, well-formatted pages for your website.
Let’s start by talking about headers. Headers create large subtitles on your page, enabling you to highlight important points and define the different sections of your content.
Headers come in different sizes. Most themes support six levels of headings, which is also the HTML standard. Each header level represents a different size of text, making differentiating between main points and sub-points easier.
Many Grav themes use the first level, referred to as H1 in HTML, as the title of the page. So, let’s go over an example using a second-level header as the top level for our page’s content.
A level-two header can be created by simply adding two number signs (also referred to as pound and hash signs) and a single space before your heading text.
You can point out finer details and sub-topics by creating third and fourth-level headers using three and four number signs. With the right theme, you can continue this practice all the way down to a sixth-level header.
Bold and Italic
Markdown also makes it easy to create bold and italic text. Like many things in Markdown, there are multiple ways to do it.
The most common way is by using asterisks on either side of the text you want to bold or italicize. One asterisk for italic text, and two for bold.
Ordered (also called numbered) lists and unordered lists are a great way to break the content down into steps or create a list of items that is easy to read.
In markdown, this is a simple process. Let’s start with an unordered list.
Use an asterisk or dash and space before your first item on the list. Then, continue this on new lines for each additional item. You can create sub-items by adding two or four spaces before the asterisk or dash on a new line.
Ordered lists are done in much the same way, except instead of an asterisk, you’ll use a number and a period.
Ordered and unordered lists can even be combined.
Adding links to your content is really simple in markdown. Let’s say you wanted to add a link to Grav’s official website to this text here. All you have to do is surround the text you want to create a hyperlink within brackets. Then, in parathesis, add the URL you want the link to go to.
That’s it! You’ve turned text into a hyperlink!
Let’s say you want to add an image to your page. That’s really easy to do in Markdown.
I have an image here called example.jpg. To add it to my page, I just need to do the following:
Create a new line.
Add an exclamation mark. This lets Grav know I want to render the image I’m about to link to. Then, add brackets and place some descriptive text between them. This becomes the image’s alternative text which appears should the image not render properly on the page. Finally, a parenthesis containing the link to the image. This can be a relative link or an external URL.
Once you’ve done this, close the parenthesis and check out your work!
These are just a handful of cool things you can do with Markdown in Grav. There are many great tutorials online to help you get even more out of Markdown.
Don’t have time to learn a lot of Markdown right away? Don’t worry, Grav has these basic Markdown commands built into the toolbar in the Admin Panel. Just give them a click and Grav will provide the syntax.
It’s just another way that Grav makes creating content for your website easier.
Notice an error? Think you can improve this documentation? Edit this Page