Introduction:
When highlighting code in Blogger as following:
The HTML code has to be generated manually in the post as follows:
class MyClass { private: int Counter; std::vector<int> mCountList; public: MyClass(void); public: void Show(void); }
The HTML code has to be generated manually in the post as follows:
<pre class="prettyprint lang-cpp"> class MyClass { private: int Counter; std::vector<int> mCountList; public: MyClass(void); public: void Show(void); } </pre>
It is easy to make a mistake with the wrong typing causes exception occurred and not convenient to modify if the code is in HTML or XML because of some symbols(<, >, &) are the reserved characters in the markup languages. Those problems confused me while I tried to write the blog with code if I didn't use the highlighting code frequently. In order to solve this problem and improve the efficiency of writing blog, I developed this tool as follows to help me convert the code of languages Google Code-Prettify supported into HTML code.
In this post, I would like to introduce how to use this tool to get correct (so far) HTML code for the Blogger.
How to use:
- Goes to https://blog-code-highlight.appspot.com
- Type or paste the source code in the text area on the left-hand side.
- Choose the language type which supported by Google Code-Prettify listed as follows:
list here.
- Choose the version of HTML if you want to generate the code in HTML5.
- Tick Show Line Number if you want to show line number in the code. In addition, the first line number can be specified.
- Copy the formatted code from the Outcome session and paste it into your blog.
[Click Here] goes to this tool.
[Reference]
PS. Sorry for the ads. I need to get some funds if the quota is running out.
No comments:
Post a Comment