<mark-down>

Markdown as a
native HTML element

Drop in two files, write markdown directly in your HTML. no build step, no npm, no configuration.

index.html
<html> <body> <div class="content"> <mark-down> # Hello, World! Welcome to **mark-down.js** — a tiny library that renders *markdown* as a native HTML element. - Zero dependencies - Shadow DOM isolated - Works everywhere </mark-down> </div> </body> </html>
Preview
# Hello, World! Welcome to **mark-down.js** — a tiny library that renders *markdown* as a native HTML element. - Zero dependencies - Shadow DOM isolated - Works everywhere

Why mark-down.js

Everything you need,
nothing you don't

Built on Web Components standards. No build step, no npm, no framework required — just two files.

Zero dependencies

One .js and one .css file. No npm, no bundler, no configuration of any kind.

🧩

Web Components

Built on the native Custom Elements API. Works in all modern browsers alongside any framework — or none.

🛡️

Shadow DOM isolation

Styles never bleed in or out. Your page and your markdown content stay completely independent.

✂️

Smart auto-dedent

Write naturally indented markdown inside your HTML. Common leading whitespace is stripped automatically.

🎨

Inherits your colors

Uses currentColor and relative units — adapts to your page's text color and font size seamlessly.

📐

Full markdown syntax

Headings, bold, italic, strikethrough, code blocks, blockquotes, callouts, nested lists, task lists, tables, links, and images.

🔄

Dynamic content

Elements added to the DOM after page load render automatically via connectedCallback.

🪶

Tiny footprint

~200 lines of readable JavaScript. Easy to audit, easy to understand, easy to fork.


Get started

Up and running in 3 steps

No configuration required. Add two files and start writing markdown anywhere in your HTML.

01 — Download

Grab the files

Download mark-down.js and mark-down.css and place them in your project. That's the entire install.

02 — Include

Add the script tag

Add mark-down.js to your <head> with defer. The CSS loads automatically from the same folder.

03 — Write

Use the element

Place <mark-down> anywhere in your page body, write markdown inside it, and open in a browser.

index.html
<!-- Load once in <head> -->
<script src="src/mark-down.js" defer></script>

<!-- Use anywhere in <body> -->
<mark-down>
  # Hello, World!

  This is **bold**, this is *italic*, and this is `inline code`.

  - Item one
  - Item two
  - Item three

  > A blockquote with *formatted* content inside.

  ```js
  console.log("Hello from a code block!");
  ```
</mark-down>

Live demo

See it in action

These are real <mark-down> elements rendered by the library right now on this page.

Headings & inline formatting
# Heading 1 ## Heading 2 ### Heading 3 **Bold**, *italic*, ***bold italic***, ~~strikethrough~~ and `inline code`.
Lists & nested lists
**Unordered list** - Apples - Bread - Sourdough - Rye - **Cheese** (the good kind) **Ordered list** 1. Clone the repo 2. Add the files - `src/mark-down.js` - `src/mark-down.css` 3. Write markdown
Task lists
**Project checklist** - [x] Set up the repository - [x] Add `src/mark-down.js` and `src/mark-down.css` - [x] Write some markdown - [ ] Write documentation - [ ] Deploy to production
Code block
```js function greet(name) { return `Hello, ${name}!`; } console.log(greet("world")); ```
Blockquote & horizontal rule
> "Any sufficiently advanced technology is > indistinguishable from magic." > — Arthur C. Clarke --- A paragraph after the horizontal rule.
Callouts
> [!NOTE] > Highlights information users should take into account. > [!TIP] > Optional info to help a user be more successful. > [!WARNING] > Critical content demanding immediate user attention. > [!CAUTION] > Negative potential consequences of an action.
Table
| Character | Race | Weapon | Known for | | ---------- | ------- | --------------- | -------------------------------- | | Bilbo | Hobbit | Sting | Finding the One Ring | | Gandalf | Wizard | Staff & sword | "You shall not pass!" | | Thorin | Dwarf | Orcrist | Reclaiming the Lonely Mountain | | Legolas | Elf | Bow & knives | Extraordinary eyesight | | Gollum | Hobbit | None | "My precious" |

Reference

Supported syntax

All standard markdown constructs — write it exactly the way you already know.

MarkdownOutputNotes
# Heading 1H1 through H6One to six # characters followed by a space
**bold**boldAlso works with __double underscores__
*italic*italicAlso works with _single underscores_
***bold italic***bold italicTriple asterisks for both at once
~~strikethrough~~strikethroughDouble tildes
`inline code`inline codeSingle backtick; content is HTML-escaped
```lang … ```Code blockFenced triple backticks; optional language hint
- itemUnordered listBullet characters: -, *, or +
1. itemOrdered listAny digit followed by a period and space
  - sub-itemNested listIndent sub-items with 2+ spaces; can mix ordered and unordered
- [ ] taskTask list[ ] unchecked, [x] checked; nests and mixes freely
> quoteBlockquoteMarkdown renders recursively inside blockquotes
> [!NOTE]CalloutGitHub-style alerts: NOTE, TIP, IMPORTANT, WARNING, CAUTION
---Horizontal ruleThree or more ---, ***, or ___
[text](url)LinkStandard inline link syntax
![alt](url)ImageRenders responsive with max-width: 100%
| col | col |TableGFM pipe table with header separator row
two trailing spacesLine breakHard <br> within a paragraph

Theming

Make it yours

Every color, font, and border is a CSS variable — link a pre-built theme or override only what you need.


Ready to get started?

Two files. No build step. No npm. Just drop them in and start writing markdown in your HTML today.

Get started → View on GitHub