Skip to main content

Marky

A Markdown parser written in TypeScript that spits out HTML. Currently supports only a subset of the Markdown spec. Meant to be used with Deno.

Usage

import { marky } from "https://deno.land/x/marky/mod.ts";

const html = marky("**hi there**"); // => <p><strong>hi there</strong></p>

Spec

Bold text

Bold text is created by wrapping selected text with two asterisk characters.

There's **nothing** quite like a cold beverage on a hot summer night.

Italic text

Italic text is created by wrapping selected text with one underscore character.

There's _nothing_ quite like a cold beverage on a hot summer night.

Inline code

Inline code text is created by wrapping selected text with one backtick character.

There's `nothing` quite like a cold beverage on a hot summer night.

Striked out text

Striked out text is created by wrapping selected text with two tilde characters.

There's ~~nothing~~ quite like a cold beverage on a hot summer night.

Paragraphs

Paragraphs are created by simply leaving one empty line break between text, which, technically means having two line breaks, but remember it as just one empty line between text.

Headings

Headings are created by adding a octothorp (hashtag) character in front of a block of text that is separated from others by one empty line.

# This is a big title

And some paragraph goes here.

## A little smaller title

And another paragraph goes here.

As you can see, the smaller the amount of octothorp characters the bigger the title will be. You can use as many octothorps as you wish, but browsers can only recognize up to 6 of them.

To-do until stable release

  • Parse bold text
  • Parse italic text
  • Parse paragraphs
  • Parse inline code
  • Parse striked out text
  • Parse headings
  • Parse code blocks
  • Parse links
  • Parse images
  • Parse quote blocks (and nested quote blocks!)
  • Parse unordered lists (and nested lists!)
  • Parse ordered lists (and nested lists!)
  • Parse horizontal line separators