• Windows Live Writer代码插件整理


    以下code插件命名按照 Windows Live Writer 中显示的插件名

    image

    1、Source code plug-in(cnblogs官方推荐)

    界面:

    image

    image

    效果:

    /**
     * Returns the value in the current thread's copy of this
     * thread-local variable.  If the variable has no value for the
     * current thread, it is first initialized to the value returned
     * by an invocation of the {@link #initialValue} method.
     * 返回当前线程的线程本地变量副本的值
     * 如果当前线程的这个变量还没有赋值,可以通过调用 setInitialValue()方法赋初始值
     *
     * @return the current thread's value of this thread-local
     */
    public T get() {
        Thread t = Thread.currentThread();//当前线程
        ThreadLocalMap map = getMap(t);//获取当前线程的 ThreadLocalMap
        //如果ThreadLocalMap不为空
        if (map != null) {
            //以当前 ThreadLocal(线程本地变量)为key,从ThreadLocalMap中获取对应的Entry(key:ThreadLocal,value:Object)
            ThreadLocalMap.Entry e = map.getEntry(this);
            if (e != null)
                return (T)e.value;
        }
        
        //如果还当前ThreadLocal(线程本地变量)无法获取value,调用初始化value方法
        return setInitialValue();
    }

    特点:

    1、Windows Live Writer编辑和预览效果不一样

    2、插入代码后不便于再编辑

    3、发布到cnblogs后,效果不错

    下载:http://files.cnblogs.com/files/trust-freedom/SourceCodePlugin_version_1.1.zip

    2、SyntaxHighlighter

    界面:

    image

    效果:

    /**
     * Returns the value in the current thread's copy of this
     * thread-local variable.  If the variable has no value for the
     * current thread, it is first initialized to the value returned
     * by an invocation of the {@link #initialValue} method.
     * 返回当前线程的线程本地变量副本的值
     * 如果当前线程的这个变量还没有赋值,可以通过调用 setInitialValue()方法赋初始值
     *
     * @return the current thread's value of this thread-local
     */
    public T get() {
        Thread t = Thread.currentThread();//当前线程
        ThreadLocalMap map = getMap(t);//获取当前线程的 ThreadLocalMap
        //如果ThreadLocalMap不为空
        if (map != null) {
            //以当前 ThreadLocal(线程本地变量)为key,从ThreadLocalMap中获取对应的Entry(key:ThreadLocal,value:Object)
            ThreadLocalMap.Entry e = map.getEntry(this);
            if (e != null)
                return (T)e.value;
        }
        
        //如果还当前ThreadLocal(线程本地变量)无法获取value,调用初始化value方法
        return setInitialValue();
    }

    参考:http://www.cnblogs.com/rollenholt/archive/2012/03/08/2384594.html

    特点:

    1、Windows Live Writer编辑和预览效果一致

    2、插入代码后便于编辑,点击代码块后,右侧显示

    3、发布到cnblogs后,和Windows Live Writer效果不完全相同,宽度变小了

    image

    下载:http://files.cnblogs.com/files/trust-freedom/SyntaxHighlighter.rar

    3、插入代码(cnblogs官方推荐)

    界面:

    image

    效果:

    /**
     * Returns the value in the current thread's copy of this
     * thread-local variable.  If the variable has no value for the
     * current thread, it is first initialized to the value returned
     * by an invocation of the {@link #initialValue} method.
     * 返回当前线程的线程本地变量副本的值
     * 如果当前线程的这个变量还没有赋值,可以通过调用 setInitialValue()方法赋初始值
     *
     * @return the current thread's value of this thread-local
     */
    public T get() {
        Thread t = Thread.currentThread();//当前线程
        ThreadLocalMap map = getMap(t);//获取当前线程的 ThreadLocalMap
        //如果ThreadLocalMap不为空
        if (map != null) {
            //以当前 ThreadLocal(线程本地变量)为key,从ThreadLocalMap中获取对应的Entry(key:ThreadLocal,value:Object)
            ThreadLocalMap.Entry e = map.getEntry(this);
            if (e != null)
                return (T)e.value;
        }
        
        //如果还当前ThreadLocal(线程本地变量)无法获取value,调用初始化value方法
        return setInitialValue();
    }

    参考:http://www.cnblogs.com/cmt/archive/2012/06/26/live_writer_cnblogs_code_highlight.html

    特点:

    1、和cnblogs官方的浏览器编辑器的code插件效果差不多,高亮效果还不错

    2、Windows Live Writer编辑和预览效果一致

    3、无法显示行号

    4、隔行不能设置不同颜色

    5、插入代码后不便于再编辑,有点类似图片的效果

    下载:http://files.cnblogs.com/files/trust-freedom/WindowsLiveWriter.CNBlogs.CodeHighlighter.zip

    4、插入代码

    界面:

    image

    效果:

      1: /**
      2:  * Returns the value in the current thread's copy of this
      3:  * thread-local variable.  If the variable has no value for the
      4:  * current thread, it is first initialized to the value returned
      5:  * by an invocation of the {@link #initialValue} method.
      6:  * 返回当前线程的线程本地变量副本的值
      7:  * 如果当前线程的这个变量还没有赋值,可以通过调用 setInitialValue()方法赋初始值
      8:  *
      9:  * @return the current thread's value of this thread-local
     10:  */
     11: public T get() {
     12:     Thread t = Thread.currentThread();//当前线程
     13:     ThreadLocalMap map = getMap(t);//获取当前线程的 ThreadLocalMap
     14:     //如果ThreadLocalMap不为空
     15:     if (map != null) {
     16:         //以当前 ThreadLocal(线程本地变量)为key,从ThreadLocalMap中获取对应的Entry(key:ThreadLocal,value:Object)
     17:         ThreadLocalMap.Entry e = map.getEntry(this);
     18:         if (e != null)
     19:             return (T)e.value;
     20:     }
     21:     
     22:     //如果还当前ThreadLocal(线程本地变量)无法获取value,调用初始化value方法
     23:     return setInitialValue();
     24: }

    参考:http://www.cnblogs.com/psunny/archive/2010/03/03/1677693.html

    特点:

    1、编辑界面可选项较多

    2、发不到cnblogs后和Windows Live Writer状态不完全一样,Windows Live Writer中有横向、纵向滚动条,cnblogs中都没有

    3、插入代码后不便于再编辑,有点类似图片的效果

    下载:http://files.cnblogs.com/files/trust-freedom/WLWSourceCodePluginLib.zip

    我也是刚用cnblogs写博客不久,整理了几个觉得还可以的代码插件,欢迎批评指教,如果大家有更好的也欢迎互相交流。

  • 相关阅读:
    Populating Next Right Pointers in Each Node I&&II ——II仍然需要认真看看
    MySQL源码分析以及目录结构
    mysql分表的三种方法
    Hadoop学习
    关系型数据库ACID
    九种基本数据类型和它们的封装类
    java中堆和栈的区别
    软件测试-----Graph Coverage作业
    Lab1--关于安装JUnit的简要描述
    动态导入(import)和静态导入(import)的区别
  • 原文地址:https://www.cnblogs.com/trust-freedom/p/5944177.html
Copyright © 2020-2023  润新知