Wordpress code highlighting (non-plug-ins) and wordpress code highlighting
Personal blog address:Http://www.findspace.name/Pre
After changing the topic and deciding to use markdown to write articles, you no longer need to use the original website conversion code to highlight and then insert text. However, the new theme is hard to work with and tangle with the code.
Finally, when using the markdown editor of the Remarkable linux, I found that the webpage can be saved as a webpage with code highlighted format. I thought I checked the source code through the css style, it turned out to be using a js script hanging on the Internet. Great!
As soon as I see the previous section, I understand,
Start: Copy link and script:
<link href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/styles/github.min.css" rel="stylesheet"/> <script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js"> </script>
Later, I found that adding this directly is killing myself, reducing the access speed of my blog, downloading it from share on Baidu's online storage, uploading it to my blog, and changing it to the link of my blog.
Find header. php In the topic folder and add itPreviously.
Copy the script function call part: <script> hljs.initHighlightingOnLoad(); </script>
Find footer. php and add it</body>
Before
Upload overwrite: [Delete cache. If you use wp-super cache or something like this]. Refresh the webpage. OK! PS: This is much easier than using plug-ins or modifying css by yourself!
However, note the following:
If you are writing with markdown, use the code
''
''
If wordpress comes with wordpress directly, click to insert code or use it in text.<code></code>
.