Grav - Markdown Syntax


Advertisements


Markdown syntax is defined as writing plain text in an easy to read and easy to write format, which is later converted into HTML code. Symbols like (*) or (`) are used in markdown syntax. These symbols are used to bold, creating headers and organize your content.

To use Markdown syntax, you must create a .md file in your user/pages/02.mypage folder. Enable Markdown Syntax in your \user\config\system.yaml configuration file.

Grav Markdown Syntax

There are many benefits of using Markdown syntax, some of them are as follows.

  • It is easy to learn and has minimum characters.

  • When you use markdown there are very few chances of having errors.

  • Valid XHTML output.

  • Your content and visual display is kept separate so that it does not affect the look of your website.

  • You can use any text editor or markdown application.

In the following sections, we will discuss the main elements of HTML that are used in markdown.

Headings

Each heading tag is created with # for each heading, i.e., from h1 to h6 the number of # increases as shown.

	#my new Heading
	##my new Heading
	###my new Heading
	####my new Heading
	#####my new Heading
	######my new Heading

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Comments

You can write comments in the following format.

<!—
This is my new comment
-->

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Horizontal rules

Horizontal rules are used to create a thematic break in between paragraphs. You can create breaks between paragraphs using any of the following methods.

  • ___ − Three underscores
  • --- − Three dashes
  • *** − Three asterisks

Open the md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Body Copy

Body copy can be defined as writing text in normal format in markdown syntax, no (p) tag is used

Example

It is a way of writing your plain text in an easy to read and write format, which later
gets converted into HTML code.

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Emphasis

Emphasis are the writing formats in markdown syntax that are used to bold, italicize or strikethrough a portion of text. Let us discuss them below −

Bold

A portion of text can be made bold using two (**) signs at either sides.

Example

The newest articles from **Advance Online Publication (AOP)** and the current issue.

In this example, we have to show ‘Advance Online Publication (AOP)’ word as bold.

Open the .md file in a browser as localhost/Grav/mypage, you will receive the following result −

Grav Markdown Syntax

Italics

Use “_” (underscores) sign at either sides of the word to italicize the text.

Example

The newest articles from _Advance Online Publication_ (AOP) and the current issues.

In this example, we have to italicize “Advance Online Publication” (AOP) word.

Open the .md file in a browser as localhost/Grav/mypage. This will give you the following result −

Grav Markdown Syntax

Strikethrough

Use two "~~" (tildes) on either sides of the word to strikethrough the word.

Example

The newest articles from ~~Advance Online Publication~~ (AOP) and the current issues.

In this example, we have to strike “Advance Online Publication” (AOP) word.

Open the .md file in a browser as localhost/Grav/mypage.. This will give you the following result −

Grav Markdown Syntax

Blockquote

To create a block quote, you must add an > sign before the sentence or the word.

Example

>The newest articles from Advance Online Publication (AOP) and the current issues.

In this example we have used a > sign before the sentence.

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Blockquote can also be used in the following way −

>The newest articles from Advance Online Publication (AOP) and the current issues.
>>> The newest articles from Advance Online Publication (AOP) and the current issues.

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Notices

Notices can be used to inform or notify about something important.

There are four types of notices − yellow, red, blue and green.

Yellow

You must use the >>> sign before a yellow notice type that describes !Info or information.

Example

>>>Neurotransmitter-gated ion channels of the Cys-loop receptor family are essential
mediators of fast neurotransmission throughout the nervous system and are implicated
in many neurological disorders.

Red

Use four >>>> signs before a red notice for a Warning.

Example

>>>>Neurotransmitter-gated ion channels of the Cys-loop receptor family are essential
mediators of fast neurotransmission throughout the nervous system and are implicated
in many neurological disorders.

Blue

Use five >>>>> signs for a Blue notice type, this describes a Note.

Example

>>>>>Neurotransmitter-gated ion channels of the Cys-loop receptor family are essential
mediators of fast neurotransmission throughout the nervous system and are implicated
in many neurological disorders.

Green

Use six >>>>>> signs before a Green notice type, this describes a Tip.

Example

>>>>>>Neurotransmitter-gated ion channels of the Cys-loop receptor family are essential
mediators of fast neurotransmission throughout the nervous system and are implicated
in many neurological disorders.

Open the md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Lists

In this section, we will understand how the unordered and ordered lists work in Grav.

Unordered

In an unordered list, bullets are used. Use *, - , +. symbols for bullets. Use the symbol with space before any text and the bullet will be displayed.

Example

+ Bullet
+ Bullet
+ Bullet
   -Bullet
   -Bullet
   -Bullet
   *Bullet

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Ordered

Add the numbers before you list something.

Example

1. Coffee
2. Tea
3. Green Tea

Open the .md file in a browser as localhost/Grav/mypage. This will give you the following result −

Grav Markdown Syntax

Code

In this section, we will understand how the Inline and block code “fences” work in Grav.

Inline Code

Make inline code using (`) for using codes in markdown.

Example

In the given example, '<section></section>' must be converted into code.

Open the .md file in a browser as localhost/Grav/mypage you will receive the following result −

Grav Markdown Syntax

Block code “fences”

Use (```) fences if you want to block multiple lines of code.

Example

```
You’re Text Here

```

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Tables

In Grav, tables are created by using pipes and dashes under the header section. Pipes must not be vertically aligned.

Example

| Number  |    Points       |
| ------  | -----------     |
|   1     | Eve Jackson 94  |
|   2     | John Doe 80     |
|   3     | Adam Johnson 67 |

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Right Aligned Text

To get the table contents at the right, you must add a colon on the right side of the dashes below headings.

| Number |     Points      |
| ------:| -----------:    |
|   1    | Eve Jackson 94  |
|   2    | John Doe 80     |
|   3    | Adam Johnson 67 |

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Links

In this section, we will understand how links work in Grav.

Basic Links

Links are made with the help of ([]) square brackets and (()) parenthesis. In [] brackets, you must write the content and in () write the domain name.

Example

[Follow the Given link](http://www.google.com)

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Add a Title

In this section, we will understand how to add a title in .md file.

Example

[Google](https://www.gogle.com/google/ "Visit Google!")

Open the .md file in a browser as localhost/Grav/mypage; you will receive the following result −

Grav Markdown Syntax

Images

Images are similar to a link but have an exclamation point at the start of the syntax.

Example

![Nature] (/Grav/images/Grav-images.jpg)

Open the .md file in a browser as localhost/Grav/mypage you will receive the following result −

Grav Markdown Syntax

Advertisements