Moodle Markdown editing – hidden treasure Part 12
Part 12 of our using Markdown in Moodle, using HTML and special characters.
Previous posts in this series
- Introduction to Markdown – https://wp.me/p8KJp1-No
- Editor preferences – https://wp.me/p8KJp1-Nx
- Text formatting with Markdown – https://wp.me/p8KJp1-NJ
- Creating headings with Markdown – https://wp.me/p8KJp1-NQ
- Markdown to create lists – https://wp.me/p8KJp1-O4
- Quoted paragraphs – https://wp.me/p8KJp1-O8
- Adding links with Markdown – https://wp.me/p8KJp1-Oc
- Markdown for images – https://wp.me/p8KJp1-Of
- Line breaks and rules – https://wp.me/p8KJp1-Ok
- Tables with Markdown – https://wp.me/p8KJp1-Om
- Definition lists and Footnotes – https://wp.me/p8KJp1-Oq
If you are already proficient in HTML then there may be occasions when Markdown does not allow you as much control as you are used to. Luckily Markdown is designed for this eventuality and allows you to embed HTML directly within Markdown formatted text.
Note that the HTML markup co-exists with the Markdown code for bullet lists. This frees you from the task of writing complex HTML for basic formatting features such as paragraphs and lists, while still allowing you to access the power of HTML in specific situations.
Displaying HTML or performatted text
If you wish the HTML you enter to be displayed exactly as you typed it, rather than processed as HTML then you can start each line with four space characters.
<p>A paragraph in <b>HTML</b> displayed as code</p>
This also works for displaying computer code:
print "Command-line arguments: (@ARGV)\n";
As this formatting is often used for computer program listings and other text which may plausibly contain the characters that Markdown uses to indicate different types of formatting, Markdown’s formatting is switched off for these lines:
Normally this word would be **bold**.
To include such characters within normal text, see the section below.
Special characters
If you wish to use any of the special characters that trigger Markdown formatting without them being processed simply precede them with a backslash character (\). This is known as ‘escaping’ a character. The backslash is not displayed but the character immediately following it is shown, exactly as entered.
\*asterisks, not emphasis\*
becomes
*asterisks, not emphasis*
rather than
*emphasis, not asterisks*
which gives
emphasis, not asterisks
More on Markdown in Moodle next month !
- H5P periodic table – 8th September 2023
- Moodle 4.0 – 15th May 2022
- Moodle 4.0 other highlights – 14th May 2022