zoukankan      html  css  js  c++  java
  • 百度ueditor编辑器代码高亮

    百度的ueditor是国内比较好用的富文本编辑器,这里要讲解的是ueditor中一个很小的功能:代码高亮;

    对于我们这些写个博客三句不离代码的码农们来说,能看到段高亮的代码那欣喜是无以言表的;

    没图我说个。。;上图;以上篇文章为例;

    示例环境:ueditor1.4.3

    未高亮的代码:

    白俊遥博客

    代码高亮后:

    白俊遥博客

    如此大的反差;就不废话再吹嘘它的优美了;重点来说使用ueditor如何代码高亮;

    很简单,但是很多人都不知道这个功能,或者是不知道怎么用;

    首先在编辑文章的时候选择对应的代码语言;

    白俊遥博客

    然后在文章展示页面的head头内引入

    1
    2
    3
    4
    5
    <script type="text/javascript" src="/Public/static/ueditor1_4_3/third-party/SyntaxHighlighter/shCore.js"></script>
    <link rel="stylesheet" href="/Public/static/ueditor1_4_3/third-party/SyntaxHighlighter/shCoreDefault.css">
    <script type="text/javascript">
        SyntaxHighlighter.all();
    </script>

    自行调整自己实际项目中的路径即可;

  • 相关阅读:
    spring boot 启动类 添加组件
    spirng boot 添加过滤器
    spring cloud spring-hystrix 缓存
    spring cloud spring-hystrix
    spring cloud spirng整合feign
    spring cloud feign
    cxf-client
    spring cloud客户端启用负载均衡
    spring cloud 负载均衡自定义
    VS2013 配置pthread
  • 原文地址:https://www.cnblogs.com/shuaibai123/p/4743915.html
Copyright © 2011-2022 走看看