github-markdown-css
The minimal amount of CSS to replicate the GitHub Markdown style
Last updated 10 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install github-markdown-css 
SYNC missed versions from official npm registry.

github-markdown-css

The minimal amount of CSS to replicate the GitHub Markdown style

The CSS is generated. Contributions should go to this repo.

Demo

Install

Download manually, from CDNJS, or with npm:

npm install github-markdown-css

Usage

Import the github-markdown.css file and add a markdown-body class to the container of your rendered Markdown and set a width for it. GitHub uses 980px width and 45px padding, and 15px padding for mobile.

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="github-markdown.css">
<style>
	.markdown-body {
		box-sizing: border-box;
		min-width: 200px;
		max-width: 980px;
		margin: 0 auto;
		padding: 45px;
	}

	@media (max-width: 767px) {
		.markdown-body {
			padding: 15px;
		}
	}
</style>
<article class="markdown-body">
	<h1>Unicorns</h1>
	<p>All the things</p>
</article>

You can use GitHub's /markdown API to turn Markdown into the HTML that GitHub generates, which works well with the CSS in this repo. Other Markdown parsers will mostly work with these styles too. To mimic how GitHub highlights code, you can use starry-night with your Markdown parser of choice.

There are 3 themes provided in this package:

  • github-markdown.css: (default) Automatically switches between light and dark through @media (prefers-color-scheme).
  • github-markdown-light.css: Light-only.
  • github-markdown-dark.css: Dark-only.

You may know that now GitHub supports more than 2 themes including dark_dimmed, dark_high_contrast and colorblind variants. If you want to try these themes, you can generate them on your own! See next section.

How

See generate-github-markdown-css for how it's generated and ability to generate your own.

Dev

Run npm run make to update the CSS.

Current Tags

  • 5.2.0                                ...           latest (2 years ago)

42 Versions

  • 5.2.0                                ...           2 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 4.0.0                                ...           5 years ago
  • 3.0.1                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.10.0                                ...           7 years ago
  • 2.9.0                                ...           7 years ago
  • 2.8.0                                ...           7 years ago
  • 2.7.0                                ...           8 years ago
  • 2.6.0                                ...           8 years ago
  • 2.5.0                                ...           8 years ago
  • 2.4.1                                ...           8 years ago
  • 2.4.0                                ...           8 years ago
  • 2.3.0                                ...           9 years ago
  • 2.2.1                                ...           9 years ago
  • 2.2.0                                ...           9 years ago
  • 2.1.1                                ...           9 years ago
  • 2.1.0                                ...           9 years ago
  • 2.0.11                                ...           9 years ago
  • 2.0.10                                ...           9 years ago
  • 2.0.9                                ...           10 years ago
  • 2.0.8                                ...           10 years ago
  • 2.0.7                                ...           10 years ago
  • 2.0.6                                ...           10 years ago
  • 2.0.5                                ...           10 years ago
  • 2.0.4                                ...           10 years ago
  • 2.0.3                                ...           10 years ago
  • 2.0.2                                ...           10 years ago
  • 2.0.1                                ...           10 years ago
  • 2.0.0                                ...           10 years ago
  • 1.2.2                                ...           10 years ago
  • 1.2.1                                ...           10 years ago
  • 1.2.0                                ...           10 years ago
  • 1.1.1                                ...           10 years ago
  • 1.1.0                                ...           10 years ago
  • 1.0.3                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 0.2.0                                ...           10 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 16
Last Day 0
Last Week 16
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |