轻量级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(){ $(" ...
随机推荐
- js数组去重
这就是数组去重了...var str=['hello','node','element','node','hello','blue','red'];var str1=[]; function firs ...
- Devexpress GridControl.Export
private void mnuExportTable_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { u ...
- HTML5简介
HTML5简介 HTML5是HTML的最新修订标准.2014年10月29日,万维网联盟(W3C)宣布,经过8年的努力,HTML5标准规范制定完成. HTML5的设计目的是在移动设备上使用多媒体. HT ...
- 解决 Tomcat Server in Eclipse unable to start within 45 seconds 不能启动的问题
1.在 Eclipse 下方 Servers TAB页,双击 "Tomcat 7.0 at localhost": 2.在右上角处点开 Timeouts 的设定,修改Start( ...
- java IO流详解
流的概念和作用 学习Java IO,不得不提到的就是JavaIO流. 流是一组有顺序的,有起点和终点的字节集合,是对数据传输的总称或抽象.即数据在两设备间的传输称为流,流的本质是数据传输,根据数据传输 ...
- Css3新特性应用之视觉效果
一.单侧阴影 box-shadow属性的应用,格式:h-shadow v-shadow blur spread color inset属性取值介绍 h-sahdow:水平阴影的位置,允许负值 v-sh ...
- Css3新特性总结之边框与背景(一)
本系列主要总结Css3一些新特性的认识,来源于<css揭秘>书. 一.半透明边框 css3最好用hsla,而不是rgba,hsla是:h:颜色值(0~360):s:饱合度(0%~100%) ...
- AlloyTouch 0.2.0发布--鱼和熊掌兼得
原文链接:https://github.com/AlloyTeam/AlloyTouch/wiki/AlloyTouch-0.2.0 背景 公司师姐昨日在KM发了篇长文,主要结论RAF+transfo ...
- Visual Studio 生成事件命令
Visual Studio在生成项目工程前后,有时我们需要做一些特殊的操作,比如:拷贝生成的dll到指定目标下面等. 结合VS可以添加预先生成事件和后期生成事件,采用命令或bat批处理. 1.Visu ...
- 萌新笔记——封装hiredis——C++与redis对接(一)(string的SET与GET操作)
在菜鸟教程自学了redis,总想着像Mysql一样,在C/C++中进行对接.于是查询了一些资料,最后找到了hiredis.然而直接用它的话,难免有点不方便.于是,对其进行封装. hiredis直接去g ...