my avatar Bahaa Zidan

GitHub Flavoured Markdown

GitHub Flavoured Markdown hero image

Strikethrough, Table, Autolink literals, Footnote, and Tasklist. Those are the things GitHub supports in any markdown hosted on their website. remark-gfm brings all those features to any projoct that support remark or unified.

Installation

pnpm add -D remark-gfm
import remarkGfm from 'remark-gfm';
 
const contentHTML = (
	await unified()
		.use(remarkParse)
		.use(remarkRehype, { allowDangerousHtml: true })
		.use(rehypeSlug)
		.use(rehypeAutolinkHeadings, { behavior: 'wrap', properties: { className: ['link-hover'] } })
		.use(rehypePrettyCode, {
			theme: 'github-dark',
			transformers: [
				transformerCopyButton({
					visibility: 'hover',
					feedbackDuration: 3_000,
				}),
			],
		})
		.use(rehypeStringify, { allowDangerousHtml: true })
		.use(remarkGfm)
		.process(content)
).toString();

Usage

# GFM
 
## Autolink literals
 
www.example.com, https://example.com, and [email protected].
 
## Footnote
 
A note[^1]
 
[^1]: Big note.
 
## Strikethrough
 
~one~ or ~~two~~ tildes.
 
## Table
 
| a   | b   |   c |  d  |
| --- | :-- | --: | :-: |
 
## Tasklist
 
- [ ] to do
- [x] done

Live Examples

www.example.com, https://example.com, and [email protected].

Footnote

A note1

Strikethrough

one or two tildes.

Table

CSS Tailwind
overflow-wrap: normal; wrap-normal
overflow-wrap: break-word; wrap-break-word
overflow-wrap: anywhere; wrap-anywhere

Tasklist

  • to do
  • done

Footnotes

  1. Big note.