mirror of
https://github.com/sindresorhus/github-markdown-css.git
synced 2024-03-22 13:10:53 +08:00
Compare commits
72 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b3977a0367 | ||
|
9411b377b5 | ||
|
220cab500a | ||
|
f03290ff30 | ||
|
b336b4215c | ||
|
1363826bdf | ||
|
f45eec9fe1 | ||
|
b8b9732e99 | ||
|
5ec832f378 | ||
|
2380451e75 | ||
|
ec90c8c72e | ||
|
9719250aca | ||
|
afa572390d | ||
|
95f4064ac3 | ||
|
4dc9af74a5 | ||
|
5a667d5749 | ||
|
b1d8b9fc0d | ||
|
4869cfc433 | ||
|
888d5a0322 | ||
|
1485dd78f5 | ||
|
28b11434c1 | ||
|
8e8d8570e8 | ||
|
6616212a2a | ||
|
12ab131553 | ||
|
e3c7e7f89d | ||
|
7b0d2e1014 | ||
|
0d25bb4525 | ||
|
4d639a534a | ||
|
e91ece348f | ||
|
7308c9ab9a | ||
|
09cdf605da | ||
|
a5b85d1821 | ||
|
3d272011a5 | ||
|
3fc8bc8a14 | ||
|
db0ab249ce | ||
|
c59b17b20d | ||
|
576e8f6479 | ||
|
6572802925 | ||
|
9981e77689 | ||
|
f7cd505bfa | ||
|
322382b050 | ||
|
34876406f5 | ||
|
7b86e65de4 | ||
|
016093225b | ||
|
f73e0a064d | ||
|
d666bcdd41 | ||
|
b526564124 | ||
|
dece7585bb | ||
|
b6428abecd | ||
|
ac5e7d1dcf | ||
|
033e86abcb | ||
|
a16c76cfcb | ||
|
b99cdc49a3 | ||
|
2639504756 | ||
|
029b30908f | ||
|
2120fb447b | ||
|
ac2b917fc3 | ||
|
33f885115b | ||
|
8da2badcd5 | ||
|
1c6099e340 | ||
|
897c52802e | ||
|
1829d3972e | ||
|
5c797a57e8 | ||
|
77612f1aab | ||
|
66bde9cbf9 | ||
|
bb90abdda8 | ||
|
ef6bc860e8 | ||
|
1f877b6522 | ||
|
4cac7ec8c6 | ||
|
8ea32e927f | ||
|
a5fd2bc5c8 | ||
|
80183241e1 |
@ -7,9 +7,6 @@ charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[package.json]
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1 +1 @@
|
||||
* text=auto
|
||||
* text=auto eol=lf
|
||||
|
3
.github/security.md
vendored
Normal file
3
.github/security.md
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Security Policy
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
node_modules
|
||||
yarn.lock
|
||||
|
19
bower.json
19
bower.json
@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "github-markdown-css",
|
||||
"description": "The minimal amount of CSS to replicate the GitHub Markdown style",
|
||||
"license": "MIT",
|
||||
"main": "github-markdown.css",
|
||||
"keywords": [
|
||||
"github",
|
||||
"markdown",
|
||||
"md",
|
||||
"css",
|
||||
"style",
|
||||
"stylesheet"
|
||||
],
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"package.json",
|
||||
"index.html"
|
||||
]
|
||||
}
|
1084
github-markdown-dark.css
Normal file
1084
github-markdown-dark.css
Normal file
File diff suppressed because it is too large
Load Diff
1083
github-markdown-light.css
Normal file
1083
github-markdown-light.css
Normal file
File diff suppressed because it is too large
Load Diff
1174
github-markdown.css
1174
github-markdown.css
File diff suppressed because it is too large
Load Diff
1863
index.html
1863
index.html
File diff suppressed because it is too large
Load Diff
22
license
22
license
@ -1,21 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
69
package.json
69
package.json
@ -1,33 +1,40 @@
|
||||
{
|
||||
"name": "github-markdown-css",
|
||||
"version": "2.0.5",
|
||||
"description": "The minimal amount of CSS to replicate the GitHub Markdown style",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/github-markdown-css",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"generate": "github-markdown-css !> github-markdown.css"
|
||||
},
|
||||
"files": [
|
||||
"github-markdown.css"
|
||||
],
|
||||
"keywords": [
|
||||
"browser",
|
||||
"github",
|
||||
"markdown",
|
||||
"md",
|
||||
"css",
|
||||
"style",
|
||||
"stylesheet"
|
||||
],
|
||||
"devDependencies": {
|
||||
"generate-github-markdown-css": "^1.0.1"
|
||||
}
|
||||
"name": "github-markdown-css",
|
||||
"version": "5.5.1",
|
||||
"description": "The minimal amount of CSS to replicate the GitHub Markdown style",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/github-markdown-css",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"main": "github-markdown.css",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"make:light": "github-markdown-css --type light > github-markdown-light.css",
|
||||
"make:dark": "github-markdown-css --type dark > github-markdown-dark.css",
|
||||
"make:auto": "github-markdown-css --type auto > github-markdown.css",
|
||||
"make": "npm run make:light && npm run make:dark && npm run make:auto"
|
||||
},
|
||||
"files": [
|
||||
"github-markdown.css",
|
||||
"github-markdown-dark.css",
|
||||
"github-markdown-light.css"
|
||||
],
|
||||
"keywords": [
|
||||
"browser",
|
||||
"github",
|
||||
"markdown",
|
||||
"md",
|
||||
"css",
|
||||
"style",
|
||||
"stylesheet"
|
||||
],
|
||||
"devDependencies": {
|
||||
"generate-github-markdown-css": "^6.2.0"
|
||||
}
|
||||
}
|
||||
|
45
readme.md
45
readme.md
@ -2,36 +2,40 @@
|
||||
|
||||
> The minimal amount of CSS to replicate the GitHub Markdown style
|
||||
|
||||
**The CSS is generated. Contributions should go to [this repo](https://github.com/sindresorhus/generate-github-markdown-css).**
|
||||
|
||||
[<img src="https://cloud.githubusercontent.com/assets/170270/5219062/f22a978c-7685-11e4-8316-af25b6c89bc0.png" width="300">](http://sindresorhus.com/github-markdown-css)
|
||||
|
||||
## [Demo](http://sindresorhus.com/github-markdown-css)
|
||||
|
||||
## [Demo](https://sindresorhus.com/github-markdown-css)
|
||||
|
||||
## Install
|
||||
|
||||
Download [manually](https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css) or with a package-manager.
|
||||
Download [manually](https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css), from [CDNJS](https://cdnjs.com/libraries/github-markdown-css), or with npm:
|
||||
|
||||
```sh
|
||||
$ npm install --save github-markdown-css
|
||||
npm install github-markdown-css
|
||||
```
|
||||
|
||||
```sh
|
||||
$ bower install --save 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 `790px` width and `30px` padding.
|
||||
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.
|
||||
|
||||
```html
|
||||
<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: 790px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 30px;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<article class="markdown-body">
|
||||
@ -40,17 +44,20 @@ Import the `github-markdown.css` file and add a `markdown-body` class to the con
|
||||
</article>
|
||||
```
|
||||
|
||||
You can use [GitHub's `/markdown` API](https://docs.github.com/en/free-pro-team@latest/rest/reference/markdown) 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`](https://github.com/wooorm/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)`](https://developer.mozilla.org/en-US/docs/Web/CSS/@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`](https://github.com/sindresorhus/generate-github-markdown-css) for how it's generated and ability to generate your own.
|
||||
|
||||
|
||||
## Dev
|
||||
|
||||
Run `npm run generate` to update the CSS.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Run `npm run make` to update the CSS.
|
||||
|
Loading…
x
Reference in New Issue
Block a user