Wordpress code highlighting (non-plug-ins) and wordpress code highlighting

Source: Internet
Author: User
Tags cloudflare delete cache

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>.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.