为知笔记发布到博客园,代码高亮失效问题

博客设置 -> 页面定制CSS代码
填入以下样式表

  1. /*
  2. Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
  3. */
  4. .hljs {
  5. display: block; padding: 0.5em;
  6. background: #F0F0F0;
  7. }
  8. .hljs,
  9. .hljs-subst,
  10. .hljs-tag .hljs-title,
  11. .lisp .hljs-title,
  12. .clojure .hljs-built_in,
  13. .nginx .hljs-title {
  14. color: black;
  15. }
  16. .hljs-string,
  17. .hljs-title,
  18. .hljs-constant,
  19. .hljs-parent,
  20. .hljs-tag .hljs-value,
  21. .hljs-rules .hljs-value,
  22. .hljs-rules .hljs-value .hljs-number,
  23. .hljs-preprocessor,
  24. .hljs-pragma,
  25. .haml .hljs-symbol,
  26. .ruby .hljs-symbol,
  27. .ruby .hljs-symbol .hljs-string,
  28. .hljs-aggregate,
  29. .hljs-template_tag,
  30. .django .hljs-variable,
  31. .smalltalk .hljs-class,
  32. .hljs-addition,
  33. .hljs-flow,
  34. .hljs-stream,
  35. .bash .hljs-variable,
  36. .apache .hljs-tag,
  37. .apache .hljs-cbracket,
  38. .tex .hljs-command,
  39. .tex .hljs-special,
  40. .erlang_repl .hljs-function_or_atom,
  41. .asciidoc .hljs-header,
  42. .markdown .hljs-header,
  43. .coffeescript .hljs-attribute {
  44. color: #800;
  45. }
  46. .smartquote,
  47. .hljs-comment,
  48. .hljs-annotation,
  49. .hljs-template_comment,
  50. .diff .hljs-header,
  51. .hljs-chunk,
  52. .asciidoc .hljs-blockquote,
  53. .markdown .hljs-blockquote {
  54. color: #888;
  55. }
  56. .hljs-number,
  57. .hljs-date,
  58. .hljs-regexp,
  59. .hljs-literal,
  60. .hljs-hexcolor,
  61. .smalltalk .hljs-symbol,
  62. .smalltalk .hljs-char,
  63. .go .hljs-constant,
  64. .hljs-change,
  65. .lasso .hljs-variable,
  66. .makefile .hljs-variable,
  67. .asciidoc .hljs-bullet,
  68. .markdown .hljs-bullet,
  69. .asciidoc .hljs-link_url,
  70. .markdown .hljs-link_url {
  71. color: #080;
  72. }
  73. .hljs-label,
  74. .hljs-javadoc,
  75. .ruby .hljs-string,
  76. .hljs-decorator,
  77. .hljs-filter .hljs-argument,
  78. .hljs-localvars,
  79. .hljs-array,
  80. .hljs-attr_selector,
  81. .hljs-important,
  82. .hljs-pseudo,
  83. .hljs-pi,
  84. .haml .hljs-bullet,
  85. .hljs-doctype,
  86. .hljs-deletion,
  87. .hljs-envvar,
  88. .hljs-shebang,
  89. .apache .hljs-sqbracket,
  90. .nginx .hljs-built_in,
  91. .tex .hljs-formula,
  92. .erlang_repl .hljs-reserved,
  93. .hljs-prompt,
  94. .asciidoc .hljs-link_label,
  95. .markdown .hljs-link_label,
  96. .vhdl .hljs-attribute,
  97. .clojure .hljs-attribute,
  98. .asciidoc .hljs-attribute,
  99. .lasso .hljs-attribute,
  100. .coffeescript .hljs-property,
  101. .hljs-phony {
  102. color: #88F
  103. }
  104. .hljs-keyword,
  105. .hljs-id,
  106. .hljs-title,
  107. .hljs-built_in,
  108. .hljs-aggregate,
  109. .css .hljs-tag,
  110. .hljs-javadoctag,
  111. .hljs-phpdoc,
  112. .hljs-yardoctag,
  113. .smalltalk .hljs-class,
  114. .hljs-winutils,
  115. .bash .hljs-variable,
  116. .apache .hljs-tag,
  117. .go .hljs-typename,
  118. .tex .hljs-command,
  119. .asciidoc .hljs-strong,
  120. .markdown .hljs-strong,
  121. .hljs-request,
  122. .hljs-status {
  123. font-weight: bold;
  124. }
  125. .asciidoc .hljs-emphasis,
  126. .markdown .hljs-emphasis {
  127. font-style: italic;
  128. }
  129. .nginx .hljs-built_in {
  130. font-weight: normal;
  131. }
  132. .coffeescript .javascript,
  133. .javascript .xml,
  134. .lasso .markup,
  135. .tex .hljs-formula,
  136. .xml .javascript,
  137. .xml .vbscript,
  138. .xml .css,
  139. .xml .hljs-cdata {
  140. opacity: 0.5;
  141. }
  142. pre {
  143. font-size: 13px;
  144. }
  145. pre, code {
  146. font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  147. word-wrap: break-word;
  148. }
  149. .pln {
  150. color: #48484C; }
  151. .str {
  152. color: #DD1144; }
  153. .kwd {
  154. color: #1E347B; }
  155. .com {
  156. color: #93A1A1; }
  157. .typ {
  158. color: teal; }
  159. .lit {
  160. color: #195F91; }
  161. .pun {
  162. color: #93A1A1; }
  163. .opn {
  164. color: #93A1A1; }
  165. .clo {
  166. color: #93A1A1; }
  167. .tag {
  168. color: #008; }
  169. .atn {
  170. color: teal; }
  171. .atv {
  172. color: #DD1144; }
  173. .dec {
  174. color: teal; }
  175. .var {
  176. color: teal; }
  177. .fun {
  178. color: #DC322F; }
  179. /* Put a border around prettyprinted code snippets. */
  180. pre.prettyprint {
  181. background-color: #F7F7F9;
  182. padding: 0px;
  183. border: 1px solid #E1E1E8;
  184. tab-size: 4; }
  185. pre.prettyprint.linenums {
  186. overflow: auto;
  187. -webkit-overflow-scrolling: touch;
  188. }
  189. /* Specify class=linenums on a pre to get line numbering */
  190. pre.prettyprint.linenums ol.linenums {
  191. box-shadow: 40px 0 0 #FBFBFC inset, 41px 0 0 #ECECF0 inset;
  192. color: #1E347B;
  193. padding: 10px 10px 10px 40px !important;
  194. margin-top: 0;
  195. margin-bottom: 0;
  196. }
  197. pre.prettyprint.linenums ol.linenums li {
  198. color: #BEBEC5;
  199. line-height: 18px;
  200. padding-left: 12px !important;
  201. }
  202. pre.prettyprint.linenums ol.linenums li.L0,
  203. pre.prettyprint.linenums ol.linenums li.L1,
  204. pre.prettyprint.linenums ol.linenums li.L2,
  205. pre.prettyprint.linenums ol.linenums li.L3,
  206. pre.prettyprint.linenums ol.linenums li.L4,
  207. pre.prettyprint.linenums ol.linenums li.L5,
  208. pre.prettyprint.linenums ol.linenums li.L6,
  209. pre.prettyprint.linenums ol.linenums li.L7,
  210. pre.prettyprint.linenums ol.linenums li.L8,
  211. pre.prettyprint.linenums ol.linenums li.L9 {
  212. list-style-type: decimal !important;
  213. }





原文地址:https://www.cnblogs.com/xiejunzhao/p/7a4b1e5050fc94024aa24b2d5d2d9a29.html