2016년 6월 1일 수요일

To highlight code syntax for Blogger

Frist install a "Syntax Highlighter"



1. Find a "Syntax Highlighter" suitable for you.
 -I choosed "highlight.js"

2. Visit the site "highlight.js" and copy installing code.
 -https://highlightjs.org/download/

3. Add supplement code to use on Web page.
 -https://highlightjs.org/usage/

4. Final code is

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

5. Copy the final code, and paste it on the template HTML setting.

>find blogger template

>find HTML setting

>find </head> and paste code above it


6. You can customize syntax highlight style.

-change code "default.min.css"

-for example "googlecode.min.css"


You completed setting, now you convert your code when you are blogging

1. if you want to write HTML code on blog, code needs escaping -http://www.bloggerspice.com/p/pre-code-parser.html 2. Wraping the escaped code -<pre><code class="html">...</code></pre> -<pre><code class="nohighlight">...</code></pre> 3. Click HTML button when you write, and paste it

댓글 없음:

댓글 쓰기