# Highlight.js
Highlight.js highlights syntax in code examples on blogs, forums and,
in fact, on any web page. It's very easy to use because it works
automatically: finds blocks of code, detects a language, highlights it.
Autodetection can be fine tuned when it fails by itself (see "Heuristics").
## Basic usage
Link the library and a stylesheet from your page and hook highlighting to
the page load event:
```html
<link rel="stylesheet" href="styles/default.css">
<script src="highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
```
This will highlight all code on the page marked up as `<pre><code> .. </code></pre>`.
If you use different markup or need to apply highlighting dynamically, read
"Custom initialization" below.
- You can download your own customized version of "highlight.pack.js" or
use the hosted one as described on the download page:
<http://highlightjs.org/download/>
- Style themes are available in the download package or as hosted files.
To create a custom style for your site see the class reference in the file
[CSS classes reference][cr] from the downloaded package.
[cr]: http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html
## node.js
Highlight.js can be used under node.js. The package with all supported languages is
installable from NPM:
npm install highlight.js
Alternatively, you can build it from the source with only languages you need:
python3 tools/build.py -tnode lang1 lang2 ..
Using the library:
```javascript
var hljs = require('highlight.js');
// If you know the language
hljs.highlight(lang, code).value;
// Automatic language detection
hljs.highlightAuto(code).value;
```
## AMD
Highlight.js can be used with an AMD loader. You will need to build it from
source in order to do so:
```bash
$ python3 tools/build.py -tamd lang1 lang2 ..
```
Which will generate a `build/highlight.pack.js` which will load as an AMD
module with support for the built languages and can be used like so:
```javascript
require(["highlight.js/build/highlight.pack"], function(hljs){
// If you know the language
hljs.highlight(lang, code).value;
// Automatic language detection
hljs.highlightAuto(code).value;
});
```
## Tab replacement
You can replace TAB ('\x09') characters used for indentation in your code
with some fixed number of spaces or with a `<span>` to give them special
styling:
```html
<script type="text/javascript">
hljs.configure({tabReplace: ' '}); // 4 spaces
// ... or
hljs.configure({tabReplace: '<span class="indent">\t</span>'});
hljs.initHighlightingOnLoad();
</script>
```
## Custom initialization
If you use different markup for code blocks you can initialize them manually
with `highlightBlock(code)` function. It takes a DOM element containing the
code to highlight and optionally a string with which to replace TAB
characters.
Initialization using, for example, jQuery might look like this:
```javascript
$(document).ready(function() {
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
});
```
You can use `highlightBlock` to highlight blocks dynamically inserted into
the page. Just make sure you don't do it twice for already highlighted
blocks.
If your code container relies on `<br>` tags instead of line breaks (i.e. if
it's not `<pre>`) set the `useBR` option to `true`:
```javascript
hljs.configure({useBR: true});
$('div.code').each(function(i, e) {hljs.highlightBlock(e)});
```
## Heuristics
Autodetection of a code's language is done using a simple heuristic:
the program tries to highlight a fragment with all available languages and
counts all syntactic structures that it finds along the way. The language
with greatest count wins.
This means that in short fragments the probability of an error is high
(and it really happens sometimes). In this cases you can set the fragment's
language explicitly by assigning a class to the `<code>` element:
```html
<pre><code class="html">...</code></pre>
```
You can use class names recommended in HTML5: "language-html",
"language-php". Classes also can be assigned to the `<pre>` element.
To disable highlighting of a fragment altogether use "no-highlight" class:
```html
<pre><code class="no-highlight">...</code></pre>
```
## Export
File export.html contains a little program that allows you to paste in a code
snippet and then copy and paste the resulting HTML code generated by the
highlighter. This is useful in situations when you can't use the script itself
on a site.
## Meta
- Version: 8.0
- URL: http://highlightjs.org/
For the license terms see LICENSE files.
For authors and contributors see AUTHORS.en.txt file.
没有合适的资源?快使用搜索试试~ 我知道了~
Java项目:小区物业管理系统(java+springboot+thymeleaf+maven+Mysql)
共716个文件
png:216个
js:154个
gif:97个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 104 浏览量
2022-12-31
12:08:26
上传
评论 1
收藏 3.8MB RAR 举报
温馨提示
项目介绍 很完美的一个小区物业管理系统源码,本项目包含管理员与普通用户两种角色。 包括房屋管理,车位管理,交费管理,社区服务等等功能 环境需要 1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 4.数据库:MySql 5.7版本; 5.是否Maven项目:是; 技术栈 springboot+mybatis+mysql+maven+thymeleaf 使用说明 1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,项目运行成功后在浏览器中访问:
资源推荐
资源详情
资源评论
收起资源包目录
Java项目:小区物业管理系统(java+springboot+thymeleaf+maven+Mysql) (716个子文件)
$PROJECT_FILE$ 364B
275d783e298228506068436512433d343feb52aa 0B
5fe9694ac0386183e3ca9c756aa8145394b667d0 0B
7171df7c024808a26040ea210fc78aec82a83023 0B
mvnw.cmd 6KB
layui.css 71KB
notice.css 59KB
editor_ie8.css 41KB
editor_iequirks.css 41KB
editor_ie.css 40KB
editor_gecko.css 39KB
editor.css 39KB
admin.css 30KB
formSelects-v4.css 18KB
dialog_ie8.css 15KB
dialog_iequirks.css 14KB
dialog_ie.css 14KB
layer.css 14KB
dialog.css 13KB
introJs.css 12KB
theme-white.css 11KB
theme-purple-white.css 10KB
theme-red-white.css 10KB
layui.mobile.css 10KB
dropdown.css 8KB
laydate.css 7KB
metroStyle.css 6KB
zTreeStyle.css 6KB
theme-pink.css 5KB
Cropper.css 5KB
theme-red.css 5KB
theme-cyan.css 5KB
theme-purple.css 5KB
theme-yellow.css 5KB
theme-blue.css 5KB
theme-green.css 5KB
cascader.css 5KB
dtreefont.css 4KB
drag.css 4KB
contents.css 3KB
city-picker.css 3KB
dtree.css 3KB
login.css 3KB
default.css 3KB
railscasts.css 2KB
tagsInput.css 2KB
arta.css 2KB
monokai_sublime.css 2KB
obsidian.css 2KB
xcode.css 2KB
sunburst.css 2KB
googlecode.css 2KB
monokai.css 2KB
school_book.css 2KB
magula.css 2KB
far.css 2KB
zenburn.css 2KB
theme-black.css 2KB
brown_paper.css 2KB
docco.css 2KB
atelier-lakeside.light.css 2KB
atelier-lakeside.dark.css 2KB
atelier-seaside.light.css 2KB
dark.css 2KB
atelier-seaside.dark.css 2KB
atelier-forest.light.css 2KB
atelier-forest.dark.css 2KB
atelier-heath.light.css 2KB
idea.css 2KB
atelier-heath.dark.css 2KB
atelier-dune.light.css 2KB
atelier-dune.dark.css 2KB
github.css 2KB
Split.css 2KB
pojoaque.css 2KB
tomorrow-night-blue.css 2KB
solarized_dark.css 2KB
solarized_light.css 2KB
tomorrow-night.css 2KB
rainbow.css 2KB
foundation.css 2KB
vs.css 2KB
tomorrow-night-eighties.css 2KB
tomorrow-night-bright.css 1KB
templates.css 1KB
paraiso.light.css 1KB
paraiso.dark.css 1KB
copyformatting.css 1KB
ir_black.css 1KB
tomorrow.css 1KB
step.css 1KB
tableselection.css 1KB
code.css 1KB
mono-blue.css 899B
ascetic.css 803B
colordialog.css 772B
error-page.css 572B
treetable.css 294B
treeSelect.css 0B
iconfont.eot 41KB
共 716 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
qq1334611189
- 粉丝: 6794
- 资源: 392
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功