MarkdownPad2代码高亮插件兼容移动端样式
生活随笔
收集整理的這篇文章主要介紹了
MarkdownPad2代码高亮插件兼容移动端样式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
如果不知道MarkdownPad2使用代碼高亮插件可以查看前一篇文章《MarkdownPad2使用代碼高亮插件》
先看移動端效果圖:
移動端點擊查看效果或者手機掃如下二維碼:
我們經常閱讀微信公眾號文章的時候,常常看到文章內有高亮的代碼,并且這代碼不會換行,可以左右拖動滾動這樣的效果對于我們閱讀代碼很方便也很舒服,上一篇文章使用高亮插件并不兼容移動端,經過簡單的對高亮代碼樣式得修改,再通過markdownpad2導出html,這樣我們就可以在移動端查看自己的代碼筆記了。這個時候有人會納悶我在移動端怎么打開html文件呢?這個我們可以通過githbub建立一個靜態網站的倉庫,這里就不多提了,然后上傳到github,我們就可以移動端訪問自己的代碼筆記啦!當然我只對高亮代碼的樣式進行了修改,后續不斷完善。
css樣式是在sunburst.css基礎上修改的,完整代碼如下:
/* Pretty printing styles. Used with prettify.js. */
/* Vim sunburst theme by David Leibovic */
pre .str, code .str { color: #65B042; } /* string - green */
pre .kwd, code .kwd { color: #E28964; } /* keyword - dark pink */
pre .com, code .com { color: #AEAEAE; font-style: italic; } /* comment - gray */
pre .typ, code .typ { color: #89bdff; } /* type - light blue */
pre .lit, code .lit { color: #3387CC; } /* literal - blue */
pre .pun, code .pun { color: #fff; } /* punctuation - white */
pre .pln, code .pln { color: #fff; } /* plaintext - white */
pre .tag, code .tag { color: #89bdff; } /* html/xml tag - light blue */
pre .atn, code .atn { color: #bdb76b; } /* html/xml attribute name - khaki */
pre .atv, code .atv { color: #65B042; } /* html/xml attribute value - green */
pre .dec, code .dec { color: #3387CC; } /* decimal - blue */
pre.prettyprint, code.prettyprint {
background-color: rgb(47, 54, 64);
border-radius: 8px;
}
pre.prettyprint {
display: block;
width: 95%;
margin: 1em auto;
padding: 1em;
box-sizing: border-box;
overflow: auto;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE; } /* IE indents via margin-left */
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,li.L3,li.L5,li.L7,li.L9 { }
@media print {
pre .str, code .str { color: #060; }
pre .kwd, code .kwd { color: #006; font-weight: bold; }
pre .com, code .com { color: #600; font-style: italic; }
pre .typ, code .typ { color: #404; font-weight: bold; }
pre .lit, code .lit { color: #044; }
pre .pun, code .pun { color: #440; }
pre .pln, code .pln { color: #000; }
pre .tag, code .tag { color: #006; font-weight: bold; }
pre .atn, code .atn { color: #404; }
pre .atv, code .atv { color: #060; }
}
body{margin:0;padding:0}
h2{ font-family: 宋體;}
.prettyprint span{
line-height:21px;
font-size:18px;
}
pre code{ width:100%; overflow:auto; display:block;}
總結
以上是生活随笔為你收集整理的MarkdownPad2代码高亮插件兼容移动端样式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用kail做wifi渗透,网卡rtl8
- 下一篇: nRF52系列来袭,Nordic的低功耗