|
1 |
| -# github-markdown-css |
| 1 | +# GitHub Markdown Theme for Visual Studio Code |
2 | 2 |
|
3 |
| -> The minimal amount of CSS to replicate the GitHub Markdown style |
4 |
| -
|
5 |
| -**The CSS is generated. Contributions should go to [this repo](https://github.com/sindresorhus/generate-github-markdown-css).** |
6 |
| - |
7 |
| -[<img src="https://cloud.githubusercontent.com/assets/170270/5219062/f22a978c-7685-11e4-8316-af25b6c89bc0.png" width="300">](http://sindresorhus.com/github-markdown-css) |
| 3 | +This CSS stylesheet allows you to preview markdown files in Visual Studio Code in GitHub's mardown flavour. It is taken from [sindresorhus/github-markdown-css](https://github.com/sindresorhus/github-markdown-css) but optimized for VC. |
8 | 4 |
|
9 | 5 | ## [Demo](https://sindresorhus.com/github-markdown-css)
|
10 | 6 |
|
11 |
| -## Install |
12 |
| - |
13 |
| -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: |
14 |
| - |
15 |
| -``` |
16 |
| -$ npm install github-markdown-css |
17 |
| -``` |
18 |
| - |
19 |
| -## Usage |
20 |
| - |
21 |
| -Import the `github-markdown.css` file and add a `markdown-body
8000
` 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. |
| 7 | +## Installation |
22 | 8 |
|
23 |
| -```html |
24 |
| -<meta name="viewport" content="width=device-width, initial-scale=1"> |
25 |
| -<link rel="stylesheet" href="github-markdown.css"> |
26 |
| -<style> |
27 |
| - .markdown-body { |
28 |
| - box-sizing: border-box; |
29 |
| - min-width: 200px; |
30 |
| - max-width: 980px; |
31 |
| - margin: 0 auto; |
32 |
| - padding: 45px; |
33 |
| - } |
| 9 | +Open the [User Settings](https://code.visualstudio.com/docs/languages/markdown#_using-your-own-css) and add the following setting: |
34 | 10 |
|
35 |
| - @media (max-width: 767px) { |
36 |
| - .markdown-body { |
37 |
| - padding: 15px; |
38 |
| - } |
39 |
| - } |
40 |
| -</style> |
41 |
| -<article class="markdown-body"> |
42 |
| - <h1>Unicorns</h1> |
43 |
| - <p>All the things</p> |
44 |
| -</article> |
| 11 | +```json |
| 12 | +"markdown.styles": [ |
| 13 | + "https://cdn.jsdelivr.net/gh/macx/github-markdown-css/github-markdown.css" |
| 14 | +], |
45 | 15 | ```
|
46 |
| - |
47 |
| -If you want code syntax highlighted, use GitHub Flavored Markdown rendered from [GitHub's `/markdown` API](https://docs.github.com/en/free-pro-team@latest/rest/reference/markdown). |
48 |
| - |
49 |
| -There are 3 themes provided in this package: |
50 |
| - |
51 |
| -- **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). |
52 |
| -- **github-markdown-light.css**: Light-only. |
53 |
| -- **github-markdown-dark.css**: Dark-only. |
54 |
| - |
55 |
| -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. |
56 |
| - |
57 |
| -## How |
58 |
| - |
59 |
| -See [`generate-github-markdown-css`](https://github.com/sindresorhus/generate-github-markdown-css) for how it's generated and ability to generate your own. |
60 |
| - |
61 |
| -## Dev |
62 |
| - |
63 |
| -Run `npm run make` to update the CSS. |
0 commit comments