Markdown软件等快速排版公众号文章

虽然算运营公众号的,但个人号更偏向于简洁快捷的排版,毕竟文章只是为了记录,内容大于形式。再加上日常的笔记和文章都使用markdown语法,当需要在公众号上发内容时,希望能够实现简单快捷的转换markdown的文章内容。

经过查询、使用及调整,目前推荐两种方式来进行公众号的排版

  1. 使用在线软件markdown nice:Markdown | 让排版变 Nice (mdnice.com)
  2. 使用浏览器的拓展应用markdown here:这个插件最初设计是给Email使用的,但在公众号内也可以使用,而且简单快捷,使用ctrl+shift+m即可快捷转换

不过两者目前离排版需求都有些差距,我稍加修改了些参数和样式,记录如下。

在线网站:Markdown Nice

需求:

  • 字体16px,颜色不要太黑,两端空白不要太宽

在【雁栖湖】的基础上调整如下,之前我有自己偏好的字体颜色,但是这个平台识别不出来,所以退而求其次,使用了深灰(grey)来调整

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* 全局属性的调整*/
#nice {
counter-reset: counterh1 counterh2 counterh3;
padding: 0px;
}

/* 段落部分的调整 */
#nice p {
margin-top: 0px;
margin-bottom: 0px;
line-height: 160%;
word-spacing: 0px;
letter-spacing: 0px;
text-align: justify;
font-size: 16px;
text-indent: 0em;
color: gray;
}


/* 一级引用文字的调整*/
#nice .multiquote-1 p {
color:gray;
}

/* 分隔线
* 粗细、样式和颜色
* border-top: 1px solid #3e3e3e;
*/
#nice hr {
border-top: 1px dashed grey;
}

/* 有序列表整体样式
* list-style-type: upper-roman|lower-greek|lower-alpha;
*/
#nice ol {
rgb(37,132,181)
}

/* 列表内容,不要设置li
*/
#nice li section {
color: gray;
}

浏览器插件 markdown Here

1. 下载插件

由于chrome进不了插件的应用,所以可以下载github里的包
官网:Markdown Here (markdown-here.com)
github地址:markdown插件地址

首先下载压缩包

接着,在chrome的拓展程序里,增加插件,注意加载的是解压缩之后的src文件包

2. 调整下CSS

全文字体及其他基础信息的调整地址

1
2
/* This is the overall wrapper, it should be treated as the `body` section. */ .markdown-here-wrapper {
}

常用的一些设置

  • 颜色: font-size
  • 字体大小: font-color
    1
    2
    font-size: 16px; 
    font-color: rgb(62, 62, 62);

调整下分割线的设置,这个需要自己添加,原有的没有针对性的设置

1
2
3
hr {
border-top: 1px solid #777;
}

则引用为:

1
2
3
4
5
6
7
8
9
10
11
12
13
/* 一级引用
* 左边缘颜色 border-left-color: black;
* 背景色 background: gray;
*/
#nice .multiquote-1 {
border: 1px dashed rgb(37,132,181);
background: transparent;
}

/* 一级引用文字 */
/*#nice .multiquote-1 p {
color:gray;
} */

设置备份

Markdown Nice

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
/* 全局属性
* 页边距 padding: 30px;
* 全文字体 font-family: ptima-Regular;
* 英文换行 word-break: break-all;
*/
#nice {
counter-reset: counterh1 counterh2 counterh3;
padding: 0px;

}

/* 段落,下方未标注标签参数均同此处
* 上边距 margin-top: 0px;
* 下边距 margin-bottom: 0px;
* 行高 line-height: 160%;
* 词间距 word-spacing: 0px;
* 字间距 letter-spacing: 0px;
* 对齐 text-align: justify;
* 颜色 color: rgb(62, 58, 57);
* 字体大小 font-size: 16px;
* 首行缩进 text-indent: 0em;
*/
#nice p {
margin-top: 0px;
margin-bottom: 0px;
line-height: 160%;
word-spacing: 0px;
letter-spacing: 0px;
text-align: justify;
font-size: 16px;
text-indent: 0em;
color: gray;
}

/* 一级标题 */
#nice h1 {
line-height: 28px;
border-bottom: 1px solid rgb(37,132,181);
}

#nice h1:before {
background: rgb(37,132,181);
color: white;
counter-increment: counterh1;
content: 'Part'counter(counterh1);
padding: 2px 8px;
}

/* 一级标题内容 */
#nice h1 .content {
color: rgb(37,132,181);
margin-left: 8px;
font-size: 20px;
}

/* 一级标题前缀 */
#nice h1 .prefix {
}

/* 一级标题后缀 */
#nice h1 .suffix {
}

/* 二级标题 */
#nice h2 {
}

/* 二级标题内容 */
#nice h2 .content {
font-size: 18px;
border-bottom: 4px solid rgb(37,132,181);
padding: 2px 4px;
color: rgb(37,132,181);
}

/* 二级标题前缀 */
#nice h2 .prefix {
display: inline-block;
}

#nice h2 .prefix:before {
counter-increment: counterh2;
content: counter(counterh2);
color:rgb(159,205,208);
border-bottom: 4px solid rgb(159,205,208);
font-size: 18px;
padding: 2px 4px;
}

/* 二级标题后缀 */
#nice h2 .suffix {
}

/* 三级标题 */
#nice h3 {
}

/* 三级标题内容 */
#nice h3 .content {
font-size: 16px;
border-bottom: 1px solid rgb(37,132,181);
padding: 2px 10px;
color: rgb(37,132,181);
}

/* 三级标题前缀 */
#nice h3 .prefix {
display:inline-block;
background:linear-gradient(45deg, transparent 48%, rgb(37,132,181) 48%,
rgb(37,132,181) 52%, transparent 52%);
width:24px;
height:24px;
margin-bottom: -7px;
}

/* 三级标题后缀 */
#nice h3 .suffix {
}

/* 无序列表整体样式
* list-style-type: square|circle|disc;
*/
#nice ul {
color: rgb(37,132,181);
}

/* 有序列表整体样式
* list-style-type: upper-roman|lower-greek|lower-alpha;
*/
#nice ol {
rgb(37,132,181)
}

/* 列表内容,不要设置li
*/
#nice li section {
color: gray;
}

/* 一级引用
* 左边缘颜色 border-left-color: black;
* 背景色 background: gray;
*/
#nice .multiquote-1 {
border: 1px dashed rgb(37,132,181);
background: transparent;

}

/* 一级引用文字 */
#nice .multiquote-1 p {
color:gray;
}

/* 二级引用
*/
#nice .multiquote-2 {
border: 1px dashed rgb(248,99,77);
box-shadow: none;
}

#nice .multiquote-2 blockquote {
margin: 0;
}

/* 二级引用文字 */
#nice .multiquote-2 p {
}

#nice .multiquote-2 strong {
color:rgb(248,99,77);
}

#nice .multiquote-2 a {
color:rgb(248,99,77);
border-bottom: 1px solid rgb(248,99,77);
}

/* 三级引用
*/
#nice .multiquote-3 {
}

/* 三级引用文字 */
#nice .multiquote-3 p {
}

/* 链接
* border-bottom: 1px solid #009688;
*/
#nice a {
color:rgb(37,132,181);
border-bottom: 1px solid rgb(37,132,181);
}

/* 加粗 */
#nice strong {
color: rgb(37,132,181);
}

/* 斜体 */
#nice em {
color: rgb(37,132,181);
}

/* 加粗斜体 */
#nice em strong {
color: rgb(37,132,181);
}

/* 删除线 */
#nice del {
}

/* 分隔线
* 粗细、样式和颜色
* border-top: 1px solid #3e3e3e;
*/
#nice hr {
border-top: 1.5px dashed grey;
}

/* 图片
* 宽度 width: 80%;
* 居中 margin: 0 auto;
* 居左 margin: 0 0;
*/
#nice img {
}

/* 图片描述文字 */
#nice figcaption {
}

/* 行内代码 */
#nice p code, #nice li code {
}

/*
* 代码块不换行 display: -webkit-box !important;
* 代码块换行 display: block;
*/
#nice pre code {
}

/*
* 表格内的单元格
* 字体大小 font-size: 16px;
* 边框 border: 1px solid #ccc;
* 内边距 padding: 5px 10px;
*/
#nice table tr th {
border: 1px solid rgb(248,99,77);
background-color: rgb(235,114, 80);
color: #f8f8f8;
border-bottom: 0;
border: 1px solid rgb(245,203,174);
}

#nice table tr td {
border: 1px solid rgb(245,203,174);
}
/*
* 某一列表格列宽控制
* n 可以修改为具体数字,不修改时表示所有列
* 最小列宽 min-width: 85px;
*/
#nice table tr th:nth-of-type(n),
#nice table tr td:nth-of-type(n){
}

#nice table tr:nth-of-type(2) {
background-color: rgb(248,222,203);
}
/* 脚注文字 */
#nice .footnote-word {
color:rgb(37,132,181);
}

/* 脚注上标 */
#nice .footnote-ref {
color:rgb(37,132,181);
}

/* "参考资料"四个字
* 内容 content: "参考资料";
*/
#nice .footnotes-sep:before {
}

/* 参考资料编号 */
#nice .footnote-num {
}

/* 参考资料文字 */
#nice .footnote-item p {
}

/* 参考资料解释 */
#nice .footnote-item p em {
}

/* 行间公式
* 最大宽度 max-width: 300% !important;
*/
#nice .block-equation svg {
}

/* 行内公式
*/
#nice .inline-equation svg {
}

markdown Here

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
* NOTE:
* - The use of browser-specific styles (-moz-, -webkit-) should be avoided.
* If used, they may not render correctly for people reading the email in
* a different browser than the one from which the email was sent.
* - The use of state-dependent styles (like a:hover) don't work because they
* don't match at the time the styles are made explicit. (In email, styles
* must be explicitly applied to all elements -- stylesheets get stripped.)
*/

/* This is the overall wrapper, it should be treated as the `body` section. */
.markdown-here-wrapper {
font-size:16px;
font-color:rgb(62, 62, 62);
}

/* To add site specific rules, you can use the `data-md-url` attribute that we
add to the wrapper element. Note that rules like this are used depending
on the URL you're *sending* from, not the URL where the recipient views it.
*/
/* .markdown-here-wrapper[data-md-url*="mail.yahoo."] ul { color: red; } */

pre, code {
font-size: 0.85em;
font-family: Consolas, Inconsolata, Courier, monospace;
}

code {
margin: 0 0.15em;
padding: 0 0.3em;
white-space: pre-wrap;
border: 1px solid #EAEAEA;
background-color: #F8F8F8;
border-radius: 3px;
display: inline; /* added to fix Yahoo block display of inline code */
}

pre {
font-size: 1em;
line-height: 1.2em;
}

pre code {
white-space: pre;
overflow: auto; /* fixes issue #70: Firefox/Thunderbird: Code blocks with horizontal scroll would have bad background colour */
border-radius: 3px;
border: 1px solid #CCC;
padding: 0.5em 0.7em;
display: block !important; /* added to counteract the Yahoo-specific `code` rule; without this, code blocks in Blogger are broken */
}

/* In edit mode, Wordpress uses a `* { font: ...;} rule+style that makes highlighted
code look non-monospace. This rule will override it. */
.markdown-here-wrapper[data-md-url*="wordpress."] code span {
font: inherit;
}

/* Wordpress adds a grey background to `pre` elements that doesn't go well with
our syntax highlighting. */
.markdown-here-wrapper[data-md-url*="wordpress."] pre {
background-color: transparent;
}

/* This spacing has been tweaked to closely match Gmail+Chrome "paragraph" (two line breaks) spacing.
Note that we only use a top margin and not a bottom margin -- this prevents the
"blank line" look at the top of the email (issue #243).
*/
p {
/* !important is needed here because Hotmail/Outlook.com uses !important to
kill the margin in <p>. We need this to win. */
margin: 0 0 1.2em 0 !important;
font-color:rgb(62, 62, 62);#自己加
}

table, pre, dl, blockquote, q, ul, ol {
margin: 1.2em 0;
}

ul, ol {
padding-left: 2em;
}

li {
margin: 0.5em 0;
}

/* Space paragraphs in a list the same as the list itself. */
li p {
/* Needs !important to override rule above. */
margin: 0.5em 0 !important;
}

/* Smaller spacing for sub-lists */
ul ul, ul ol, ol ul, ol ol {
margin: 0;
padding-left: 1em;
}

/* Use Roman numerals for sub-ordered-lists. (Like Github.) */
ol ol, ul ol {
list-style-type: lower-roman;
}

/* Use letters for sub-sub-ordered lists. (Like Github.) */
ul ul ol, ul ol ol, ol ul ol, ol ol ol {
list-style-type: lower-alpha;
}

dl {
padding: 0;
}

dl dt {
font-size: 1em;
font-weight: bold;
font-style: italic;
}

dl dd {
margin: 0 0 1em;
padding: 0 1em;
}

blockquote, q {
border-left: 4px solid #DDD;
padding: 0 1em;
color: #777;
quotes: none;
}

blockquote::before, blockquote::after, q::before, q::after {
content: none;
}

h1, h2, h3, h4, h5, h6 {
margin: 1.3em 0 1em;
padding: 0;
font-weight: bold;
}

h1 {
font-size: 1.6em;
border-bottom: 1px solid #ddd;
}

h2 {
font-size: 1.4em;
border-bottom: 1px solid #eee;
}

h3 {
font-size: 1.3em;
}

h4 {
font-size: 1.2em;
}

h5 {
font-size: 1em;
}

h6 {
font-size: 1em;
color: #777;
}

table {
padding: 0;
border-collapse: collapse;
border-spacing: 0;
font-size: 1em;
font: inherit;
border: 0;
}

tbody {
margin: 0;
padding: 0;
border: 0;
}

table tr {
border: 0;
border-top: 1px solid #CCC;
background-color: white;
margin: 0;
padding: 0;
}

table tr:nth-child(2n) {
background-color: #F8F8F8;
}

table tr th, table tr td {
font-size: 1em;
border: 1px solid #CCC;
margin: 0;
padding: 0.5em 1em;
}

table tr th {
font-weight: bold;
background-color: #F0F0F0;
}

hr {
border-top: 1px solid #777;
}
交个盆友