代码高亮效果

  1. 前言
  2. Java
    1. 普通java类
    2. JSP
    3. FreeMarker
  3. HTML/CSS/JAVASCRIPT
    1. HTML
    2. CSS
    3. JAVASCRIPT
  4. PYTHON
  5. sql

前言

想要扩展hexo的代码高亮支持,所以写下效果供自己参考

Java

普通java类

package com.yyj.day3;

/**
 * Created by Yelog on 27/08/16.
 */
public class Person {

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    //重写String方法 by Yelog
    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

JSP

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/include/include.inc.jsp" %>
<html>
<head>
    <title>主页</title>
</head>
<body>
<c:forEach var="i" begin="1" end="5">
    Item <c:out value="${i}"/><br>
</c:forEach>
</body>
<script type="text/javascript" src="jquery.js"></script>
</html>

FreeMarker

<#include "top.ftl" >
<#assign hrefs={"1":"index.html","2":"about.html","3":"contact.html"}>
<#list hrefs as href>
    <li class="nav-item dropdown mega-fluid">
        <#if href=="1">
        ${href}
        <#else>
        <b>${href}</b>
        </#if>
    </li>
</#list>

HTML/CSS/JAVASCRIPT

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>test</title>
    <style>
        a{
            color: rebeccapurple;
            margin-top: 100px;
        }
    </style>
</head>
<body>
<b>hello</b>
<h1>Word</h1>
<a class="btn" href="javascript:hello();">哈哈</a>
</body>
<script>
    function hello() {
        alert("hello");
    }
</script>
</html>

CSS

.flat-btn.-gray:before{background-color:#445862;}
.btn.-sm{font-size:14px;padding:7px 20px 6px 20px;}
.btn.-xs{font-size:12px;padding:5px 13px;}
.btn.-lg{font-size:18px;padding:12px 40px;}

JAVASCRIPT

function hello(){
  alert("hello");
  console.log("hello");
}
function startTime()
{
var today=new Date()
var h=today.getHours()
var m=today.getMinutes()
var s=today.getSeconds()
// add a zero in front of numbers<10
m=checkTime(m)
s=checkTime(s)
document.getElementById('txt').innerHTML=h+":"+m+":"+s
t=setTimeout('startTime()',500)
}

function checkTime(i)
{
if (i<10)
  {i="0" + i}
  return i
}

PYTHON

from multiprocessing import Process, Lock

def f(lock, n) :
    lock.acquire()
    print("hello world %d" % n)
    lock.release()

if __name__ == "__main__" :
    lock = Lock()
    for num in range(10):
        Process(target=f, args=(lock, num)).start()

sql

#说明:创建数据库
CREATE DATABASE database-name;
#说明:删除数据库
drop database dbname;
#说明:创建新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..);
#查询
select * from table1 where 范围;
#插入
insert into table1(field1,field2) values(value1,value2);
#删除
delete from table1 where 范围
#更新
update table1 set field1=value1 where 范围

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 jaytp@qq.com

文章标题:代码高亮效果

文章字数:434

本文作者:叶落阁

发布时间:2016-10-13, 14:00:41

最后更新:2017-11-06, 10:20:12

原始链接:http://yelog.org/2016/10/13/highlight-effect/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏