Skip to content

Instantly share code, notes, and snippets.

@joyous-coder
Last active April 25, 2021 07:51
Show Gist options
  • Save joyous-coder/11c07e51079b47d23adfd978d2732ced to your computer and use it in GitHub Desktop.
Save joyous-coder/11c07e51079b47d23adfd978d2732ced to your computer and use it in GitHub Desktop.
2021-2-11 Markdown Preview 的样式(包含普通样式和代码样式)
code[class*="language-"],
pre[class*="language-"] {
color: #333;
background: none;
font-family: Monaco,Menlo,Consolas,"Courier New",monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.4;
/* box-shadow: 0 1px 2px rgb(255 255 255 / 10%) inset, 45px 0 0 rgb(102 128 153 / 5%) inset, 0 1px 0 rgb(102 128 153 / 5%); */
border: 1px solid rgba(0, 0, 0, .15);
border-radius: 4px;
padding: 9.5px;
-moz-tab-size: 8;
-o-tab-size: 8;
tab-size: 8;
font-size: 14px !important;
color: #333;
border-width: 0;
line-height: 20px;
word-break: break-all;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
/* Code blocks */
pre[class*="language-"] {
padding: .8em;
overflow: auto;
/* border: 1px solid #ddd; */
border-radius: 3px;
/* background: #fff; */
background:rgba(102, 128, 153, 0.05);
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
background: #f5f5f5;
}
.token.comment,
.token.blockquote {
color: #800;
}
.token.cdata {
color: #183691;
}
.token.doctype,
.token.punctuation,
.token.variable,
.token.macro.property {
color: #066;
}
.token.operator,
.token.important,
.token.keyword,
.token.rule,
.token.builtin {
color: #008;
}
.token.string,
.token.url,
.token.regex,
.token.attr-value {
color: #080;
}
.token.property,
.token.number,
.token.boolean,
.token.entity,
.token.atrule,
.token.constant,
.token.symbol,
.token.command,
.token.code {
color: #0086b3;
}
.token.tag,
.token.selector,
.token.prolog {
color: #008;
}
.token.function,
.token.namespace,
.token.pseudo-element,
.token.class,
.token.class-name,
.token.pseudo-class,
.token.id,
.token.url-reference .token.variable,
.token.attr-name {
color: #606;
}
.token.entity {
cursor: help;
}
.token.title,
.token.title .token.punctuation {
font-weight: bold;
color: #1d3e81;
}
.token.list {
color: #ed6a43;
}
.token.inserted {
background-color: #eaffea;
color: #55a532;
}
.token.deleted {
background-color: #ffecec;
color: #bd2c00;
}
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
/* JSON */
.language-json .token.property {
color: #183691;
}
.language-markup .token.tag .token.punctuation {
color: #333;
}
/* CSS */
code.language-css,
.language-css .token.function {
color: #0086b3;
}
/* YAML */
.language-yaml .token.atrule {
color: #63a35c;
}
code.language-yaml {
color: #183691;
}
/* Ruby */
.language-ruby .token.function {
color: #333;
}
/* Markdown */
.language-markdown .token.url {
color: #795da3;
}
/* Makefile */
.language-makefile .token.symbol {
color: #795da3;
}
.language-makefile .token.variable {
color: #183691;
}
.language-makefile .token.builtin {
color: #0086b3;
}
/* Bash */
.language-bash .token.keyword {
color: #0086b3;
}
/* highlight */
pre[data-line] {
position: relative;
padding: 1em 0 1em 3em;
}
pre[data-line] .line-highlight-wrapper {
position: absolute;
top: 0;
left: 0;
background-color: transparent;
display: block;
width: 100%;
}
pre[data-line] .line-highlight {
position: absolute;
left: 0;
right: 0;
padding: inherit 0;
margin-top: 1em;
background: hsla(24, 20%, 50%,.08);
background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
pointer-events: none;
line-height: inherit;
white-space: pre;
}
pre[data-line] .line-highlight:before,
pre[data-line] .line-highlight[data-end]:after {
content: attr(data-start);
position: absolute;
top: .4em;
left: .6em;
min-width: 1em;
padding: 0 .5em;
background-color: hsla(24, 20%, 50%,.4);
color: hsl(24, 20%, 95%);
font: bold 65%/1.5 sans-serif;
text-align: center;
vertical-align: .3em;
border-radius: 999px;
text-shadow: none;
box-shadow: 0 1px white;
}
pre[data-line] .line-highlight[data-end]:after {
content: attr(data-end);
top: auto;
bottom: .4em;
}
/* Please visit the URL below for more information: */
/* https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
@import 'vue/fonts.css';
html{
background-color: #F9F9F5;
}
.markdown-preview.markdown-preview {
// modify your style here
// eg: background-color: blue;
font-family: 'PingFang SC', 'Hiragino Sans GB', 'Helvetica Neue', 'Microsoft Yahei', 'WenQuanYi Micro Hei', sans-serif;
border: 0 none;
margin: 0 auto;
overflow-x: hidden;
padding-bottom: 50px;
position: relative;
width: 100%;
font-size: 16px;
line-height: 27px;
overflow: auto;
padding-left: 5px;
padding-right: 5px;
display: block;
background-color: #F9F9F5;
color: #2C3E50;
#write {
width: 100%;
font-size: 16px;
line-height: 27px;
overflow: auto;
border: 1px dashed #BBB;
border-top-width: 0;
border-right-width: 0;
padding-left: 5px;
padding-right: 5px;
}
p {
margin: 0 0 10px;
font-family: 'PingFang SC', 'Hiragino Sans GB', 'Helvetica Neue', 'Microsoft Yahei', 'WenQuanYi Micro Hei', sans-serif;
display: block;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0px;
margin-inline-end: 0px;
}
#write p {
margin: 0 0 20px;
}
#write ol li {
padding-left: 0.5rem;
}
#write>ul:first-child,
#write>ol:first-child {
margin-top: 30px;
}
body>*:first-child {
margin-top: 0 !important;
}
body>*:last-child {
margin-bottom: 0 !important;
}
a {
color: #08c;
text-decoration: none;
cursor: pointer;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 10px 0;
font-family: inherit;
color: inherit;
text-rendering: optimizelegibility;
font-weight: 500;
padding-bottom: 0px;
}
h1,
h2,
h3 {
line-height: 40px;
}
h1:hover a.anchor,
h2:hover a.anchor,
h3:hover a.anchor,
h4:hover a.anchor,
h5:hover a.anchor,
h6:hover a.anchor {
text-decoration: none;
}
h1 tt,
h1 code {
font-size: inherit !important;
}
h2 tt,
h2 code {
font-size: inherit !important;
}
h3 tt,
h3 code {
font-size: inherit !important;
}
h4 tt,
h4 code {
font-size: inherit !important;
}
h5 tt,
h5 code {
font-size: inherit !important;
}
h6 tt,
h6 code {
font-size: inherit !important;
}
h1 {
color: #0077bb;
margin: 50px 0 20px;
font-size: 30px;
display: block;
// margin-block-start: 0.67em;
// margin-block-end: 0.67em;
// margin-inline-start: 0px;
// margin-inline-end: 0px;
}
h2 {
margin: 35px 0 20px;
font-size: 26px;
// margin-block-start: 0.83em;
// margin-block-end: 0.83em;
// margin-inline-start: 0px;
// margin-inline-end: 0px;
display: block;
}
h3 {
margin: 20px 0;
font-size: 21px;
display: block;
// margin-block-start: 1em;
// margin-block-end: 1em;
// margin-inline-start: 0px;
// margin-inline-end: 0px;
}
h4 {
font-size: 18px;
display: block;
// margin-block-start: 1.33em;
// margin-block-end: 1.33em;
// margin-inline-start: 0px;
// margin-inline-end: 0px;
}
h5 {
font-size: 16px;
// margin-block-start: 1.67em;
// margin-block-end: 1.67em;
// margin-inline-start: 0px;
// margin-inline-end: 0px;
display: block;
}
h6 {
font-size: 16px;
// margin-block-start: 2.33em;
// margin-block-end: 2.33em;
// margin-inline-start: 0px;
// margin-inline-end: 0px;
display: block;
}
p,
blockquote,
ul,
ol,
dl,
table {
margin: 0 0 20px;
}
li>ol,
li>ul {
margin: 0 0;
}
body>h2:first-child {
margin-top: 0;
padding-top: 0;
}
body>h1:first-child {
margin-top: 0;
padding-top: 0;
}
body>h1:first-child+h2 {
margin-top: 0;
padding-top: 0;
}
body>h3:first-child,
body>h4:first-child,
body>h5:first-child,
body>h6:first-child {
margin-top: 0;
padding-top: 0;
}
a:first-child h1,
a:first-child h2,
a:first-child h3,
a:first-child h4,
a:first-child h5,
a:first-child h6 {
margin-top: 0;
padding-top: 0;
}
h1 p,
h2 p,
h3 p,
h4 p,
h5 p,
h6 p {
margin-top: 0;
}
li p.first {
display: inline-block;
}
ul,
ol {
padding-left: 25px;
margin: 0 0 10px 0px;
}
ul:first-child,
ol:first-child {
margin-top: 0;
}
ul:last-child,
ol:last-child {
margin-bottom: 10px;
}
blockquote {
padding: 10px 15px;
border-left-style: solid;
border-left-width: 10px;
margin: 0 0 20px;
border-color: #D6DBDF;
background: none repeat scroll 0 0 rgba(102, 128, 153, .05);
display: block;
color: #2C3E50;
}
blockquote p {
margin: 0;
font-size: 16px;
font-weight: 300;
line-height: 25px;
}
table {
border: 0px solid #ddd;
border-left: 0;
border-radius: 4px;
width: 100%;
margin-bottom: 20px;
max-width: 100%;
background-color: #F9F9F5;
border-spacing: 0;
display: table;
}
table tr:nth-child(2n+1) {
background-color: rgba(102, 128, 153, .05);
}
table tr th {
font-weight: 700;
padding: 8px;
line-height: 20px;
text-align: left;
vertical-align: top;
background-color: #F9F9F5
}
table tr td {
padding: 8px;
line-height: 20px;
text-align: left;
vertical-align: top;
}
table tr th:first-chilld {
border-top: 0;
}
table tr td:first-child {
margin-top: 0;
}
table tr th:last-child,
table tr td:last-child {
margin-bottom: 0;
}
#write strong {
padding: 0 1px;
}
strong {
font-weight: 700;
}
#write em {
padding: 0 5px 0 2px;
}
#write .CodeMirror-gutters {
border-right: none;
}
#write .md-fences {
border: 1px solid #F4F4F4;
-webkit-font-smoothing: initial;
margin: 0.8rem 0 !important;
padding: 0.3rem 0 !important;
line-height: 1.43rem;
background-color: #F8F8F8 !important;
border-radius: 2px;
font-family: 'Fira Code', 'Roboto Mono', monospace !important;
font-size: 0.85rem;
word-wrap: normal;
}
#write .CodeMirror-wrap .CodeMirror-code pre {
padding-left: 12px;
}
code {
font-size: 16px;
font-family: Monaco, Menlo, Consolas, '微软雅黑', "Courier New", monospace;
border: 0;
background-color: #D6DBDF;
border-radius: 4px;
color: #2C3E50;
padding: 2px 4px;
white-space: nowrap;
}
tt {
padding: 2px 4px;
border-radius: 2px;
font-size: 0.92rem;
color: #e96900;
background-color: #f8f8f8;
}
#write tt {
padding: 2px 4px;
border-radius: 2px;
font-family: 'Fira Code', 'Roboto Mono', monospace !important;
font-size: 0.92rem;
color: #e96900;
background-color: #f8f8f8;
}
tt {
margin: 0 2px;
}
#write .md-footnote {
background-color: #f8f8f8;
color: #e96900;
}
sup {
vertical-align: baseline;
top: -8px;
font-size: 75%;
line-height: 0;
position: relative;
}
/* heighlight. */
#write mark {
background-color: #EBFFEB;
border-radius: 2px;
padding: 2px 4px;
margin: 0 2px;
color: #222;
font-weight: 500;
}
#write del {
padding: 1px 2px;
}
.cm-s-inner .cm-link,
.cm-s-inner.cm-link {
color: #22a2c9;
}
.cm-s-inner .cm-string {
color: #22a2c9;
}
.md-task-list-item>input {
margin-left: -1.3em;
}
@media print {
html {
font-size: 13px;
}
table,
pre {
page-break-inside: avoid;
}
pre {
word-wrap: break-word;
}
}
.md-fences {
background-color: #f8f8f8;
}
.md-diagram-panel {
position: static !important;
}
#write pre.md-meta-block {
padding: 1rem;
font-size: 85%;
line-height: 1.45;
background-color: #f7f7f7;
border: 0;
border-radius: 3px;
color: #777777;
margin-top: 0 !important;
}
.mathjax-block>.code-tooltip {
bottom: .375rem;
}
#write>h3.md-focus:before {
left: -1.5625rem;
top: .375rem;
}
#write>h4.md-focus:before {
left: -1.5625rem;
top: .285714286rem;
}
#write>h5.md-focus:before {
left: -1.5625rem;
top: .285714286rem;
}
#write>h6.md-focus:before {
left: -1.5625rem;
top: .285714286rem;
}
.md-image>.md-meta {
border-radius: 3px;
font-family: 'Fira Code', 'Roboto Mono', monospace !important;
padding: 2px 0 0 4px;
font-size: 0.9em;
color: inherit;
}
.md-tag {
color: inherit;
}
.md-toc {
margin-top: 20px;
padding-bottom: 20px;
}
.sidebar-tabs {
border-bottom: none;
}
#typora-quick-open {
border: 1px solid #ddd;
background-color: #f8f8f8;
}
#typora-quick-open-item {
background-color: #FAFAFA;
border-color: #FEFEFE #e5e5e5 #e5e5e5 #eee;
border-style: solid;
border-width: 1px;
}
#md-notification:before {
top: 10px;
}
/** focus mode */
.on-focus-mode blockquote {
border-left-color: rgba(85, 85, 85, 0.12);
}
header,
.context-menu,
.megamenu-content,
footer {
font-family: 'Ubuntu', 'Source Sans Pro', sans-serif !important;
}
.file-node-content:hover .file-node-icon,
.file-node-content:hover .file-node-open-state {
visibility: visible;
}
.mac-seamless-mode #typora-sidebar {
background-color: #fff;
}
.md-lang {
color: #b4654d;
}
.html-for-mac .context-menu {
--item-hover-bg-color: #E6F0FE;
}
hr {
border: 0;
border-bottom: 1px dashed #cfcfcf;
background-color: #F9F9F5;
margin: 30px 0;
display: block;
unicode-bidi: isolate;
overflow: hidden;
}
input {
margin: 0 6px 0 -20px;
vertical-align: middle;
display: inline;
width: auto;
height: auto;
line-height: normal;
background-image: none;
background-position: 0 0;
background-repeat: repeat;
font-family: FontAwesome;
font-weight: 400;
font-style: normal;
text-decoration: inherit;
}
ol li p {
color: #888;
font-size: .9em;
margin: 0;
}
section ol li p strong {
color: #888;
font-size: .9em;
}
section ol li {
counter-increment: section;
}
section ol {
padding-left: 20px;
}
section ol li::marker {
color: #888;
content: "["counter(section)"] ";
}
}
//代码配置
.markdown-preview.markdown-preview {
pre.line-numbers .line-numbers-rows{
border-right: 0px;
// box-shadow: 0 1px 2px rgb(255 255 255 / 10%) inset, 45px 0 0 rgb(102 128 153 / 5%) inset, 0 1px 0 rgb(102 128 153 / 5%);
background-color: rgba(102, 128, 153, .05);
top: 0.8em;
}
pre.line-numbers .line-numbers-rows>span:before {
content: counter(linenumber)".";
color: rgba(102, 128, 153, 0.4);
display: block;
padding-right: .8em;
text-align: right;
font-size: 14px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment