Make your HTML look like Markdown
This is a <p> element. That heading above is a real <h1>. Normal semantic HTML, styled to look like plain text.
That’s Remarkdown in a nutshell: a stylesheet that styles HTML to look like Markdown text. I’m not sure it’s useful, I’ve rarely used it myself; I simply made it because I could.
Usage with a CDN
You can use Remarkdown with a CDN like jsDelivr (recommended) or unpkg. When using the main remarkdown.css stylesheet, you will need to add class="remarkdown" on a container wrapping all the text you want to style, like this:
<!doctype html>
<html lang="en">
<head>
<title>Using Remarkdown</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/remarkdown.css@4/dist/remarkdown.css">
</head>
<body class="remarkdown">
<h1>Hello World</h1>
<p>A paragraph.</p>
</body>
</html>
You can choose optional styles if you don’t love the defaults. For example, class="remarkdown h1-line ul-star" enables underlined <h1>s and asterisks for bullets.
Usage with npm
Remarkdown is published on npm as remarkdown.css. If you’re working in a project using npm (or pnpm or yarn, etc.) and maybe a code bundler like Vite, you should be able to install Remarkdown like so:
npm install remarkdown.css
Then in your JavaScript modules or CSS files, import one of the compiled stylesheets in the package’s dist folder:
/* In a CSS file processed by a bundler */
@import "remarkdown.css/dist/remarkdown.css";
// Or in a JS module processed by a bundler
import "remarkdown.css/dist/remarkdown.css";
The remarkdown.css package is also a Sass library, which can be used in Sass modules (.scss files):
@use "pkg:remarkdown.css" as rmd;
@include rmd.header();
@include rmd.styles();
Using it with Sass lets you customize the output further, especially when using the `rmd.config()` mixin. See “Build a custom stylesheet with Sass” for details.
Remarkdown variants
The pre-built Remarkdown stylesheet comes in a few variants, which change: what default styles are enabled; how optional styles are declared in HTML.
| Stylesheet | Defaults | HTML config |
|---|---|---|
| remarkdown.css | normal | class="remarkdown (…)" |
| remarkdown.attr.css | normal | data-remarkdown="(…)" |
| remarkdown-zero.css | resets only | class="remarkdown (…)" |
| remarkdown-zero.attr.css | resets only | data-remarkdown="(…)" |
You can make your own variant using the Sass library with custom values for $default-styles, $option-selector and more.
More info
- Author: Florens Verschelde
- License: MIT License
- Package: remarkdown.css
- Repository: fvsch/remarkdown
- Browser support: Baseline Widely Available
Similar projects
As far as I’m aware, when I created Remarkdown v1 in 2011, it was the first published implementation of this strange idea of styling HTML like Markdown.
Other implementations include Peter Coles’ Markdown.css; I’ve also seen a bunch of developer-centric web pages use some hand-rolled Markdown-ish styling for headings.