Skip to content

Instantly share code, notes, and snippets.

@borekb
Last active January 19, 2024 14:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borekb/5d1dfeabc5886d3bc0f6 to your computer and use it in GitHub Desktop.
Save borekb/5d1dfeabc5886d3bc0f6 to your computer and use it in GitHub Desktop.
GitHub-style preview for stackedit.io

GitHub-style preview stylesheet for StackEdit.

The stylesheet is based on https://github.com/sindresorhus/github-markdown-css, see comments in github.css to learn what was updated.

How to use:

  1. Click "Raw" for the github.css file below
  2. Copy the URL
  3. Paste it into RawGit
  4. Copy the RawGit URL and add it in StackEdit > Settings > Extensions > UserCustom extension like this:
userCustom.onReady = function() {
    $('head').append('<link rel="stylesheet" href="https://cdn.rawgit.com/borekb/5d1dfeabc5886d3bc0f6/raw/7d2cc057503c683237b7d5bb2764d62c57e80153/github.css" />');
};

Enjoy!

/*
Custom rules first:
*/
#preview-contents {
text-align: left;
}
/*
Below is the copy of https://github.com/sindresorhus/github-markdown-css
with `.markdown-body` replaced with `#preview-contents`
*/
@font-face {
font-family: octicons-anchor;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAYcAA0AAAAACjQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABMAAAABwAAAAca8vGTk9TLzIAAAFMAAAARAAAAFZG1VHVY21hcAAAAZAAAAA+AAABQgAP9AdjdnQgAAAB0AAAAAQAAAAEACICiGdhc3AAAAHUAAAACAAAAAj//wADZ2x5ZgAAAdwAAADRAAABEKyikaNoZWFkAAACsAAAAC0AAAA2AtXoA2hoZWEAAALgAAAAHAAAACQHngNFaG10eAAAAvwAAAAQAAAAEAwAACJsb2NhAAADDAAAAAoAAAAKALIAVG1heHAAAAMYAAAAHwAAACABEAB2bmFtZQAAAzgAAALBAAAFu3I9x/Nwb3N0AAAF/AAAAB0AAAAvaoFvbwAAAAEAAAAAzBdyYwAAAADP2IQvAAAAAM/bz7t4nGNgZGFgnMDAysDB1Ml0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+23DU3t626rbs8/8adv+9DWknsHp3E17oCf+Z48rvEQNZ78paYM38qfk3v/u3l3u3GXN2Dmvmvpf1Srwk3pB/VSsp512bA/GG5i2WJ7wu430yQ5K3nFGiOqgtmSB5pJVSizwaacmUZzZhXLlZTq8qGGFY2YcSkqbth6aW1tRmlaCFs2016m5qn36SbJrqosG4uMV4aP2PHBmB3tjtmgN2izkGQyLWprekbIntJFing32a5rKWCN/SdSoga45EJykyQ7asZvHQ8PTm6cslIpwyeyjbVltNikc2HTR7YKh9LBl9DADC0U/jLcBZDKrMhUBfQBvXRzLtFtjU9eNHKin0x5InTqb8lNpfKv1s1xHzTXRqgKzek/mb7nB8RZTCDhGEX3kK/8Q75AmUM/eLkfA+0Hi908Kx4eNsMgudg5GLdRD7a84npi+YxNr5i5KIbW5izXas7cHXIMAau1OueZhfj+cOcP3P8MNIWLyYOBuxL6DRylJ4cAAAB4nGNgYoAALjDJyIAOWMCiTIxMLDmZedkABtIBygAAAA==) format('woff');
}
#preview-contents {
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
color: #333;
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
font-size: 16px;
line-height: 1.6;
word-wrap: break-word;
}
#preview-contents a {
background-color: transparent;
}
#preview-contents a:active,
#preview-contents a:hover {
outline: 0;
}
#preview-contents strong {
font-weight: bold;
}
#preview-contents h1 {
font-size: 2em;
margin: 0.67em 0;
}
#preview-contents img {
border: 0;
}
#preview-contents hr {
box-sizing: content-box;
height: 0;
}
#preview-contents pre {
overflow: auto;
}
#preview-contents code,
#preview-contents kbd,
#preview-contents pre {
font-family: monospace, monospace;
font-size: 1em;
}
#preview-contents input {
color: inherit;
font: inherit;
margin: 0;
}
#preview-contents html input[disabled] {
cursor: default;
}
#preview-contents input {
line-height: normal;
}
#preview-contents input[type="checkbox"] {
box-sizing: border-box;
padding: 0;
}
#preview-contents table {
border-collapse: collapse;
border-spacing: 0;
}
#preview-contents td,
#preview-contents th {
padding: 0;
}
#preview-contents * {
box-sizing: border-box;
}
#preview-contents input {
font: 13px/1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}
#preview-contents a {
color: #4078c0;
text-decoration: none;
}
#preview-contents a:hover,
#preview-contents a:active {
text-decoration: underline;
}
#preview-contents hr {
height: 0;
margin: 15px 0;
overflow: hidden;
background: transparent;
border: 0;
border-bottom: 1px solid #ddd;
}
#preview-contents hr:before {
display: table;
content: "";
}
#preview-contents hr:after {
display: table;
clear: both;
content: "";
}
#preview-contents h1,
#preview-contents h2,
#preview-contents h3,
#preview-contents h4,
#preview-contents h5,
#preview-contents h6 {
margin-top: 15px;
margin-bottom: 15px;
line-height: 1.1;
}
#preview-contents h1 {
font-size: 30px;
}
#preview-contents h2 {
font-size: 21px;
}
#preview-contents h3 {
font-size: 16px;
}
#preview-contents h4 {
font-size: 14px;
}
#preview-contents h5 {
font-size: 12px;
}
#preview-contents h6 {
font-size: 11px;
}
#preview-contents blockquote {
margin: 0;
}
#preview-contents ul,
#preview-contents ol {
padding: 0;
margin-top: 0;
margin-bottom: 0;
}
#preview-contents ol ol,
#preview-contents ul ol {
list-style-type: lower-roman;
}
#preview-contents ul ul ol,
#preview-contents ul ol ol,
#preview-contents ol ul ol,
#preview-contents ol ol ol {
list-style-type: lower-alpha;
}
#preview-contents dd {
margin-left: 0;
}
#preview-contents code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 12px;
}
#preview-contents pre {
margin-top: 0;
margin-bottom: 0;
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
#preview-contents .select::-ms-expand {
opacity: 0;
}
#preview-contents .octicon {
font: normal normal normal 16px/1 octicons-anchor;
display: inline-block;
text-decoration: none;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#preview-contents .octicon-link:before {
content: '\f05c';
}
.markdown-body>*:first-child {
margin-top: 0 !important;
}
.markdown-body>*:last-child {
margin-bottom: 0 !important;
}
#preview-contents a:not([href]) {
color: inherit;
text-decoration: none;
}
#preview-contents .anchor {
display: inline-block;
padding-right: 2px;
margin-left: -18px;
}
#preview-contents .anchor:focus {
outline: none;
}
#preview-contents h1,
#preview-contents h2,
#preview-contents h3,
#preview-contents h4,
#preview-contents h5,
#preview-contents h6 {
margin-top: 1em;
margin-bottom: 16px;
font-weight: bold;
line-height: 1.4;
}
#preview-contents h1 .octicon-link,
#preview-contents h2 .octicon-link,
#preview-contents h3 .octicon-link,
#preview-contents h4 .octicon-link,
#preview-contents h5 .octicon-link,
#preview-contents h6 .octicon-link {
color: #000;
vertical-align: middle;
visibility: hidden;
}
#preview-contents h1:hover .anchor,
#preview-contents h2:hover .anchor,
#preview-contents h3:hover .anchor,
#preview-contents h4:hover .anchor,
#preview-contents h5:hover .anchor,
#preview-contents h6:hover .anchor {
text-decoration: none;
}
#preview-contents h1:hover .anchor .octicon-link,
#preview-contents h2:hover .anchor .octicon-link,
#preview-contents h3:hover .anchor .octicon-link,
#preview-contents h4:hover .anchor .octicon-link,
#preview-contents h5:hover .anchor .octicon-link,
#preview-contents h6:hover .anchor .octicon-link {
visibility: visible;
}
#preview-contents h1 {
padding-bottom: 0.3em;
font-size: 2.25em;
line-height: 1.2;
border-bottom: 1px solid #eee;
}
#preview-contents h1 .anchor {
line-height: 1;
}
#preview-contents h2 {
padding-bottom: 0.3em;
font-size: 1.75em;
line-height: 1.225;
border-bottom: 1px solid #eee;
}
#preview-contents h2 .anchor {
line-height: 1;
}
#preview-contents h3 {
font-size: 1.5em;
line-height: 1.43;
}
#preview-contents h3 .anchor {
line-height: 1.2;
}
#preview-contents h4 {
font-size: 1.25em;
}
#preview-contents h4 .anchor {
line-height: 1.2;
}
#preview-contents h5 {
font-size: 1em;
}
#preview-contents h5 .anchor {
line-height: 1.1;
}
#preview-contents h6 {
font-size: 1em;
color: #777;
}
#preview-contents h6 .anchor {
line-height: 1.1;
}
#preview-contents p,
#preview-contents blockquote,
#preview-contents ul,
#preview-contents ol,
#preview-contents dl,
#preview-contents table,
#preview-contents pre {
margin-top: 0;
margin-bottom: 16px;
}
#preview-contents hr {
height: 4px;
padding: 0;
margin: 16px 0;
background-color: #e7e7e7;
border: 0 none;
}
#preview-contents ul,
#preview-contents ol {
padding-left: 2em;
}
#preview-contents ul ul,
#preview-contents ul ol,
#preview-contents ol ol,
#preview-contents ol ul {
margin-top: 0;
margin-bottom: 0;
}
#preview-contents li>p {
margin-top: 16px;
}
#preview-contents dl {
padding: 0;
}
#preview-contents dl dt {
padding: 0;
margin-top: 16px;
font-size: 1em;
font-style: italic;
font-weight: bold;
}
#preview-contents dl dd {
padding: 0 16px;
margin-bottom: 16px;
}
#preview-contents blockquote {
padding: 0 15px;
color: #777;
border-left: 4px solid #ddd;
}
#preview-contents blockquote>:first-child {
margin-top: 0;
}
#preview-contents blockquote>:last-child {
margin-bottom: 0;
}
#preview-contents table {
display: block;
width: 100%;
overflow: auto;
word-break: normal;
word-break: keep-all;
}
#preview-contents table th {
font-weight: bold;
}
#preview-contents table th,
#preview-contents table td {
padding: 6px 13px;
border: 1px solid #ddd;
}
#preview-contents table tr {
background-color: #fff;
border-top: 1px solid #ccc;
}
#preview-contents table tr:nth-child(2n) {
background-color: #f8f8f8;
}
#preview-contents img {
max-width: 100%;
box-sizing: content-box;
background-color: #fff;
}
#preview-contents code {
padding: 0;
padding-top: 0.2em;
padding-bottom: 0.2em;
margin: 0;
font-size: 85%;
background-color: rgba(0,0,0,0.04);
border-radius: 3px;
}
#preview-contents code:before,
#preview-contents code:after {
letter-spacing: -0.2em;
content: "\00a0";
}
#preview-contents pre>code {
padding: 0;
margin: 0;
font-size: 100%;
word-break: normal;
white-space: pre;
background: transparent;
border: 0;
}
#preview-contents .highlight {
margin-bottom: 16px;
}
#preview-contents .highlight pre,
#preview-contents pre {
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: #f7f7f7;
border-radius: 3px;
}
#preview-contents .highlight pre {
margin-bottom: 0;
word-break: normal;
}
#preview-contents pre {
word-wrap: normal;
}
#preview-contents pre code {
display: inline;
max-width: initial;
padding: 0;
margin: 0;
overflow: initial;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0;
}
#preview-contents pre code:before,
#preview-contents pre code:after {
content: normal;
}
#preview-contents kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
#preview-contents .pl-c {
color: #969896;
}
#preview-contents .pl-c1,
#preview-contents .pl-s .pl-v {
color: #0086b3;
}
#preview-contents .pl-e,
#preview-contents .pl-en {
color: #795da3;
}
#preview-contents .pl-s .pl-s1,
#preview-contents .pl-smi {
color: #333;
}
#preview-contents .pl-ent {
color: #63a35c;
}
#preview-contents .pl-k {
color: #a71d5d;
}
#preview-contents .pl-pds,
#preview-contents .pl-s,
#preview-contents .pl-s .pl-pse .pl-s1,
#preview-contents .pl-sr,
#preview-contents .pl-sr .pl-cce,
#preview-contents .pl-sr .pl-sra,
#preview-contents .pl-sr .pl-sre {
color: #183691;
}
#preview-contents .pl-v {
color: #ed6a43;
}
#preview-contents .pl-id {
color: #b52a1d;
}
#preview-contents .pl-ii {
background-color: #b52a1d;
color: #f8f8f8;
}
#preview-contents .pl-sr .pl-cce {
color: #63a35c;
font-weight: bold;
}
#preview-contents .pl-ml {
color: #693a17;
}
#preview-contents .pl-mh,
#preview-contents .pl-mh .pl-en,
#preview-contents .pl-ms {
color: #1d3e81;
font-weight: bold;
}
#preview-contents .pl-mq {
color: #008080;
}
#preview-contents .pl-mi {
color: #333;
font-style: italic;
}
#preview-contents .pl-mb {
color: #333;
font-weight: bold;
}
#preview-contents .pl-md {
background-color: #ffecec;
color: #bd2c00;
}
#preview-contents .pl-mi1 {
background-color: #eaffea;
color: #55a532;
}
#preview-contents .pl-mdr {
color: #795da3;
font-weight: bold;
}
#preview-contents .pl-mo {
color: #1d3e81;
}
#preview-contents kbd {
display: inline-block;
padding: 3px 5px;
font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
.markdown-body:before {
display: table;
content: "";
}
.markdown-body:after {
display: table;
clear: both;
content: "";
}
#preview-contents .task-list-item {
list-style-type: none;
}
#preview-contents .task-list-item+.task-list-item {
margin-top: 3px;
}
#preview-contents .task-list-item input {
margin: 0 0.35em 0.25em -1.6em;
vertical-align: middle;
}
#preview-contents :checked+.radio-label {
z-index: 1;
position: relative;
border-color: #4078c0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment