我最近用obsidian的时候会非常怀念typora的公式格式。但是网上搜不到比较合适的typora格式,所以写了一个typora的css代码。
使用方法:obsidian -> 设置 -> 外观 -> (最下面)css代码片段 -> 点击文件夹图标 -> 在文件夹里面新建一个名为typora.css的文件 -> 复制下面的代码进去 -> 保存 -> 在设置里面启用该代码片段
而且这个自己修改也很方便,比如obsidian里面不能修改的行间距等等,都可以直接在这个css里面修改。
/* 调用 Open Sans 字体 */
@import url(‘https://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext’);
@font-face {
font-family: ‘Open Sans’;
font-style: normal;
font-weight: normal;
src: local(‘Open Sans Regular’), url(‘./github/400.woff’) format(‘woff’);
}
@font-face {
font-family: ‘Open Sans’;
font-style: italic;
font-weight: normal;
src: local(‘Open Sans Italic’), url(‘./github/400i.woff’) format(‘woff’);
}
@font-face {
font-family: ‘Open Sans’;
font-style: normal;
font-weight: bold;
src: local(‘Open Sans Bold’), url(‘./github/700.woff’) format(‘woff’);
}
@font-face {
font-family: ‘Open Sans’;
font-style: italic;
font-weight: bold;
src: local(‘Open Sans Bold Italic’), url(‘./github/700i.woff’) format(‘woff’);
}
/* 全局样式 */
body, .markdown-preview-view, .cm-content {
font-family: “Open Sans”, “Clear Sans”, “Helvetica Neue”, Helvetica, Arial, sans-serif;
font-size: 16px;
padding: 1 26px;
line-height: 1.6;
word-wrap: break-word;
}
img {
max-width: 100%;
max-height: 100%;
}
a {
color: #4080D0;
text-decoration: none;
}
a:hover {
color: #4080D0;
text-decoration: underline;
}
a:focus,
input:focus,
select:focus,
textarea:focus {
outline: 1px solid -webkit-focus-ring-color;
outline-offset: -1px;
}
hr {
border: 0;
height: 2px;
border-bottom: 2px solid rgba(0, 0, 0, 0.18);
}
/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
font-weight: normal;
}
h1 {
padding-bottom: 0.3em;
line-height: 1.2;
border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}
h1 code,
h2 code,
h3 code,
h4 code,
h5 code,
h6 code {
font-size: inherit;
line-height: auto;
}
/* 表格样式 */
table {
border-collapse: collapse;
}
table > thead > tr > th {
text-align: left;
border-bottom: 1px solid rgba(0, 0, 0, 0.69);
}
table > thead > tr > th,
table > thead > tr > td,
table > tbody > tr > th,
table > tbody > tr > td {
padding: 5px 10px;
}
table > tbody > tr + tr > td {
border-top: 1px solid rgba(0, 0, 0, 0.18);
}
/* 引用块样式 */
blockquote {
margin: 0 7px 0 5px;
padding: 0 16px 0 10px;
border-left: 5px solid rgba(0, 122, 204, 0.5);
background: rgba(127, 127, 127, 0.1);
}
/* 代码块样式 */
pre, code {
font-family: Menlo, Monaco, Consolas, “Source Code Pro”;
}
pre code {
color: rgb(30, 30, 30);
background-color: #F0F0F0;
padding: 10px;
}
code {
color: #A31515;
}
.cm-content pre, .markdown-preview-view pre {
white-space: pre-wrap;
}