Michael Hall

SVG Image

Welcome to my academic website


Markdown Syntax Reference

markdown references

Overview

This document is a collection of helpful Markdown syntax I’ve gathered for writing Markdown documents. It’s intended to provide useful tips and tricks, and will continue to evolve over time. It will serve as a quick reference for finding Markdown syntax.

Quick Reference

Horizontal Spaces

Space TypeHTMLRendered Example
No spaceABC
Regular space(regular space)A B
Non-breaking space A B
Three non-breaking spaces   A   B
En space A B
Em space A B
Hair space A B
Thin space A B
Medium mathematical space A B
Four-Per-Em space A B
Six-Per-Em space A B
Figure space 1 2
Punctuation space A B
Narrow no-break space A B
Zero width space​A​B
CSS margin space<span style="margin-left: 50px;"></span>AB
CSS width space<span style="display: inline-block; width: 2em;"/></span>AB

  • Note, using <span> to create space makes the space visible, but it doesn’t insert actual space characters.

Dashes

Dash TypeMarkdownHTMLRendered Output
Hyphen--
En dash&ndash;
Em dash&mdash;
Double hyphen--
Triple hyphen---

Depending on the engine, the double or triple hyphen may render as an En dash or Em dash.

Layout Tricks

Block Quotes

  • To create a block quote with indentation, use the > symbol only on the first line. For subsequent lines, indent them to match the desired level, but do not repeat the >.

    • Markdown code:

        > Line one  
          Line two  
          Line three
      
    • Result (with indentation applied):

      Line one
      Line two
      Line three

  • HTML markup for block quotes:

    • HTML code:
      <blockquote>
      Line one <br>
      Line two <br>
      Line three
      </blockquote>
      
    • Result:
      Line one
      Line two
      Line three

Highlighting Text

Highlight text using the <mark> tag:
  • Default styling:
    • <mark>Highlighted text</mark>
    • Highlighted text
  • With rounded corners and padding:
    • <mark style="border-radius: 5px; padding: 2px;">Highlighted text</mark>
    • Highlighted text
  • Custom background – Yellow:
    • <mark style="background-color: yellow;">Highlighted text</mark>
    • Highlighted text
  • Custom background – Burlywood:
    • <mark style="background-color: burlywood;">Highlighted text</mark>
    • Highlighted text
You can alternatively also use the <span> tag and specify a background color:
  • Simple:
    • <span style="background-color: yellow;">Highlighted text</span>
    • Highlighted text
  • With rounded corners and padding:
    • <span style="background-color: yellow; border-radius: 5px; padding: 2px;">Highlighted text</span>
    • Highlighted text
For reference, here are some quick tags for copy-paste:
TagPurposeHTML – Inlined StyleHTML – Class
TODOMarks content that still needs to be added<mark style="background-color: yellow; border-radius: 5px; padding: 2px;">TODO</mark><mark class="todo">TODO</mark>
FIXMEFlags something broken or incorrect<mark style="background-color: tomato; border-radius: 5px; padding: 2px;">FIXME</mark><mark class="fixme">FIXME</mark>
FILL INPlaceholder for future content<mark style="background-color: mediumturquoise; border-radius: 5px; padding: 2px;">FILL IN</mark><mark class="fillin">FILLIN</mark>
NOTEAdds clarification or helpful information<mark style="background-color: lightblue; border-radius: 5px; padding: 2px;">NOTE</mark><mark class="note">NOTE</mark>
REVIEWNeeds to be looked at again or checked<mark style="background-color: violet; border-radius: 5px; padding: 2px;">REVIEW</mark><mark class="review">REVIEW</mark>
DRAFTIndicates incomplete or rough content<mark style="background-color: peachpuff; border-radius: 5px; padding: 2px;">DRAFT</mark><mark class="draft">DRAFT</mark>
OPTIONALDenotes optional or extra content<mark style="background-color: palegreen; border-radius: 5px; padding: 2px;">OPTIONAL</mark><mark class="optional">OPTIONAL</mark>
MOVESuggests that content should be relocated<mark style="background-color: khaki; border-radius: 5px; padding: 2px;">MOVE</mark><mark class="move">MOVE</mark>
REWRITEContent should be reworded or restructured<mark style="background-color: lightsalmon; border-radius: 5px; padding: 2px;">REWRITE</mark><mark class="rewrite">REWRITE</mark>

The style class definitions for these tags are the following:

<style>
  .todo { background-color: yellow; border-radius: 5px; padding: 2px; }
  .fixme { background-color: tomato; border-radius: 5px; padding: 2px; }
  .fillin { background-color: mediumturquoise; border-radius: 5px; padding: 2px; }
  .note { background-color: lightblue; border-radius: 5px; padding: 2px; }
  .review { background-color: violet; border-radius: 5px; padding: 2px; }
  .draft { background-color: peachpuff; border-radius: 5px; padding: 2px; }
  .optional { background-color: palegreen; border-radius: 5px; padding: 2px; }
  .move { background-color: khaki; border-radius: 5px; padding: 2px; }
  .rewrite { background-color: lightsalmon; border-radius: 5px; padding: 2px; }
</style>

Creating a colored box

  • Using div for a block-level colored box:
    • Text: <div style="width: 30px; height: 15px; background-color: lime; border-radius: 3px;"></div>
    • Text:
  • Using span to inline display:
    • Text: <span style="display: inline-block; width: 30px; height: 15px; background-color: lime; border-radius: 3px;"></span>
    • Text:

Advanced Features

How to use CSS in Markdown

There are two main ways to insert CSS into Markdown:

  • Inline CSS:
    • Quick and easy to do inline. But it can become messy if it gets large, or is repeated many times with different parts of the Markdown document.
    • <div style="background-color: wheat; padding: 20px; border-radius: 20px; text-align: center; font-family: serif; font-size:25px; width: 200px">Hello World!</div>
    • Hello World!
  • Internal CSS:
    • Create CSS classes that can be reused in the Markdown document. Good if used a lot.
    • Add a <style> tag anywhere in the Markdown document and write CSS code within the tag.
    • <style>
          .custom-class-example {
              background-color: wheat;
              padding: 20px;
              text-align: center;
              font-family: serif;
              font-size:25px;
              width: 200px;
          }
      </style>
      
    • <div class="custom-class-example">Hello World!</div>
    • Hello World!
    • Alternatively you can create a new tag as well:
      <style>
          custom-tag-example {
              display: inline-block;            
              background-color: wheat;
              padding: 20px;
              border-radius: 20px;
              text-align: center;
              font-family: serif;
              font-size:25px;
              width: 200px;
          }
      </style>
      
    • <custom-tag-example>Hello World!</custom-tag-example>
    • Hello World!

How to write LaTeX math equations

LaTeX is integrated using the KaTeX library. This is done by loading a CSS stylesheet and scripts in the <head> tag of the HTML page as described in the docs. Below is a version of the code:

<html>
  <head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css" integrity="sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC" crossorigin="anonymous">
    
    <!-- The loading of KaTeX is deferred to speed up page rendering -->
    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.js" integrity="sha384-X/XCfMm41VSsqRNQgDerQczD69XqmjOOOwYQvr/uuC+j4OPoNhVgjdGFwhvN02Ja" crossorigin="anonymous"></script>
    
    <!-- To automatically render math in text elements, include the auto-render extension: -->
    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
        onload="renderMathInElement(document.body);"></script>
  </head>
</html>

Then write the math equations using the following syntax:

  • Inline equations:
    • $ y[n] = b_{0}x[n] + b_{1}x[n-1] + ... + b_{N}x[n-N] = \sum_{i=0}^{{N}} b_{i}. x[n-i] $
    • $ y[n] = b_{0}x[n] + b_{1}x[n-1] + … + b_{N}x[n-N] = \sum_{i=0}^{{N}} b_{i}. x[n-i] $
  • Display equations:
    • $$ y[n] = b_{0}x[n] + b_{1}x[n-1] + ... + b_{N}x[n-N] = \sum_{i=0}^{{N}} b_{i}. x[n-i] $$
    • $$ y[n] = b_{0}x[n] + b_{1}x[n-1] + ... + b_{N}x[n-N] = \sum_{i=0}^{{N}} b_{i}. x[n-i] $$

Conventions

Heading LevelStyle
H1Title
H2Subtitle
H3Heading 1
H4Heading 2
H5Heading 3
H6Heading 4

Last updated: April 16, 2025





Powered by Hugo and TatBan2.0 Theme | © Copyright Michael J. Hall | All rights reserved.

                Kudos        
MJH