This is my Markdown compiler which is basically a big mess of regular expressions and a tokeniser sort-of-a-thing.
Link the script to your html file.
<script src="modules.surge.sh/markdown-compiler/script.js"></script>
Add a markdown tag with the markdown typed directly inside the tag, or linking with the source attribute.
<markdown src="path/to/markdown-file.md"></markdown>
or
<markdown>
# Heading
[link](https://example.com)
</markdown>
Markdown | HTML | Description |
---|---|---|
# Heading 1 | <h1 id="heading-1">Heading 1</h1> | Heading 1 |
## Heading 2 | <h2 id="heading-2">Heading 2</h2> | Heading 2 |
### And a heading 3 | <h3 id="and-a-heading-3">Heading 3</h3> | Heading 3 |
*Italic* | <i>Italic</i> | Italic |
**Bold** | <b>Bold</b> | Bold |
***Bold and Italic*** | <b>Bold</b><i>Bold and Italic</i> | Bold and italic |
~~Strikethrough~~ | <s>Strikethrough</s> | Strikethrough |
==Highlight== | <mark>Highlight</mark> | Highlight |
[Link](https://example.com) | <a href="https://example.com">Link</a> | Link |
![Alt text](https://example.com/image.png) | <img src="https://example.com/image.png" alt="Alt text"> | Image |
--- | <hr> | Horizontal rule |
`inline code block` | <code>inline code block</code> | Inline code block |
```put multi line code in here``` | <code>put multi line code in here</code> | Code block |
> This is a blockquote. | <blockquote>This is one blockquote.</blockquote> | Blockquote |
- List item 1 - List item 2 - List item 3 |
<ul><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul> | Unordered list |
1. List item 1 2. List item 2 3. List item 3 |
<ol><li>List item 1</li><li>List item 2</li><li>List item 3</li></ol> | Ordered list |
| Column 1 | Column 2 | | Thing | Thingy | |
Table |
Other notes:
- Heading id's default to what's in them, to lower case, with "-" instead of spaces.
- You can change the id of a heading by typing {#your-custom-id} after it (there must be a space between the heading and the opening curly brace)
- Put a "+" after a link to make it open in a new tab, e.g. [Link](https://example.com)+