轻量级jQuery语法高亮代码高亮插件jQuery Litelighter。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>jQuery Litelighter</title>
<style>
body{background: #FAF9F4;}
#wrapper h1{ color: #000; letter-spacing: 2px; font-size: 30px;}
#wrapper h2{ color: #74151F; letter-spacing: 2px; font-size: 24px; }
#wrapper h3{ color: #555; letter-spacing: 2px;font-size: 22px; }
#wrapper h4{color: #555; letter-spacing: 2px; font-size: 18px; }
#wrapper p{ line-height: 30px;color: #555;font-size: 16px; margin: 10px 0; }
#wrapper a{ color: #7B94B2; }
#wrapper a:hover{ color: #5B7492; }
#wrapper{ text-align: left; margin: 40px; background-color:#FCE8E0;min-height: 200px; padding: 20px; }
#nav{ margin: 0 0 20px 20px; }
#wrapper pre{ margin: 10px 0; padding: 10px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;font-size:18px;}
#wrapper pre.code{overflow: auto;}
#wrapper textarea{width:780px;background: #ccc;overflow: hidden;padding:5px 0 5px 20px;resize:none;color: #555;margin: 20px 0;}
</style>
</head>
<body>
<div class="wrap">
<h1>轻量级jQuery语法高亮代码高亮插件jQuery Litelighter</h1>
官网:http://trentrichardson.com/examples/jQuery-Litelighter/
下载:https://github.com/trentrichardson/jQuery-Litelighter
<p>
拥有两种主题颜色显示代码: <br>
data-llstyle="dark"or data-llstyle="light";<br>
可调整字体颜色大小;<br>
可添加指定代码样式,提供通用、js、css,html;<br>
支持JS、HTML CSS 以及PHP、SQL代码语法高亮显示;
</p>
<h2>使用方法:</h2>
<h3>1.引入js插件</h3>
<textarea style="height:50px;">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-litelighter.js"></script>
<script type="text/javascript" src="js/jquery-litelighter-extra.js"></script>
</textarea>
<h3>2.html文件</h3>
<textarea style="height:260px;">
<pre class="code example" data-lllanguage="js" data-llstyle="dark">
内容:小括号用<和>代替;
</pre>
内容:
<!--This is a comment-->
<table>
<tr>
<th data-ptcolumn="description">Description</th>
<th data-ptcolumn="type">Type</th>
<th data-ptcolumn="purchased">Purchased</th>
<th data-ptcolumn="condition">Condition</th>
<th data-ptcolumn="modelnum">Model #</th>
<th data-ptcolumn="serialnum">Serial #</th>
<th data-ptcolumn="assignedto">Assigned To</th>
<th data-ptcolumn="lang">Language</th>
</tr>
</table>
</textarea>
<h3>3.函数调用</h3>
<textarea style="height:125px;">
<script type="text/javascript">
$(document).ready(function(){
$('pre').litelighter({
style: 'light',
});
});
</script>
</textarea>
</div>
<div id="wrapper">
<h3>例子:</h3>
<h3>JS</h3>
<pre class="code example" data-lllanguage="js" data-llstyle="dark">
$pt = $('#listingsTable1').powertable({
controller: '#tableController',
moveDisabled: ['condition'],
fixedColumns: ['description'],
fixedRows: [0]
});
</pre>
<h3>Html</h3>
<pre class="code example" data-lllanguage="html" data-llstyle="dark">
<!--This is a comment-->
<table>
<tr>
<th data-ptcolumn="description">Description</th>
<th data-ptcolumn="type">Type</th>
<th data-ptcolumn="purchased">Purchased</th>
<th data-ptcolumn="condition">Condition</th>
<th data-ptcolumn="modelnum">Model #</th>
<th data-ptcolumn="serialnum">Serial #</th>
<th data-ptcolumn="assignedto">Assigned To</th>
<th data-ptcolumn="lang">Language</th>
</tr>
</table>
<style type="text/css">
body{ font-size: 12px; background-color: #005500; }
#myelement{
line-height: 22px;
font-size: 2em;
}
</style>
<script type="text/javascript">
/*
here is some script
*/
if(myvar == "foobar"){
for(i=1; i < myarr.length; i++){
// some output
$('#myEl').removeClass('highlight');
return "2012-06-23".match( /^(\d{4})\-(\d{2})\-(\d{2})$/ );
}
}
</script></pre>
<h3>CSS</h3>
<pre class="code example" data-lllanguage="css" data-llstyle="dark">
/* pt specific styles: ptfixed, ptdragover, ptdraghandle, ptshowhide */
table tr th.ptfixed{ font-size: 12%; /* a fixed table header cell */ }
table tr td.ptfixed{ color: #8F9657; }
table .ptdragover{ height: 100px; width: 100%; }
table .ptdraghandle{ font-family: "Sans Serif"; }
table .ptshowhide:hover{ /* class given to a generated show/hide link */ }</pre>
<h3>Generic</h3>
<pre class="code example" data-lllanguage="generic" data-llstyle="dark">
// some comments
for(i=0; i<10; i++){
/*
this is some pseudo code
*/
str += " concat str";
}
</pre>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-litelighter.js"></script>
<script type="text/javascript" src="js/jquery-litelighter-extra.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// all you need to get started
$('pre').litelighter();
// toggle examples on/off
var on = true;
$('#toggleOnOff').click(function(e){
e.preventDefault();
if(on) $('pre.example').litelighter('disable');
else $('pre.example').litelighter('enable');
on = !on;
});
// toggle light to dark themes
var light = false;
$('#toggleLightDark').click(function(e){
e.preventDefault();
if(light) $('pre.example').litelighter('option','style','dark');
else $('pre.example').litelighter('option','style','light');
light = !light;
});
});
</script>
</body>
</html>
轻量级jQuery语法高亮代码高亮插件jQuery Litelighter。的更多相关文章
- jQuery延迟加载(懒加载)插件 – jquery.lazyload.js-Web前端(W3Cways.com) - Web前端学习之路
Lazy Load 是一个用 JavaScript 编写的 jQuery 插件. 它可以延迟加载长页面中的图片. 在浏览器可视区域外的图片不会被载入, 直到用户将页面滚动到它们所在的位置. 这与图片预 ...
- jQuery图片懒加载插件jquery.lazyload.js使用实例注意事项说明
jQuery图片懒加载插件jquery.lazyload.js使用实例注意事项说明 jquery.lazyload.js是一个用JavaScript编写的jQuery插件.它可以延迟加载长页面中的图片 ...
- HelloDjango 第 09 篇:让博客支持 Markdown 语法和代码高亮
作者:HelloGitHub-追梦人物 文中涉及的示例代码,已同步更新到 HelloGitHub-Team 仓库 为了让博客文章具有良好的排版,显示更加丰富的格式,我们使用 Markdown 语法来书 ...
- Markdown 语法和代码高亮
安装 Python Markdown 安装命令 pip install markdown 视图中渲染 Markdown blog/views.py import markdown from djang ...
- jquery提交form表单插件jquery.form.js
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 自己编写jQuery动态引入js文件插件 (jquery.import.dynamic.script)
这个插件主要是结合jquery或者xhr异步请求来使用的,它可以把已经引入过的js文件记录在浏览器内存中,当下次再引入相同的文件就忽略该文件的引入. 此插件不支持浏览器刷新保存数据,那需要利用cook ...
- jquery二维码生成插件jquery.qrcode.js
插件描述:jquery.qrcode.js 是一个能够在客户端生成矩阵二维码QRCode 的jquery插件 ,使用它可以很方便的在页面上生成二维条码. 转载于:http://www.jq22.com ...
- jQuery延迟加载(懒加载)插件 – jquery.lazyload.js
引入:<script type="text/javascript" src="${base}/resources/shop/js/jquery.lazyload.j ...
- jquery 缓冲加载图片插件 jquery.lazyload
第一:加入jquery 第二:加入jquery.lazy.load.js文件 第三:在网页中加<script> $(document).ready(function(){ $(" ...
随机推荐
- C# ShellExcute与Process
C#运行外部程序的两种方法 ShellExecute using System.Runtime.InteropServices; public enum ShowWindowCommands : in ...
- Entity Framework 教程——概述
Entity Framework 基础 本教材将手把手教你使用entity framework,我们将使用entity framework 6.0和visual studio 2012. 以下表格是e ...
- 如何在虚拟机安装桌面Ubuntu
本篇仅为作业... 实验课程:Linux 实验机器:联想y410p 指导老师:刘臣奇 实验时间:2016年10月12日 学生学号:140815 姓名:杨文乾 一.新建一个虚拟机,按照之前建立虚拟机的步 ...
- Xcode7.1环境下上架iOS App到AppStore 流程③(Part 三)
前言部分 part三 部分主要讲解 Xcode关联绑定发布证书的配置.创建App信息.使用Application Loader上传.ipa文件到AppStore 一.Xcode配置发布证书信息 1)给 ...
- vs2015 已经支持开发asp .net core 1.0 rc2 程序了
vs2015 已经支持开发asp .net core 1.0 rc2 程序了 http://mp.weixin.qq.com/s?__biz=MzI0MzM1ODczOQ==&mid=2247 ...
- 严重: Exception sending context initialized event to listener instance of class
问题描述:Exception sending context initialized event to listener instance of class org.springframework.w ...
- Idea SpringMVC+Spring+MyBatis+Maven调整【转】
Idea SpringMVC+Spring+MyBatis+Maven整合 创建项目 File-New Project 选中左侧的Maven,选中右侧上方的Create from archetyp ...
- 【项目管理】图解GitHub基本操作
一.注册并登陆到github网站 1.1.打开github网站首页(https://github.com/) 1.2.注册一个自己的github账号 创建账户后再验证自己的邮箱,然后就可以登陆到git ...
- 正确制作一个iframe,认识iframe
iframe作为一个网站之间交互的桥梁,受到很多站长的喜爱,但是又有不安全的因素存在,所以正确填写属性是很重要的. <iframe name="my_iframe" heig ...
- Android 手机卫士--导航界面2
本文地址:http://www.cnblogs.com/wuyudong/p/5947504.html,转载请注明出处. 在之前的文章中,实现了导航界面1布局编写与相关的逻辑代码,如下图所示: 点击“ ...