Windows Live Writer plug-in

Source: Internet
Author: User

1. Every time Windows Live Writer is used, it is awkward to paste the code, and the code folding function is not provided. Although there are not many places to use, I am always upset.

Today, we will take the time to provide these functions in the form of plug-ins for future use:

1. Use the Paste from Visual Studio plug-in to Paste the code;

2. You can easily understand the following code:

Expand
Collapse public class CollapseExpandPlugin: ContentSource {public override DialogResult CreateContent (IWin32Window dialogOwner, ref string content) {try {string expand = "<pre id = \" collapse \ "class = \" code \ "> <a href = \" javascript: void (0 ); \ "onclick = \" document. getElementById ('expand '). style. display = 'block'; document. getElementById ('collapse '). style. display = 'none'; \ "> Expand </a> </pre> \ r \ n"; string collapse = "<pre style = \" display: none \ "id = \" expand \ "class = \" code \ "> <a href = \" javascript: void (0); \ "onclick = \" document. getElementById ('collapse '). style. display = 'block'; document. getElementById ('expand '). style. display = 'none'; \ "> hide </a> \ r \ n"; content = Regex. replace (content, @ "<pre \ s + [^>] *>", expand + collapse, RegexOptions. ignoreCase | RegexOptions. multiline); return DialogResult. OK;} catch {MessageBox. show ("Collapse & Expand cocould not convert that content. "," Convert Problem ", MessageBoxButtons. OK, MessageBoxIcon. hand);} return DialogResult. cancel ;}}

NOTE: Refer to Lao Zhao's code style.

Update: added a flag (Ticks) To differentiate different code blocks. Provides source code download.

2. I have read the copyright description mentioned in the CnBlogs Blog typographical skills-YJingLee's Blog-Blog garden post a while ago, at that time, I thought that if I used the Windows Live Writer plug-in, I could easily add it after every article.

You need to set your own copyright information before use, so that you can directly Insert the content you set in your blog. For the convenience of your copyright style, I just provided a simple but practical text box in the option settings for you to enter your copyright information. You can see the actual effect at the end of the article. For the copyright content, refer to the template provided by YJingLee.

The plug-in code is very simple. You are welcome to download and try the code.

Author: Hans. Hu
Source: http://huyh.cnblogs.com
The copyright of this article is shared by the author and the blog Park. You are welcome to repost this article. However, you must retain this statement without the author's consent and provide a clear link to the original article on the article page. Otherwise, you will be held legally liable.

Related Article

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.