文章目录1、Markdown 介绍2、Markdown 编辑器3、MarkdownPad 2 的安装、配置3.1、下载3.2、安装3.3、破解4、异常4.1、在win10下html渲染错误 This view has crashed5、修改markdown处理器和渲染模式(必看)6、 优化配置6.1、 去缓存6.2、 代码高亮6.3、 文章目录自动生成(1)—— 推荐6.4、 文章目录自动生成(2)6.5、自定义样式(必看)6.5、滚动条居中
1、Markdown 介绍
Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成格式丰富的HTML页面。 —— 维基百科
Markdown提供了简洁、高效的文档标记语法,被广泛运用于各种开源项目的README文档、说明文档等。同时Markdown语法还兼容HTML语法,在某些场合也可以使用HTML语法来增强Markdown的展现格式。但是一般不建议这样使用,以免导致一些平台对Markdown的兼容问题。
掌握了 Markdown 语法进行写作,可以让多个开发者在编写文档时按照相同的格式写作。同时 Markdown 还能转换为各种其他格式,如 PDF、HTML,甚至通过 pandoc 工具还能转化为 word 格式。因此,掌握 Markdown 对于一个开发者来说是非常重要的一项技能。
2、Markdown 编辑器
目前来看,支持Markdown语法的编辑器有很多,其中网页版的多一些,windows桌面版的相对少一些,我下载了多款编辑器,经试用,我觉得 MarkdownPad 2 是最顺手的。
下面说一下 MarkdownPad 2 的安装、配置
3、MarkdownPad 2 的安装、配置
3.1、下载
目录 MarkdownPad 2 的最新版本是 V2.5(当前时间是2017/12/8),建议下载安装版的,不要绿色版的。
MarkdownPad 2 的官网下载地址: http://markdownpad.com/
选择 Free版下载。
3.2、安装
下一步,下一步,不说了.
3.3、破解
邮箱: [email protected]
授权秘钥:
GBPduHjWfJU1mZqcPM3BikjYKF6xKhlKIys3i1MU2eJHqWGImDHzWdD6xhMNLGVpbP2M5SN6bnxn2kSE8qHqNY5QaaRxmO3YSMHxlv2EYpjdwLcPwfeTG7kUdnhKE0vVy4RidP6Y2wZ0q74f47fzsZo45JE2hfQBFi2O9Jldjp1mW8HUpTtLA2a5/sQytXJUQl/QKO0jUQY4pa5CCx20sV1ClOTZtAGngSOJtIOFXK599sBr5aIEFyH0K7H4BoNMiiDMnxt1rD8Vb/ikJdhGMMQr0R4B+L3nWU97eaVPTRKfWGDE8/eAgKzpGwrQQoDh+nzX1xoVQ8NAuH+s4UcSeQ==
当前时间是2017/12/8,如果不能用了,请自行百度搜索最新的。
4、异常
4.1、在win10下html渲染错误 This view has crashed
这个异常在 MarkdownPad 的 FAQ( http://markdownpad.com/faq.html#livepreview-directx) 给出了解决办法。
解决方法总结如下:
(1)、下载 Microsoft’s DirectX End-User Runtimes (June 2010)
地址:https://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe
(2)、下载 awesomium_v1.6.6_sdk
地址: http://markdownpad.com/download/awesomium_v1.6.6_sdk_win.exe
下载安装即可解决问题。
也可以参考这篇博客: https://blog.csdn.net/student9128/article/details/52781808
5、修改markdown处理器和渲染模式(必看)
看图设置
markdown 处理器和渲染模式 :
6、 优化配置
6.1、 去缓存
截图:
1234
6.2、 代码高亮
截图:
代码:
123
6.3、 文章目录自动生成(1)—— 推荐
代码:
function muluShow(){
var visibleFlag=$("#toc").is(":visible");
if(visibleFlag){
$("#toc").hide();
$("#mulu_tt").text("▼");
$("#tocCal").css("width","100px");
}else{
$("#toc").show();
$("#mulu_tt").text("▲");
$("#tocCal").css("width","");
}
}
$(function() {
$("body").append('
var toc = $("#toc").tocify({
selectors:"h1,h2,h3,h4,h5,h6",
extendPage:false
}).data("toc-tocify");
muluShow(); //刚打开页面时,目录是缩小的。
});
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
生成的目录如下:
6.4、 文章目录自动生成(2)
截图:
生成目录代码:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
如果将文章导出生成html时,会自动生成目录的。如图所示:
6.5、自定义样式(必看)
点击 添加 按钮:
样式内容:
/* reset
========================================*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p,
blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn,
em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,
b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas,
details, embed, figure, figcaption, footer, header, hgroup, menu, nav,
output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
}
/* body
================================================*/
body {
font-family: 'microsoft yahei', Helvetica, arial, freesans, clean,
sans-serif;
font-size: 14px;
line-height: 1.8;
/*color: #333;*/
color: #3f3f3f;
background-color: #fff;
padding: 20px;
max-width: 960px;
margin: 0 auto;
max-width: 1000px;
word-break: break-word !important;
word-break: break-all;
margin-left: 20px;
margin-bottom: 100px;
}
body>*:first-child {
margin-top: 0 !important;
}
body>*:last-child {
margin-bottom: 0 !important;
}
/* blocks
============================================*/
p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}
/* headers
============================================*/
h1, h2, h3, h4, h5, h6 {
font-family: 'PingFang SC', 'Microsoft YaHei', SimHei, Arial, SimSun;
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}
h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt,
h5 code, h6 tt, h6 code {
font-size: inherit;
}
h1 {
font-size: 34px;
color: #000;
}
h2 {
font-size: 30px;
border-bottom: 2px solid #3F3F3F;
color: #000;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}
h3 {
font-size: 26px;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}
h4 {
font-size: 22px;
}
h5 {
font-size: 18px;
}
h6 {
color: #777;
font-size: 16px;
}
body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, 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: 10px;
}
/* links
===================================================*/
a {
color: #4183C4;
text-decoration: none;
}
a:active, a:hover, a:hover, a:visited {
color: #ca0c16;
text-decoration: underline;
}
/* lists
==============================================*/
ul, ol {
padding-left: 30px;
}
ul li>:first-child, ol li>:first-child, ul li ul:first-of-type, ol li ol:first-of-type,
ul li ol:first-of-type, ol li ul:first-of-type {
margin-top: 0px;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}
dl {
padding: 0;
}
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}
dl dt:first-child {
padding: 0;
}
dl dt>:first-child {
margin-top: 0px;
}
dl dt>:last-child {
margin-bottom: 0px;
}
dl dd {
margin: 0 0 15px;
padding: 0 15px;
}
dl dd>:first-child {
margin-top: 0px;
}
dl dd>:last-child {
margin-bottom: 0px;
}
/* code
========================================================*/
p code {
color: #b52a1d;
}
pre, code, tt {
/*font-size: 13px;*/
font-family: Consolas, "Liberation Mono", Courier, monospace;
}
code, tt {
margin: 0 2px;
padding: 0px 8px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
color: #b52a1d;
}
pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
/* css-3 white-space: pre-wrap; */
white-space: -moz-pre-wrap; /* mozilla, since 1999 */
white-space: -pre-wrap; /* opera 4-6 */
white-space: -o-pre-wrap; /* opera 7 */
word-wrap: break-word; /* internet explorer 5.5+ */
overflow: auto;
word-break: break-all;
word-wrap: break-word;
color: #3f3f3f;
}
pre {
background-color: #F9F9F9;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 2px 2px;
border-radius: 3px;
}
pre code, pre tt {
background-color: transparent;
border: none;
}
kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 10px;
padding: 1px 4px;
}
/* quotes
====================================================*/
blockquote {
padding: 15px 20px;
border-left: 10px solid #F1F1F1;
background-color: #F9F9F9;
border-radius: 0 5px 5px 0;
}
blockquote>:first-child {
margin-top: 0px;
}
blockquote>:last-child {
margin-bottom: 0px;
}
/* horizontal rules
======================================*/
hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}
/* tables
=========================================*/
table {
font-family: Helvetica, arial, freesans, clean, sans-serif;
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;
}
table tr th {
padding: 0.3em 0.5em;
}
table tr td {
padding: 0.25em 0.5em;
}
/* images
===================================================*/
img {
max-width: 1000px;
}
strong, b {
padding: 0 4px;
}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
6.5、滚动条居中
var wx ,wy;
$(document).mousemove(function(e){
wx = e.clientX;
wy = e.clientY;
});
$(window).scroll(function() {
var _height=$("#toc").height()/3;
var _hh=$("#toc").scrollTop() + $("#toc").find(".active").offset().top - $("#toc").offset().top;
var d_left = document.getElementById("toc").offsetLeft;
var d_top = document.getElementById("toc").offsetTop;
var d_width = document.getElementById("toc").clientWidth;
var d_height = document.getElementById("toc").clientHeight;
if(wx < d_left || wy
$("#toc").scrollTop(_hh-_height);
}
});
12345678910111213141516171819202122
无论怎么滚动文章,对应的当前目录始终显示在目录中间位置。
————————————————
版权声明:本文为CSDN博主「xiaojin21cen」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/xiaojin21cen/article/details/78752561