├── .github
└── workflows
│ └── main.yml
├── .gitignore
├── README.md
├── audio-player
├── Audio.js
├── audio-player.js
├── audio-player.json
├── audio-player.wxml
├── audio-player.wxss
└── loading.svg
├── build
├── config.js
├── decode.js
├── decode.json
├── decode.wxml
├── decode.wxss
├── dist
├── audio-player
│ ├── Audio.js
│ ├── audio-player.js
│ ├── audio-player.json
│ ├── audio-player.wxml
│ ├── audio-player.wxss
│ └── loading.svg
├── config.js
├── decode.js
├── decode.json
├── decode.wxml
├── decode.wxss
├── img
│ ├── img.js
│ ├── img.json
│ ├── img.wxml
│ └── img.wxss
├── index.js
├── latex
│ ├── latex.js
│ ├── latex.json
│ ├── latex.wxml
│ └── latex.wxss
├── parse
│ ├── highlight
│ │ ├── highlight.js
│ │ ├── index.js
│ │ ├── languages
│ │ │ ├── bash.js
│ │ │ ├── c-like.js
│ │ │ ├── c.js
│ │ │ ├── css.js
│ │ │ ├── dart.js
│ │ │ ├── go.js
│ │ │ ├── htmlbars.js
│ │ │ ├── java.js
│ │ │ ├── javascript.js
│ │ │ ├── json.js
│ │ │ ├── less.js
│ │ │ ├── nginx.js
│ │ │ ├── php.js
│ │ │ ├── python-repl.js
│ │ │ ├── python.js
│ │ │ ├── scss.js
│ │ │ ├── shell.js
│ │ │ ├── typescript.js
│ │ │ └── xml.js
│ │ └── style
│ │ │ ├── github.wxss
│ │ │ └── monokai.wxss
│ ├── index.js
│ ├── markdown
│ │ ├── index.js
│ │ ├── markdown.js
│ │ └── plugins
│ │ │ ├── emoji.js
│ │ │ ├── ins.js
│ │ │ ├── latex.js
│ │ │ ├── mark.js
│ │ │ ├── sub.js
│ │ │ ├── sup.js
│ │ │ ├── todo.js
│ │ │ └── yuml.js
│ └── parse2
│ │ ├── Parser.js
│ │ ├── Tokenizer.js
│ │ ├── domhandler
│ │ ├── index.js
│ │ └── node.js
│ │ ├── entities
│ │ ├── decode.js
│ │ ├── decode_codepoint.js
│ │ ├── encode.js
│ │ ├── index.js
│ │ └── maps
│ │ │ ├── decode.js
│ │ │ ├── entities.js
│ │ │ ├── legacy.js
│ │ │ └── xml.js
│ │ └── index.js
├── style
│ ├── main.wxss
│ └── theme
│ │ ├── dark.wxss
│ │ └── light.wxss
├── table
│ ├── table.js
│ ├── table.json
│ ├── table.wxml
│ └── table.wxss
├── todogroup
│ ├── todogroup.js
│ ├── todogroup.json
│ ├── todogroup.wxml
│ └── todogroup.wxss
├── towxml.js
├── towxml.json
├── towxml.wxml
├── towxml.wxss
└── yuml
│ ├── yuml.js
│ ├── yuml.json
│ ├── yuml.wxml
│ └── yuml.wxss
├── echarts
├── dark.js
├── echarts.js
├── echarts.json
├── echarts.wxml
├── echarts.wxss
├── wx-canvas.js
└── wx-echarts.js
├── img
├── img.js
├── img.json
├── img.wxml
└── img.wxss
├── index.js
├── latex
├── latex.js
├── latex.json
├── latex.wxml
└── latex.wxss
├── package.json
├── parse
├── highlight
│ ├── highlight.js
│ ├── index.js
│ ├── languages
│ │ ├── 1c.js
│ │ ├── abnf.js
│ │ ├── accesslog.js
│ │ ├── actionscript.js
│ │ ├── ada.js
│ │ ├── angelscript.js
│ │ ├── apache.js
│ │ ├── applescript.js
│ │ ├── arcade.js
│ │ ├── arduino.js
│ │ ├── armasm.js
│ │ ├── asciidoc.js
│ │ ├── aspectj.js
│ │ ├── autohotkey.js
│ │ ├── autoit.js
│ │ ├── avrasm.js
│ │ ├── awk.js
│ │ ├── axapta.js
│ │ ├── bash.js
│ │ ├── basic.js
│ │ ├── bnf.js
│ │ ├── brainfuck.js
│ │ ├── c-like.js
│ │ ├── c.js
│ │ ├── cal.js
│ │ ├── capnproto.js
│ │ ├── ceylon.js
│ │ ├── clean.js
│ │ ├── clojure-repl.js
│ │ ├── clojure.js
│ │ ├── cmake.js
│ │ ├── coffeescript.js
│ │ ├── coq.js
│ │ ├── cos.js
│ │ ├── cpp.js
│ │ ├── crmsh.js
│ │ ├── crystal.js
│ │ ├── csharp.js
│ │ ├── csp.js
│ │ ├── css.js
│ │ ├── d.js
│ │ ├── dart.js
│ │ ├── delphi.js
│ │ ├── diff.js
│ │ ├── django.js
│ │ ├── dns.js
│ │ ├── dockerfile.js
│ │ ├── dos.js
│ │ ├── dsconfig.js
│ │ ├── dts.js
│ │ ├── dust.js
│ │ ├── ebnf.js
│ │ ├── elixir.js
│ │ ├── elm.js
│ │ ├── erb.js
│ │ ├── erlang-repl.js
│ │ ├── erlang.js
│ │ ├── excel.js
│ │ ├── fix.js
│ │ ├── flix.js
│ │ ├── fortran.js
│ │ ├── fsharp.js
│ │ ├── gams.js
│ │ ├── gauss.js
│ │ ├── gcode.js
│ │ ├── gherkin.js
│ │ ├── glsl.js
│ │ ├── gml.js
│ │ ├── go.js
│ │ ├── golo.js
│ │ ├── gradle.js
│ │ ├── groovy.js
│ │ ├── haml.js
│ │ ├── handlebars.js
│ │ ├── haskell.js
│ │ ├── haxe.js
│ │ ├── hsp.js
│ │ ├── htmlbars.js
│ │ ├── http.js
│ │ ├── hy.js
│ │ ├── inform7.js
│ │ ├── ini.js
│ │ ├── irpf90.js
│ │ ├── isbl.js
│ │ ├── java.js
│ │ ├── javascript.js
│ │ ├── jboss-cli.js
│ │ ├── json.js
│ │ ├── julia-repl.js
│ │ ├── julia.js
│ │ ├── kotlin.js
│ │ ├── lasso.js
│ │ ├── latex.js
│ │ ├── ldif.js
│ │ ├── leaf.js
│ │ ├── less.js
│ │ ├── lisp.js
│ │ ├── livecodeserver.js
│ │ ├── livescript.js
│ │ ├── llvm.js
│ │ ├── lsl.js
│ │ ├── lua.js
│ │ ├── makefile.js
│ │ ├── markdown.js
│ │ ├── mathematica.js
│ │ ├── matlab.js
│ │ ├── maxima.js
│ │ ├── mel.js
│ │ ├── mercury.js
│ │ ├── mipsasm.js
│ │ ├── mizar.js
│ │ ├── mojolicious.js
│ │ ├── monkey.js
│ │ ├── moonscript.js
│ │ ├── n1ql.js
│ │ ├── nginx.js
│ │ ├── nim.js
│ │ ├── nix.js
│ │ ├── nsis.js
│ │ ├── objectivec.js
│ │ ├── ocaml.js
│ │ ├── openscad.js
│ │ ├── oxygene.js
│ │ ├── parser3.js
│ │ ├── perl.js
│ │ ├── pf.js
│ │ ├── pgsql.js
│ │ ├── php-template.js
│ │ ├── php.js
│ │ ├── plaintext.js
│ │ ├── pony.js
│ │ ├── powershell.js
│ │ ├── processing.js
│ │ ├── profile.js
│ │ ├── prolog.js
│ │ ├── properties.js
│ │ ├── protobuf.js
│ │ ├── puppet.js
│ │ ├── purebasic.js
│ │ ├── python-repl.js
│ │ ├── python.js
│ │ ├── q.js
│ │ ├── qml.js
│ │ ├── r.js
│ │ ├── reasonml.js
│ │ ├── rib.js
│ │ ├── roboconf.js
│ │ ├── routeros.js
│ │ ├── rsl.js
│ │ ├── ruby.js
│ │ ├── ruleslanguage.js
│ │ ├── rust.js
│ │ ├── sas.js
│ │ ├── scala.js
│ │ ├── scheme.js
│ │ ├── scilab.js
│ │ ├── scss.js
│ │ ├── shell.js
│ │ ├── smali.js
│ │ ├── smalltalk.js
│ │ ├── sml.js
│ │ ├── sqf.js
│ │ ├── sql.js
│ │ ├── stan.js
│ │ ├── stata.js
│ │ ├── step21.js
│ │ ├── stylus.js
│ │ ├── subunit.js
│ │ ├── swift.js
│ │ ├── taggerscript.js
│ │ ├── tap.js
│ │ ├── tcl.js
│ │ ├── thrift.js
│ │ ├── tp.js
│ │ ├── twig.js
│ │ ├── typescript.js
│ │ ├── vala.js
│ │ ├── vbnet.js
│ │ ├── vbscript-html.js
│ │ ├── vbscript.js
│ │ ├── verilog.js
│ │ ├── vhdl.js
│ │ ├── vim.js
│ │ ├── x86asm.js
│ │ ├── xl.js
│ │ ├── xml.js
│ │ ├── xquery.js
│ │ ├── yaml.js
│ │ └── zephir.js
│ └── style
│ │ ├── github.wxss
│ │ └── monokai.wxss
├── index.js
├── markdown
│ ├── index.js
│ ├── markdown.js
│ └── plugins
│ │ ├── echarts.js
│ │ ├── emoji.js
│ │ ├── ins.js
│ │ ├── latex.js
│ │ ├── mark.js
│ │ ├── sub.js
│ │ ├── sup.js
│ │ ├── todo.js
│ │ └── yuml.js
└── parse2
│ ├── Parser.js
│ ├── Tokenizer.js
│ ├── domelementtype
│ └── index.js
│ ├── domhandler
│ ├── index.js
│ └── node.js
│ ├── entities
│ ├── decode.js
│ ├── decode_codepoint.js
│ ├── encode.js
│ ├── escape.js
│ ├── generated
│ │ ├── decode-data-html.js
│ │ ├── decode-data-xml.js
│ │ └── encode-html.js
│ └── index.js
│ └── index.js
├── style
├── main.wxss
└── theme
│ ├── dark.wxss
│ └── light.wxss
├── table
├── table.js
├── table.json
├── table.wxml
└── table.wxss
├── todogroup
├── todogroup.js
├── todogroup.json
├── todogroup.wxml
└── todogroup.wxss
├── towxml.js
├── towxml.json
├── towxml.wxml
├── towxml.wxss
├── yarn.lock
└── yuml
├── yuml.js
├── yuml.json
├── yuml.wxml
└── yuml.wxss
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to help you get started with Actions
2 |
3 | name: Build
4 |
5 | # Controls when the action will run.
6 | on:
7 | # Triggers the workflow on push or pull request events but only for the master branch
8 | push:
9 | branches: [ master ]
10 | pull_request:
11 | branches: [ master ]
12 |
13 | # Allows you to run this workflow manually from the Actions tab
14 | workflow_dispatch:
15 |
16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
17 | jobs:
18 | # This workflow contains a single job called "build"
19 | build:
20 | # The type of runner that the job will run on
21 | runs-on: ubuntu-latest
22 |
23 | # Steps represent a sequence of tasks that will be executed as part of the job
24 | steps:
25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26 | - uses: actions/checkout@v2
27 |
28 | # Runs a single command using the runners shell
29 | - name: 编译文件
30 | run: |
31 | yarn
32 | yarn run build
33 |
34 | # Runs a set of commands using the runners shell
35 | - name: Update dist folder to repository
36 | env:
37 | # 仓库用户名
38 | REPO_USERNAME: ""
39 | # GitHub Pages仓库名
40 | DIST_REPO: ""
41 | # GitHub Token
42 | GITHUB_TOKEN: ${{ secrets.G_TOKEN }}
43 |
44 | run: |
45 | git config --global user.email "Action@GitHub.com"
46 | git config --global user.name "GitHub Action"
47 |
48 | cd dist && git init && git add .
49 | git commit -m "GitHub Actions Auto Builder at $(date +'%Y-%m-%d %H:%M:%S')"
50 | git push --force --quiet "https://$GITHUB_TOKEN@github.com/$REPO_USERNAME/$DIST_REPO.git" master:master
51 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /demo/towxml/
2 | /node_modules/
3 | /.vscode/
4 | .DS_Store
5 | project.config.json
6 |
--------------------------------------------------------------------------------
/audio-player/audio-player.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | }
5 | }
--------------------------------------------------------------------------------
/audio-player/audio-player.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{tips.text || 'Error'}}
9 |
10 | {{data.attrs.name}}
11 | {{data.attrs.author}}
12 | {{time.currentTime || '00:00:00'}} / {{time.duration || '00:00:00'}}
13 |
14 |
--------------------------------------------------------------------------------
/decode.js:
--------------------------------------------------------------------------------
1 | const config = require('./config');
2 |
3 | Component({
4 | options: {
5 | styleIsolation: 'apply-shared'
6 | },
7 | properties: {
8 | nodes: {
9 | type: Object,
10 | value: {}
11 | }
12 | },
13 | lifetimes: {
14 | attached: function () {
15 | const _ts = this;
16 |
17 | config.events.forEach(item => {
18 | _ts['_' + item] = function (...arg) {
19 | if (global._events && typeof global._events[item] === 'function') {
20 | global._events[item](...arg);
21 | }
22 | };
23 | });
24 | }
25 | }
26 | })
--------------------------------------------------------------------------------
/decode.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "decode": "./decode",
5 | "audio-player":"./audio-player/audio-player",
6 | "latex":"./latex/latex",
7 | "yuml":"./yuml/yuml",
8 | "table":"./table/table",
9 | "echarts":"./echarts/echarts",
10 | "todogroup":"./todogroup/todogroup",
11 | "img":"./img/img"
12 | }
13 | }
--------------------------------------------------------------------------------
/decode.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sbfkcel/towxml/e60c14247f5035acb808d6196a56bb13d5811df8/decode.wxss
--------------------------------------------------------------------------------
/dist/audio-player/audio-player.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | }
5 | }
--------------------------------------------------------------------------------
/dist/audio-player/audio-player.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{tips.text || 'Error'}}
9 |
10 | {{data.attrs.name}}
11 | {{data.attrs.author}}
12 | {{time.currentTime || '00:00:00'}} / {{time.duration || '00:00:00'}}
13 |
14 |
--------------------------------------------------------------------------------
/dist/decode.js:
--------------------------------------------------------------------------------
1 | const config = require('./config');
2 |
3 | Component({
4 | options: {
5 | styleIsolation: 'apply-shared'
6 | },
7 | properties: {
8 | nodes: {
9 | type: Object,
10 | value: {}
11 | }
12 | },
13 | lifetimes: {
14 | attached: function () {
15 | const _ts = this;
16 |
17 | config.events.forEach(item => {
18 | _ts['_' + item] = function (...arg) {
19 | if (global._events && typeof global._events[item] === 'function') {
20 | global._events[item](...arg);
21 | }
22 | };
23 | });
24 | }
25 | }
26 | })
--------------------------------------------------------------------------------
/dist/decode.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "decode": "/towxml/decode",
5 | "audio-player": "/towxml/audio-player/audio-player",
6 | "latex": "/towxml/latex/latex",
7 | "table": "/towxml/table/table",
8 | "todogroup": "/towxml/todogroup/todogroup",
9 | "yuml": "/towxml/yuml/yuml",
10 | "img": "/towxml/img/img"
11 | }
12 | }
--------------------------------------------------------------------------------
/dist/decode.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sbfkcel/towxml/e60c14247f5035acb808d6196a56bb13d5811df8/dist/decode.wxss
--------------------------------------------------------------------------------
/dist/img/img.js:
--------------------------------------------------------------------------------
1 | const config = require('../config');
2 | Component({
3 | options: {
4 | styleIsolation: 'shared'
5 | },
6 | properties: {
7 | data: {
8 | type: Object,
9 | value: {}
10 | }
11 | },
12 | data: {
13 | attr:{
14 | src:'',
15 | class:'',
16 | style:''
17 | },
18 | size:{
19 | w:0,
20 | h:0
21 | },
22 | styleObj:{}
23 | },
24 | lifetimes:{
25 | attached:function(){
26 | const _ts = this;
27 | let dataAttr = this.data.data.attrs;
28 |
29 | // 将图片大小处理到对象中
30 | if(dataAttr.width){
31 | _ts.data.size.w = +dataAttr.width / config.dpr;
32 | };
33 |
34 | if(dataAttr.height){
35 | _ts.data.size.h = +dataAttr.height / config.dpr;
36 | };
37 |
38 | // 将样式合并到样式对象中
39 | if(dataAttr.style){
40 | let re = /;\s{0,}/ig;
41 | dataAttr.style = dataAttr.style.replace(re,';');
42 | dataAttr.style.split(';').forEach(item => {
43 | let itemArr = item.split(':');
44 | if(/^(width|height)$/i.test(itemArr[0])){
45 | let num = parseInt(itemArr[1]) || 0,
46 | key = '';
47 | // itemArr[1] = num / config.dpr + itemArr[1].replace(num,'');
48 | switch (itemArr[0].toLocaleLowerCase()) {
49 | case 'width':
50 | key = 'w';
51 | break;
52 | case 'height':
53 | key = 'h';
54 | break;
55 | };
56 | _ts.data.size[key] = num / config.dpr;
57 | }else{
58 | _ts.data.styleObj[itemArr[0]] = itemArr[1];
59 | };
60 | });
61 | };
62 |
63 | // 设置公式图片
64 | _ts.setData({
65 | attrs:{
66 | src:dataAttr.src,
67 | class:dataAttr.class,
68 | style:_ts.setStyle(_ts.data.styleObj)
69 | },
70 | size:_ts.data.size
71 | });
72 | }
73 | },
74 | methods: {
75 | // 设置图片样式
76 | setStyle:function(o){
77 | let str = ``;
78 | for(let key in o){
79 | str += `${key}:${o[key]};`;
80 | };
81 | return str;
82 | },
83 |
84 | // 图片加载完成设置图片大小
85 | load:function(e){
86 | const _ts = this;
87 |
88 | if(!_ts.data.size.w || !_ts.data.size.h){
89 | _ts.setData({
90 | size:{
91 | w:e.detail.width / config.dpr,
92 | h:e.detail.height / config.dpr
93 | }
94 | });
95 | };
96 | }
97 | }
98 | })
--------------------------------------------------------------------------------
/dist/img/img.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/dist/img/img.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/img/img.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sbfkcel/towxml/e60c14247f5035acb808d6196a56bb13d5811df8/dist/img/img.wxss
--------------------------------------------------------------------------------
/dist/index.js:
--------------------------------------------------------------------------------
1 | const md = require('./parse/markdown/index'),
2 | parse = require('./parse/index')
3 |
4 | module.exports = (str,type,option)=>{
5 | option = option || {};
6 | let result;
7 | switch (type) {
8 | case 'markdown':
9 | result = parse(md(str),option);
10 | break;
11 | case 'html':
12 | result = parse(str,option);
13 | break;
14 | default:
15 | throw new Error('Invalid type, only markdown and html are supported');
16 | break;
17 | };
18 | return result;
19 | };
20 |
--------------------------------------------------------------------------------
/dist/latex/latex.js:
--------------------------------------------------------------------------------
1 | const config = require('../config');
2 | Component({
3 | options: {
4 | styleIsolation: 'shared'
5 | },
6 | properties: {
7 | data: {
8 | type: Object,
9 | value: {}
10 | }
11 | },
12 | data: {
13 | attr:{
14 | src:'',
15 | class:''
16 | },
17 | size:{
18 | w:0,
19 | h:0
20 | }
21 | },
22 | lifetimes:{
23 | attached:function(){
24 | const _ts = this;
25 | let dataAttr = this.data.data.attrs;
26 |
27 | // 设置公式图片
28 | _ts.setData({
29 | attrs:{
30 | src:`${config.latex.api}=${dataAttr.value}&theme=${global._theme}`,
31 | class:`${dataAttr.class} ${dataAttr.class}--${dataAttr.type}`
32 | }
33 | });
34 | }
35 | },
36 | methods: {
37 | load:function(e){
38 | const _ts = this;
39 |
40 | // 公式图片加载完成则根据其图片大小、类型计算其显示的合适大小
41 | let scale = 20,
42 | w = e.detail.width / scale,
43 | h = e.detail.height /scale;
44 |
45 | _ts.setData({
46 | size:{
47 | w:w,
48 | h:h
49 | }
50 | });
51 | }
52 | }
53 | })
--------------------------------------------------------------------------------
/dist/latex/latex.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | }
5 | }
--------------------------------------------------------------------------------
/dist/latex/latex.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/latex/latex.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sbfkcel/towxml/e60c14247f5035acb808d6196a56bb13d5811df8/dist/latex/latex.wxss
--------------------------------------------------------------------------------
/dist/parse/highlight/index.js:
--------------------------------------------------------------------------------
1 | const config = require('../../config'),
2 | hljs = require('./highlight');
3 | // config.highlight.forEach(item => {
4 | // hljs.registerLanguage(item, require(`./languages/${item}`).default);
5 | // });
6 | hljs.registerLanguage('c-like', require('./languages/c-like').default);hljs.registerLanguage('c', require('./languages/c').default);hljs.registerLanguage('bash', require('./languages/bash').default);hljs.registerLanguage('css', require('./languages/css').default);hljs.registerLanguage('dart', require('./languages/dart').default);hljs.registerLanguage('go', require('./languages/go').default);hljs.registerLanguage('java', require('./languages/java').default);hljs.registerLanguage('javascript', require('./languages/javascript').default);hljs.registerLanguage('json', require('./languages/json').default);hljs.registerLanguage('less', require('./languages/less').default);hljs.registerLanguage('scss', require('./languages/scss').default);hljs.registerLanguage('shell', require('./languages/shell').default);hljs.registerLanguage('xml', require('./languages/xml').default);hljs.registerLanguage('htmlbars', require('./languages/htmlbars').default);hljs.registerLanguage('nginx', require('./languages/nginx').default);hljs.registerLanguage('php', require('./languages/php').default);hljs.registerLanguage('python', require('./languages/python').default);hljs.registerLanguage('python-repl', require('./languages/python-repl').default);hljs.registerLanguage('typescript', require('./languages/typescript').default);
7 |
8 | module.exports = hljs;
--------------------------------------------------------------------------------
/dist/parse/highlight/languages/c.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: C
3 | Category: common, system
4 | Website: https://en.wikipedia.org/wiki/C_(programming_language)
5 | Requires: c-like.js
6 | */
7 |
8 | export default function(hljs) {
9 |
10 | var lang = hljs.getLanguage('c-like').rawDefinition();
11 | // Until C is actually different than C++ there is no reason to auto-detect C
12 | // as it's own language since it would just fail auto-detect testing or
13 | // simply match with C++.
14 | //
15 | // See further comments in c-like.js.
16 |
17 | // lang.disableAutodetect = false;
18 | lang.name = 'C';
19 | lang.aliases = ['c', 'h'];
20 | return lang;
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/dist/parse/highlight/languages/go.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Go
3 | Author: Stephan Kountso aka StepLg
4 | Contributors: Evgeny Stepanischev
5 | Description: Google go language (golang). For info about language
6 | Website: http://golang.org/
7 | Category: common, system
8 | */
9 |
10 | export default function(hljs) {
11 | var GO_KEYWORDS = {
12 | keyword:
13 | 'break default func interface select case map struct chan else goto package switch ' +
14 | 'const fallthrough if range type continue for import return var go defer ' +
15 | 'bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 ' +
16 | 'uint16 uint32 uint64 int uint uintptr rune',
17 | literal:
18 | 'true false iota nil',
19 | built_in:
20 | 'append cap close complex copy imag len make new panic print println real recover delete'
21 | };
22 | return {
23 | name: 'Go',
24 | aliases: ['golang'],
25 | keywords: GO_KEYWORDS,
26 | illegal: '',
27 | contains: [
28 | hljs.C_LINE_COMMENT_MODE,
29 | hljs.C_BLOCK_COMMENT_MODE,
30 | {
31 | className: 'string',
32 | variants: [
33 | hljs.QUOTE_STRING_MODE,
34 | hljs.APOS_STRING_MODE,
35 | {begin: '`', end: '`'},
36 | ]
37 | },
38 | {
39 | className: 'number',
40 | variants: [
41 | {begin: hljs.C_NUMBER_RE + '[i]', relevance: 1},
42 | hljs.C_NUMBER_MODE
43 | ]
44 | },
45 | {
46 | begin: /:=/ // relevance booster
47 | },
48 | {
49 | className: 'function',
50 | beginKeywords: 'func', end: '\\s*(\\{|$)', excludeEnd: true,
51 | contains: [
52 | hljs.TITLE_MODE,
53 | {
54 | className: 'params',
55 | begin: /\(/, end: /\)/,
56 | keywords: GO_KEYWORDS,
57 | illegal: /["']/
58 | }
59 | ]
60 | }
61 | ]
62 | };
63 | }
64 |
--------------------------------------------------------------------------------
/dist/parse/highlight/languages/htmlbars.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: HTMLBars
3 | Requires: xml.js
4 | Author: Michael Johnston
5 | Description: Matcher for HTMLBars
6 | Website: https://github.com/tildeio/htmlbars
7 | Category: template
8 | */
9 |
10 | export default function(hljs) {
11 | var BUILT_INS = 'action collection component concat debugger each each-in else get hash if input link-to loc log mut outlet partial query-params render textarea unbound unless with yield view';
12 |
13 | var ATTR_ASSIGNMENT = {
14 | illegal: /\}\}/,
15 | begin: /[a-zA-Z0-9_]+=/,
16 | returnBegin: true,
17 | relevance: 0,
18 | contains: [
19 | {
20 | className: 'attr', begin: /[a-zA-Z0-9_]+/
21 | }
22 | ]
23 | };
24 |
25 | var SUB_EXPR = {
26 | illegal: /\}\}/,
27 | begin: /\)/, end: /\)/,
28 | contains: [
29 | {
30 | begin: /[a-zA-Z\.\-]+/,
31 | keywords: {built_in: BUILT_INS},
32 | starts: {
33 | endsWithParent: true, relevance: 0,
34 | contains: [
35 | hljs.QUOTE_STRING_MODE,
36 | ]
37 | }
38 | }
39 | ]
40 | };
41 |
42 | var TAG_INNARDS = {
43 | endsWithParent: true, relevance: 0,
44 | keywords: {keyword: 'as', built_in: BUILT_INS},
45 | contains: [
46 | hljs.QUOTE_STRING_MODE,
47 | ATTR_ASSIGNMENT,
48 | hljs.NUMBER_MODE
49 | ]
50 | };
51 |
52 | return {
53 | name: 'HTMLBars',
54 | case_insensitive: true,
55 | subLanguage: 'xml',
56 | contains: [
57 | hljs.COMMENT('{{!(--)?', '(--)?}}'),
58 | {
59 | className: 'template-tag',
60 | begin: /\{\{[#\/]/, end: /\}\}/,
61 | contains: [
62 | {
63 | className: 'name',
64 | begin: /[a-zA-Z\.\-]+/,
65 | keywords: {'builtin-name': BUILT_INS},
66 | starts: TAG_INNARDS
67 | }
68 | ]
69 | },
70 | {
71 | className: 'template-variable',
72 | begin: /\{\{[a-zA-Z][a-zA-Z\-]+/, end: /\}\}/,
73 | keywords: {keyword: 'as', built_in: BUILT_INS},
74 | contains: [
75 | hljs.QUOTE_STRING_MODE
76 | ]
77 | }
78 | ]
79 | };
80 | }
81 |
--------------------------------------------------------------------------------
/dist/parse/highlight/languages/json.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: JSON
3 | Description: JSON (JavaScript Object Notation) is a lightweight data-interchange format.
4 | Author: Ivan Sagalaev
5 | Website: http://www.json.org
6 | Category: common, protocols
7 | */
8 |
9 | export default function(hljs) {
10 | var LITERALS = {literal: 'true false null'};
11 | var ALLOWED_COMMENTS = [
12 | hljs.C_LINE_COMMENT_MODE,
13 | hljs.C_BLOCK_COMMENT_MODE
14 | ]
15 | var TYPES = [
16 | hljs.QUOTE_STRING_MODE,
17 | hljs.C_NUMBER_MODE
18 | ];
19 | var VALUE_CONTAINER = {
20 | end: ',', endsWithParent: true, excludeEnd: true,
21 | contains: TYPES,
22 | keywords: LITERALS
23 | };
24 | var OBJECT = {
25 | begin: '{', end: '}',
26 | contains: [
27 | {
28 | className: 'attr',
29 | begin: /"/, end: /"/,
30 | contains: [hljs.BACKSLASH_ESCAPE],
31 | illegal: '\\n',
32 | },
33 | hljs.inherit(VALUE_CONTAINER, {begin: /:/})
34 | ].concat(ALLOWED_COMMENTS),
35 | illegal: '\\S'
36 | };
37 | var ARRAY = {
38 | begin: '\\[', end: '\\]',
39 | contains: [hljs.inherit(VALUE_CONTAINER)], // inherit is a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents
40 | illegal: '\\S'
41 | };
42 | TYPES.push(OBJECT, ARRAY);
43 | ALLOWED_COMMENTS.forEach(function(rule) {
44 | TYPES.push(rule)
45 | })
46 | return {
47 | name: 'JSON',
48 | contains: TYPES,
49 | keywords: LITERALS,
50 | illegal: '\\S'
51 | };
52 | }
53 |
--------------------------------------------------------------------------------
/dist/parse/highlight/languages/python-repl.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Python REPL
3 | Requires: python.js
4 | Author: Josh Goebel
5 | Category: common
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | aliases: ['pycon'],
11 | contains: [
12 | {
13 | className: 'meta',
14 | starts: {
15 | // a space separates the REPL prefix from the actual code
16 | // this is purely for cleaner HTML output
17 | end: / |$/,
18 | starts: {
19 | end: '$', subLanguage: 'python'
20 | }
21 | },
22 | variants: [
23 | { begin: /^>>>(?=[ ]|$)/ },
24 | { begin: /^\.\.\.(?=[ ]|$)/ }
25 | ]
26 | },
27 | ]
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/dist/parse/highlight/languages/shell.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Shell Session
3 | Requires: bash.js
4 | Author: TSUYUSATO Kitsune
5 | Category: common
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Shell Session',
11 | aliases: ['console'],
12 | contains: [
13 | {
14 | className: 'meta',
15 | begin: '^\\s{0,3}[/\\w\\d\\[\\]()@-]*[>%$#]',
16 | starts: {
17 | end: '$', subLanguage: 'bash'
18 | }
19 | }
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/dist/parse/highlight/style/github.wxss:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | github.com style (c) Vasily Polovnyov
4 |
5 | */
6 |
7 | .h2w-light .hljs {
8 | display: block;
9 | overflow-x: auto;
10 | padding: 0.5em;
11 | color: #333;
12 | background: #f8f8f8;
13 | }
14 |
15 | .h2w-light .hljs-comment,
16 | .h2w-light .hljs-quote {
17 | color: #998;
18 | font-style: italic;
19 | }
20 |
21 | .h2w-light .hljs-keyword,
22 | .h2w-light .hljs-selector-tag,
23 | .h2w-light .hljs-subst {
24 | color: #333;
25 | font-weight: bold;
26 | }
27 |
28 | .h2w-light .hljs-number,
29 | .h2w-light .hljs-literal,
30 | .h2w-light .hljs-variable,
31 | .h2w-light .hljs-template-variable,
32 | .h2w-light .hljs-tag .hljs-attr {
33 | color: #008080;
34 | }
35 |
36 | .h2w-light .hljs-string,
37 | .h2w-light .hljs-doctag {
38 | color: #d14;
39 | }
40 |
41 | .h2w-light .hljs-title,
42 | .h2w-light .hljs-section,
43 | .h2w-light .hljs-selector-id {
44 | color: #900;
45 | font-weight: bold;
46 | }
47 |
48 | .h2w-light .hljs-subst {
49 | font-weight: normal;
50 | }
51 |
52 | .h2w-light .hljs-type,
53 | .h2w-light .hljs-class .hljs-title {
54 | color: #458;
55 | font-weight: bold;
56 | }
57 |
58 | .h2w-light .hljs-tag,
59 | .h2w-light .hljs-name,
60 | .h2w-light .hljs-attribute {
61 | color: #000080;
62 | font-weight: normal;
63 | }
64 |
65 | .h2w-light .hljs-regexp,
66 | .h2w-light .hljs-link {
67 | color: #009926;
68 | }
69 |
70 | .h2w-light .hljs-symbol,
71 | .h2w-light .hljs-bullet {
72 | color: #990073;
73 | }
74 |
75 | .h2w-light .hljs-built_in,
76 | .h2w-light .hljs-builtin-name {
77 | color: #0086b3;
78 | }
79 |
80 | .h2w-light .hljs-meta {
81 | color: #999;
82 | font-weight: bold;
83 | }
84 |
85 | .h2w-light .hljs-deletion {
86 | background: #fdd;
87 | }
88 |
89 | .h2w-light .hljs-addition {
90 | background: #dfd;
91 | }
92 |
93 | .h2w-light .hljs-emphasis {
94 | font-style: italic;
95 | }
96 |
97 | .h2w-light .hljs-strong {
98 | font-weight: bold;
99 | }
100 |
--------------------------------------------------------------------------------
/dist/parse/highlight/style/monokai.wxss:
--------------------------------------------------------------------------------
1 | /*
2 | Monokai style - ported by Luigi Maselli - http://grigio.org
3 | */
4 |
5 | .h2w-dark .hljs {
6 | display: block;
7 | overflow-x: auto;
8 | padding: 0.5em;
9 | background: #272822; color: #ddd;
10 | }
11 |
12 | .h2w-dark .hljs-tag,
13 | .h2w-dark .hljs-keyword,
14 | .h2w-dark .hljs-selector-tag,
15 | .h2w-dark .hljs-literal,
16 | .h2w-dark .hljs-strong,
17 | .h2w-dark .hljs-name {
18 | color: #f92672;
19 | }
20 |
21 | .h2w-dark .hljs-code {
22 | color: #66d9ef;
23 | }
24 |
25 | .h2w-dark .hljs-class .hljs-title {
26 | color: white;
27 | }
28 |
29 | .h2w-dark .hljs-attribute,
30 | .h2w-dark .hljs-symbol,
31 | .h2w-dark .hljs-regexp,
32 | .h2w-dark .hljs-link {
33 | color: #bf79db;
34 | }
35 |
36 | .h2w-dark .hljs-string,
37 | .h2w-dark .hljs-bullet,
38 | .h2w-dark .hljs-subst,
39 | .h2w-dark .hljs-title,
40 | .h2w-dark .hljs-section,
41 | .h2w-dark .hljs-emphasis,
42 | .h2w-dark .hljs-type,
43 | .h2w-dark .hljs-built_in,
44 | .h2w-dark .hljs-builtin-name,
45 | .h2w-dark .hljs-selector-attr,
46 | .h2w-dark .hljs-selector-pseudo,
47 | .h2w-dark .hljs-addition,
48 | .h2w-dark .hljs-variable,
49 | .h2w-dark .hljs-template-tag,
50 | .h2w-dark .hljs-template-variable {
51 | color: #a6e22e;
52 | }
53 |
54 | .h2w-dark .hljs-comment,
55 | .h2w-dark .hljs-quote,
56 | .h2w-dark .hljs-deletion,
57 | .h2w-dark .hljs-meta {
58 | color: #75715e;
59 | }
60 |
61 | .h2w-dark .hljs-keyword,
62 | .h2w-dark .hljs-selector-tag,
63 | .h2w-dark .hljs-literal,
64 | .h2w-dark .hljs-doctag,
65 | .h2w-dark .hljs-title,
66 | .h2w-dark .hljs-section,
67 | .h2w-dark .hljs-type,
68 | .h2w-dark .hljs-selector-id {
69 | font-weight: bold;
70 | }
71 |
--------------------------------------------------------------------------------
/dist/parse/markdown/plugins/ins.js:
--------------------------------------------------------------------------------
1 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.markdownitIns=e()}}(function(){return function e(n,t,o){function r(s,f){if(!t[s]){if(!n[s]){var u="function"==typeof require&&require;if(!f&&u)return u(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var p=t[s]={exports:{}};n[s][0].call(p.exports,function(e){var t=n[s][1][e];return r(t?t:e)},p,p.exports,e,n,t,o)}return t[s].exports}for(var i="function"==typeof require&&require,s=0;si)return!1;for(i%2&&(r=e.push("text","",0),r.content=s,i--),t=0;i>t;t+=2)r=e.push("text","",0),r.content=s+s,e.delimiters.push({marker:u,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function t(e){var n,t,o,r,i,s=[],f=e.delimiters,u=e.delimiters.length;for(n=0;u>n;n++)o=f[n],43===o.marker&&-1!==o.end&&(r=f[o.end],i=e.tokens[o.token],i.type="ins_open",i.tag="ins",i.nesting=1,i.markup="++",i.content="",i=e.tokens[r.token],i.type="ins_close",i.tag="ins",i.nesting=-1,i.markup="++",i.content="","text"===e.tokens[r.token-1].type&&"+"===e.tokens[r.token-1].content&&s.push(r.token-1));for(;s.length;){for(n=s.pop(),t=n+1;ti)return!1;for(i%2&&(r=e.push("text","",0),r.content=s,i--),t=0;i>t;t+=2)r=e.push("text","",0),r.content=s+s,e.delimiters.push({marker:u,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function t(e){var n,t,o,r,i,s=[],f=e.delimiters,u=e.delimiters.length;for(n=0;u>n;n++)o=f[n],61===o.marker&&-1!==o.end&&(r=f[o.end],i=e.tokens[o.token],i.type="mark_open",i.tag="mark",i.nesting=1,i.markup="==",i.content="",i=e.tokens[r.token],i.type="mark_close",i.tag="mark",i.nesting=-1,i.markup="==",i.content="","text"===e.tokens[r.token-1].type&&"="===e.tokens[r.token-1].content&&s.push(r.token-1));for(;s.length;){for(n=s.pop(),t=n+1;t=i)return!1;for(e.pos=u+1;e.pos?@[\]^_`{|}~-])/g;r.exports=function(e){e.inline.ruler.after("emphasis","sub",o)}},{}]},{},[1])(1)});
--------------------------------------------------------------------------------
/dist/parse/markdown/plugins/sup.js:
--------------------------------------------------------------------------------
1 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.markdownitSup=e()}}(function(){return function e(r,o,n){function t(i,p){if(!o[i]){if(!r[i]){var u="function"==typeof require&&require;if(!p&&u)return u(i,!0);if(s)return s(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var a=o[i]={exports:{}};r[i][0].call(a.exports,function(e){var o=r[i][1][e];return t(o?o:e)},a,a.exports,e,r,o,n)}return o[i].exports}for(var s="function"==typeof require&&require,i=0;i=i)return!1;for(e.pos=p+1;e.pos?@[\]^_`{|}~-])/g;r.exports=function(e){e.inline.ruler.after("emphasis","sup",o)}},{}]},{},[1])(1)});
--------------------------------------------------------------------------------
/dist/parse/markdown/plugins/yuml.js:
--------------------------------------------------------------------------------
1 | const config = require('../../../config');
2 | const mermaidChart = (code) => {
3 | return ``;
4 | }
5 |
6 | module.exports = md => {
7 | const temp = md.renderer.rules.fence.bind(md.renderer.rules)
8 | md.renderer.rules.fence = (tokens, idx, options, env, slf) => {
9 | const token = tokens[idx]
10 | const code = token.content.trim();
11 | if (token.info === 'yuml') {
12 | return mermaidChart(code)
13 | };
14 | // const firstLine = code.split(/\n/)[0].trim()
15 | // if (firstLine === 'gantt' || firstLine === 'sequenceDiagram' || firstLine.match(/^graph (?:TB|BT|RL|LR|TD);?$/)) {
16 | // return mermaidChart(code)
17 | // }
18 | return temp(tokens, idx, options, env, slf)
19 | }
20 | };
--------------------------------------------------------------------------------
/dist/parse/parse2/entities/decode.js:
--------------------------------------------------------------------------------
1 | /*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2 | "use strict";function getStrictDecoder(e){var t=Object.keys(e).join("|"),r=getReplacer(e);t+="|#[xX][\\da-fA-F]+|#\\d+";var o=new RegExp("&(?:"+t+");","g");return function(e){return String(e).replace(o,r)}}function getReplacer(e){return function(t){return"#"===t.charAt(1)?"X"===t.charAt(2)||"x"===t.charAt(2)?decode_codepoint_1["default"](parseInt(t.substr(3),16)):decode_codepoint_1["default"](parseInt(t.substr(2),10)):e[t.slice(1,-1)]}}var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var entities_json_1=__importDefault(require("./maps/entities.json")),legacy_json_1=__importDefault(require("./maps/legacy.json")),xml_json_1=__importDefault(require("./maps/xml.json")),decode_codepoint_1=__importDefault(require("./decode_codepoint"));exports.decodeXML=getStrictDecoder(xml_json_1["default"]),exports.decodeHTMLStrict=getStrictDecoder(entities_json_1["default"]);var sorter=function(e,t){return e=55296&&e<=57343||e>1114111)return"�";e in decode_json_1["default"]&&(e=decode_json_1["default"][e]);var o="";return e>65535&&(e-=65536,o+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),o+=String.fromCharCode(e)}var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var decode_json_1=__importDefault(require("./maps/decode"));exports["default"]=decodeCodePoint;
--------------------------------------------------------------------------------
/dist/parse/parse2/entities/encode.js:
--------------------------------------------------------------------------------
1 | /*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2 | "use strict";function getInverseObj(e){return Object.keys(e).sort().reduce(function(r,t){return r[e[t]]="&"+t+";",r},{})}function getInverseReplacer(e){var r=[],t=[];return Object.keys(e).forEach(function(e){return 1===e.length?r.push("\\"+e):t.push(e)}),t.unshift("["+r.join("")+"]"),new RegExp(t.join("|"),"g")}function singleCharReplacer(e){return""+e.charCodeAt(0).toString(16).toUpperCase()+";"}function astralReplacer(e,r){return""+(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536).toString(16).toUpperCase()+";"}function getInverse(e,r){return function(t){return t.replace(r,function(r){return e[r]}).replace(reAstralSymbols,astralReplacer).replace(reNonASCII,singleCharReplacer)}}function escape(e){return e.replace(reXmlChars,singleCharReplacer).replace(reAstralSymbols,astralReplacer).replace(reNonASCII,singleCharReplacer)}var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var xml_json_1=__importDefault(require("./maps/xml.json")),inverseXML=getInverseObj(xml_json_1["default"]),xmlReplacer=getInverseReplacer(inverseXML);exports.encodeXML=getInverse(inverseXML,xmlReplacer);var entities_json_1=__importDefault(require("./maps/entities.json")),inverseHTML=getInverseObj(entities_json_1["default"]),htmlReplacer=getInverseReplacer(inverseHTML);exports.encodeHTML=getInverse(inverseHTML,htmlReplacer);var reNonASCII=/[^\0-\x7F]/g,reAstralSymbols=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,reXmlChars=getInverseReplacer(inverseXML);exports.escape=escape;
--------------------------------------------------------------------------------
/dist/parse/parse2/entities/index.js:
--------------------------------------------------------------------------------
1 | /*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2 | "use strict";function decode(e,d){return(!d||d<=0?decode_1.decodeXML:decode_1.decodeHTML)(e)}function decodeStrict(e,d){return(!d||d<=0?decode_1.decodeXML:decode_1.decodeHTMLStrict)(e)}function encode(e,d){return(!d||d<=0?encode_1.encodeXML:encode_1.encodeHTML)(e)}Object.defineProperty(exports,"__esModule",{value:!0});var decode_1=require("./decode"),encode_1=require("./encode");exports.decode=decode,exports.decodeStrict=decodeStrict,exports.encode=encode;var encode_2=require("./encode");exports.encodeXML=encode_2.encodeXML,exports.encodeHTML=encode_2.encodeHTML,exports.escape=encode_2.escape,exports.encodeHTML4=encode_2.encodeHTML,exports.encodeHTML5=encode_2.encodeHTML;var decode_2=require("./decode");exports.decodeXML=decode_2.decodeXML,exports.decodeHTML=decode_2.decodeHTML,exports.decodeHTMLStrict=decode_2.decodeHTMLStrict,exports.decodeHTML4=decode_2.decodeHTML,exports.decodeHTML5=decode_2.decodeHTML,exports.decodeHTML4Strict=decode_2.decodeHTMLStrict,exports.decodeHTML5Strict=decode_2.decodeHTMLStrict,exports.decodeXMLStrict=decode_2.decodeXML;
--------------------------------------------------------------------------------
/dist/parse/parse2/entities/maps/decode.js:
--------------------------------------------------------------------------------
1 | /*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2 | module.exports={0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376};
--------------------------------------------------------------------------------
/dist/parse/parse2/entities/maps/legacy.js:
--------------------------------------------------------------------------------
1 | /*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2 | module.exports={Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",acute:"´",AElig:"Æ",aelig:"æ",Agrave:"À",agrave:"à",amp:"&",AMP:"&",Aring:"Å",aring:"å",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",brvbar:"¦",Ccedil:"Ç",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Egrave:"È",egrave:"è",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",iexcl:"¡",Igrave:"Ì",igrave:"ì",iquest:"¿",Iuml:"Ï",iuml:"ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",Ntilde:"Ñ",ntilde:"ñ",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Ograve:"Ò",ograve:"ò",ordf:"ª",ordm:"º",Oslash:"Ø",oslash:"ø",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",THORN:"Þ",thorn:"þ",times:"×",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Ugrave:"Ù",ugrave:"ù",uml:"¨",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",yen:"¥",yuml:"ÿ"};
--------------------------------------------------------------------------------
/dist/parse/parse2/entities/maps/xml.js:
--------------------------------------------------------------------------------
1 | /*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2 | module.exports={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};
--------------------------------------------------------------------------------
/dist/parse/parse2/index.js:
--------------------------------------------------------------------------------
1 | /*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2 | function parseDOM(r,e){var a=new domhandler_1.DomHandler(void 0,e);return new Parser_1.Parser(a,e).end(r),a.dom}var domhandler_1=require("./domhandler/index"),Parser_1=require("./Parser");module.exports=parseDOM;
--------------------------------------------------------------------------------
/dist/style/theme/dark.wxss:
--------------------------------------------------------------------------------
1 | /*正文样式*/
2 | .h2w-dark {
3 | color:#ddd;
4 | background-color:#000;
5 | }
6 |
7 | /**标题**/
8 | .h2w-dark .h2w__h1,
9 | .h2w-dark .h2w__h2 {
10 | border-color:#3d3d3d;
11 | }
12 |
13 |
14 | /**表格**/
15 | .h2w-dark .h2w__thead .h2w__tr {
16 | background-color:#1f1f1f;
17 | }
18 | .h2w-dark .h2w__table .h2w__tr:nth-child(2n){
19 | background-color:#090909;
20 | }
21 | .h2w-dark .h2w__th,
22 | .h2w-dark .h2w__td {
23 | border-color:#333;
24 | }
25 |
26 |
27 | /**代码块**/
28 | .h2w-dark .h2w__pre,
29 | .h2w-dark .h2w__pre .h2w__code {
30 | background-color:#1b1b1b;
31 | border-color:#262626;
32 | }
33 |
34 | .h2w-dark .h2w__code {
35 | background-color:#272822;
36 | border-color:#1b1c18;
37 | }
38 |
39 |
40 | /**块元素**/
41 | .h2w-dark .h2w__blockquote {
42 | border-left-color:#10230f;
43 | }
44 |
45 | /**内连元素**/
46 | .h2w-dark .h2w__a {
47 | color:#1aad16; border-color:#4d804b;
48 | }
49 |
50 | .h2w-dark .h2w__hr {
51 | background-color:#242424;
52 | }
53 |
54 | .h2w-dark .h2w__mark {
55 | background:yellow;
56 | color:black;
57 | }
58 |
59 | .h2w-dark .h2w__todoCheckbox .wx-checkbox-input {
60 | background:#2e2e2e; border-color:#494949;
61 | }
62 | .h2w-dark .h2w__todoCheckbox .wx-checkbox-input.wx-checkbox-input-checked {
63 | background:green; border-color:#4d804b;
64 | }
65 | .h2w-dark .h2w__todoCheckbox .wx-checkbox-input.wx-checkbox-input-checked::before {
66 | color:white;
67 | }
68 | .h2w-dark .h2w__lineNum {
69 | color:#494949;
70 | }
71 |
72 | /**代码高亮样式**/
73 | @import '../../parse/highlight/style/monokai.wxss';
74 |
--------------------------------------------------------------------------------
/dist/style/theme/light.wxss:
--------------------------------------------------------------------------------
1 | /*正文样式*/
2 | .h2w-light {
3 | color:#333;
4 | background-color:white;
5 | }
6 |
7 | /**标题**/
8 | .h2w-light .h2w__h1,
9 | .h2w-light .h2w__h2 {
10 | border-color:#eee;
11 | }
12 |
13 |
14 | /**表格**/
15 | .h2w-light .h2w__thead .h2w__tr {
16 | background-color:#f6f8fa;
17 | }
18 | .h2w-light .h2w__table .h2w__tr:nth-child(2n){
19 | background-color:#fbfcfd;
20 | }
21 | .h2w-light .h2w__th,
22 | .h2w-light .h2w__td {
23 | border-color:#dfe2e5;
24 | }
25 |
26 |
27 | /**代码块**/
28 | .h2w-light .h2w__pre {
29 | background-color:#f6f8fa;
30 | border-color:#eaedf0;
31 | }
32 |
33 | .h2w-light .h2w__code {
34 | background-color:#f6f8fa;
35 | border-color:#eaedf0;
36 | }
37 |
38 |
39 | /**块元素**/
40 | .h2w-light .h2w__blockquote {
41 | border-left-color:#dfe2e5;
42 | }
43 |
44 | /**内连元素**/
45 | .h2w-light .h2w__a {
46 | color:#1aad16; border-color:#b9d9b8;
47 | }
48 |
49 | .h2w-light .h2w__hr {
50 | background-color:#eee;
51 | }
52 |
53 | .h2w-light .h2w__mark {
54 | background:yellow;
55 | color:black;
56 | }
57 |
58 | .h2w-light .h2w__lineNum {
59 | color:#ccc;
60 | }
61 |
62 | /**代码高亮样式**/
63 | @import '../../parse/highlight/style/github.wxss';
--------------------------------------------------------------------------------
/dist/table/table.js:
--------------------------------------------------------------------------------
1 | Component({
2 | options: {
3 | styleIsolation: 'shared'
4 | },
5 | properties: {
6 | data: {
7 | type: Object,
8 | value: {}
9 | }
10 | }
11 | })
--------------------------------------------------------------------------------
/dist/table/table.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "decode": "../decode"
5 | }
6 | }
--------------------------------------------------------------------------------
/dist/table/table.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/dist/table/table.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sbfkcel/towxml/e60c14247f5035acb808d6196a56bb13d5811df8/dist/table/table.wxss
--------------------------------------------------------------------------------
/dist/todogroup/todogroup.js:
--------------------------------------------------------------------------------
1 | Component({
2 | options: {
3 | styleIsolation: 'shared'
4 | },
5 | properties: {
6 | data: {
7 | type: Object,
8 | value: {}
9 | }
10 | },
11 | data: {
12 | },
13 | methods: {
14 | _change:function(...arg){
15 | if(global._events && typeof global._events.change === 'function'){
16 | global._events.change(...arg);
17 | }
18 | }
19 | }
20 | })
--------------------------------------------------------------------------------
/dist/todogroup/todogroup.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "decode": "../decode"
5 | }
6 | }
--------------------------------------------------------------------------------
/dist/todogroup/todogroup.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
--------------------------------------------------------------------------------
/dist/todogroup/todogroup.wxss:
--------------------------------------------------------------------------------
1 | .h2w__todolist {
2 | display:block;
3 | }
--------------------------------------------------------------------------------
/dist/towxml.js:
--------------------------------------------------------------------------------
1 | Component({
2 | options:{
3 | styleIsolation:'shared'
4 | },
5 | properties:{
6 | nodes:{
7 | type:Object,
8 | value:{}
9 | }
10 | },
11 | data:{
12 | someData:{
13 |
14 | }
15 | }
16 | })
--------------------------------------------------------------------------------
/dist/towxml.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "decode": "./decode"
5 | }
6 | }
--------------------------------------------------------------------------------
/dist/towxml.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/dist/towxml.wxss:
--------------------------------------------------------------------------------
1 | /**基础风格样式**/
2 | @import './style/main.wxss';
3 |
4 | /**主题配色(浅色样式)**/
5 | @import './style/theme/light.wxss';
6 |
7 | /**主题配色(深色样式)**/
8 | @import './style/theme/dark.wxss';
--------------------------------------------------------------------------------
/dist/yuml/yuml.js:
--------------------------------------------------------------------------------
1 | const config = require('../config');
2 | Component({
3 | options: {
4 | styleIsolation: 'shared'
5 | },
6 | properties: {
7 | data: {
8 | type: Object,
9 | value: {}
10 | }
11 | },
12 | data: {
13 | attr:{
14 | src:'',
15 | class:''
16 | },
17 | size:{
18 | w:0,
19 | h:0
20 | }
21 | },
22 | lifetimes:{
23 | attached:function(){
24 | const _ts = this;
25 | let dataAttr = this.data.data.attrs;
26 |
27 | // 设置公式图片
28 | _ts.setData({
29 | attr:{
30 | src:`${config.yuml.api}=${dataAttr.value}&theme=${global._theme}`,
31 | class:`${dataAttr.class}`
32 | }
33 | });
34 | }
35 | },
36 | methods: {
37 | load:function(e){
38 | const _ts = this;
39 | // 公式图片加载完成则根据其图片大小、类型计算其显示的合适大小
40 | let scale = 20,
41 | w = e.detail.width / scale,
42 | h = e.detail.height / scale;
43 | _ts.setData({
44 | size:{
45 | w:w,
46 | h:h
47 | }
48 | });
49 | }
50 | }
51 | })
--------------------------------------------------------------------------------
/dist/yuml/yuml.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | }
5 | }
--------------------------------------------------------------------------------
/dist/yuml/yuml.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/dist/yuml/yuml.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sbfkcel/towxml/e60c14247f5035acb808d6196a56bb13d5811df8/dist/yuml/yuml.wxss
--------------------------------------------------------------------------------
/echarts/echarts.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/echarts/echarts.wxml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/echarts/echarts.wxss:
--------------------------------------------------------------------------------
1 | .ec-canvas {
2 | width: 100%;
3 | height: 100%;
4 | }
5 |
--------------------------------------------------------------------------------
/img/img.js:
--------------------------------------------------------------------------------
1 | const config = require('../config');
2 | Component({
3 | options: {
4 | styleIsolation: 'shared'
5 | },
6 | properties: {
7 | data: {
8 | type: Object,
9 | value: {}
10 | }
11 | },
12 | data: {
13 | attr:{
14 | src:'',
15 | class:'',
16 | style:''
17 | },
18 | size:{
19 | w:0,
20 | h:0
21 | },
22 | styleObj:{}
23 | },
24 | lifetimes:{
25 | attached:function(){
26 | const _ts = this;
27 | let dataAttr = this.data.data.attrs;
28 |
29 | // 将图片大小处理到对象中
30 | if(dataAttr.width){
31 | _ts.data.size.w = +dataAttr.width / config.dpr;
32 | };
33 |
34 | if(dataAttr.height){
35 | _ts.data.size.h = +dataAttr.height / config.dpr;
36 | };
37 |
38 | // 将样式合并到样式对象中
39 | if(dataAttr.style){
40 | let re = /;\s{0,}/ig;
41 | dataAttr.style = dataAttr.style.replace(re,';');
42 | dataAttr.style.split(';').forEach(item => {
43 | let itemArr = item.split(':');
44 | if(/^(width|height)$/i.test(itemArr[0])){
45 | let num = parseInt(itemArr[1]) || 0,
46 | key = '';
47 | // itemArr[1] = num / config.dpr + itemArr[1].replace(num,'');
48 | switch (itemArr[0].toLocaleLowerCase()) {
49 | case 'width':
50 | key = 'w';
51 | break;
52 | case 'height':
53 | key = 'h';
54 | break;
55 | };
56 | _ts.data.size[key] = num / config.dpr;
57 | }else{
58 | _ts.data.styleObj[itemArr[0]] = itemArr[1];
59 | };
60 | });
61 | };
62 |
63 | // 设置公式图片
64 | _ts.setData({
65 | attrs:{
66 | src:dataAttr.src,
67 | class:dataAttr.class,
68 | style:_ts.setStyle(_ts.data.styleObj)
69 | },
70 | size:_ts.data.size
71 | });
72 | }
73 | },
74 | methods: {
75 | // 设置图片样式
76 | setStyle:function(o){
77 | let str = ``;
78 | for(let key in o){
79 | str += `${key}:${o[key]};`;
80 | };
81 | return str;
82 | },
83 |
84 | // 图片加载完成设置图片大小
85 | load:function(e){
86 | const _ts = this;
87 |
88 | if(!_ts.data.size.w || !_ts.data.size.h){
89 | _ts.setData({
90 | size:{
91 | w:e.detail.width / config.dpr,
92 | h:e.detail.height / config.dpr
93 | }
94 | });
95 | };
96 | }
97 | }
98 | })
--------------------------------------------------------------------------------
/img/img.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/img/img.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/img/img.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sbfkcel/towxml/e60c14247f5035acb808d6196a56bb13d5811df8/img/img.wxss
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | const md = require('./parse/markdown/index'),
2 | parse = require('./parse/index')
3 |
4 | module.exports = (str,type,option)=>{
5 | option = option || {};
6 | let result;
7 | switch (type) {
8 | case 'markdown':
9 | result = parse(md(str),option);
10 | break;
11 | case 'html':
12 | result = parse(str,option);
13 | break;
14 | default:
15 | throw new Error('Invalid type, only markdown and html are supported');
16 | break;
17 | };
18 | return result;
19 | };
20 |
--------------------------------------------------------------------------------
/latex/latex.js:
--------------------------------------------------------------------------------
1 | const config = require('../config');
2 | Component({
3 | options: {
4 | styleIsolation: 'shared'
5 | },
6 | properties: {
7 | data: {
8 | type: Object,
9 | value: {}
10 | }
11 | },
12 | data: {
13 | attr:{
14 | src:'',
15 | class:''
16 | },
17 | size:{
18 | w:0,
19 | h:0
20 | }
21 | },
22 | lifetimes:{
23 | attached:function(){
24 | const _ts = this;
25 | let dataAttr = this.data.data.attrs;
26 |
27 | // 设置公式图片
28 | _ts.setData({
29 | attrs:{
30 | src:`${config.latex.api}=${dataAttr.value}&theme=${global._theme}`,
31 | class:`${dataAttr.class} ${dataAttr.class}--${dataAttr.type}`
32 | }
33 | });
34 | }
35 | },
36 | methods: {
37 | load:function(e){
38 | const _ts = this;
39 |
40 | // 公式图片加载完成则根据其图片大小、类型计算其显示的合适大小
41 | let scale = 20,
42 | w = e.detail.width / scale,
43 | h = e.detail.height /scale;
44 |
45 | _ts.setData({
46 | size:{
47 | w:w,
48 | h:h
49 | }
50 | });
51 | }
52 | }
53 | })
--------------------------------------------------------------------------------
/latex/latex.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | }
5 | }
--------------------------------------------------------------------------------
/latex/latex.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/latex/latex.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sbfkcel/towxml/e60c14247f5035acb808d6196a56bb13d5811df8/latex/latex.wxss
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "towxml",
3 | "version": "3.3.1",
4 | "description": "HTML、Markdown转WXML(WeiXin Markup Language)渲染库",
5 | "main": "./dist/index.js",
6 | "scripts": {
7 | "build": "node build",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "git+https://github.com/sbfkcel/towxml.git"
13 | },
14 | "keywords": [
15 | "html to wxml",
16 | "markdown to wxml",
17 | "html2wxml",
18 | "mark2wxml",
19 | "wxml"
20 | ],
21 | "author": "sbfkcel@163.com",
22 | "license": "MIT",
23 | "bugs": {
24 | "url": "https://github.com/sbfkcel/towxml/issues"
25 | },
26 | "homepage": "https://github.com/sbfkcel/towxml#readme",
27 | "dependencies": {
28 | "fs-extra": "^8.1.0"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/parse/highlight/index.js:
--------------------------------------------------------------------------------
1 | const config = require('../../config'),
2 | hljs = require('./highlight');
3 | // config.highlight.forEach(item => {
4 | // hljs.registerLanguage(item, require(`./languages/${item}`).default);
5 | // });
6 | //@registerLanguage
7 |
8 | module.exports = hljs;
--------------------------------------------------------------------------------
/parse/highlight/languages/abnf.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Augmented Backus-Naur Form
3 | Author: Alex McKibben
4 | Website: https://tools.ietf.org/html/rfc5234
5 | */
6 |
7 | export default function(hljs) {
8 | var regexes = {
9 | ruleDeclaration: "^[a-zA-Z][a-zA-Z0-9-]*",
10 | unexpectedChars: "[!@#$^&',?+~`|:]"
11 | };
12 |
13 | var keywords = [
14 | "ALPHA",
15 | "BIT",
16 | "CHAR",
17 | "CR",
18 | "CRLF",
19 | "CTL",
20 | "DIGIT",
21 | "DQUOTE",
22 | "HEXDIG",
23 | "HTAB",
24 | "LF",
25 | "LWSP",
26 | "OCTET",
27 | "SP",
28 | "VCHAR",
29 | "WSP"
30 | ];
31 |
32 | var commentMode = hljs.COMMENT(";", "$");
33 |
34 | var terminalBinaryMode = {
35 | className: "symbol",
36 | begin: /%b[0-1]+(-[0-1]+|(\.[0-1]+)+){0,1}/
37 | };
38 |
39 | var terminalDecimalMode = {
40 | className: "symbol",
41 | begin: /%d[0-9]+(-[0-9]+|(\.[0-9]+)+){0,1}/
42 | };
43 |
44 | var terminalHexadecimalMode = {
45 | className: "symbol",
46 | begin: /%x[0-9A-F]+(-[0-9A-F]+|(\.[0-9A-F]+)+){0,1}/,
47 | };
48 |
49 | var caseSensitivityIndicatorMode = {
50 | className: "symbol",
51 | begin: /%[si]/
52 | };
53 |
54 | var ruleDeclarationMode = {
55 | className: "attribute",
56 | begin: regexes.ruleDeclaration + '(?=\\s*=)',
57 | };
58 |
59 | return {
60 | name: 'Augmented Backus-Naur Form',
61 | illegal: regexes.unexpectedChars,
62 | keywords: keywords.join(" "),
63 | contains: [
64 | ruleDeclarationMode,
65 | commentMode,
66 | terminalBinaryMode,
67 | terminalDecimalMode,
68 | terminalHexadecimalMode,
69 | caseSensitivityIndicatorMode,
70 | hljs.QUOTE_STRING_MODE,
71 | hljs.NUMBER_MODE
72 | ]
73 | };
74 | }
75 |
--------------------------------------------------------------------------------
/parse/highlight/languages/accesslog.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Apache Access Log
3 | Author: Oleg Efimov
4 | Description: Apache/Nginx Access Logs
5 | Website: https://httpd.apache.org/docs/2.4/logs.html#accesslog
6 | */
7 |
8 | export default function(hljs) {
9 | // https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
10 | var HTTP_VERBS = [
11 | "GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "PATCH", "TRACE"
12 | ]
13 | return {
14 | name: 'Apache Access Log',
15 | contains: [
16 | // IP
17 | {
18 | className: 'number',
19 | begin: '^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b',
20 | relevance:5
21 | },
22 | // Other numbers
23 | {
24 | className: 'number',
25 | begin: '\\b\\d+\\b',
26 | relevance: 0
27 | },
28 | // Requests
29 | {
30 | className: 'string',
31 | begin: '"(' + HTTP_VERBS.join("|") + ')', end: '"',
32 | keywords: HTTP_VERBS.join(" "),
33 | illegal: '\\n',
34 | relevance: 5,
35 | contains: [{
36 | begin: 'HTTP/[12]\\.\\d',
37 | relevance:5
38 | }]
39 | },
40 | // Dates
41 | {
42 | className: 'string',
43 | // dates must have a certain length, this prevents matching
44 | // simple array accesses a[123] and [] and other common patterns
45 | // found in other languages
46 | begin: /\[\d[^\]\n]{8,}\]/,
47 | illegal: '\\n',
48 | relevance: 1
49 | },
50 | {
51 | className: 'string',
52 | begin: /\[/, end: /\]/,
53 | illegal: '\\n',
54 | relevance: 0
55 | },
56 | // User agent / relevance boost
57 | {
58 | className: 'string',
59 | begin: '"Mozilla/\\d\\.\\d \\\(', end: '"',
60 | illegal: '\\n',
61 | relevance: 3
62 | },
63 | // Strings
64 | {
65 | className: 'string',
66 | begin: '"', end: '"',
67 | illegal: '\\n',
68 | relevance: 0
69 | }
70 | ]
71 | };
72 | }
73 |
--------------------------------------------------------------------------------
/parse/highlight/languages/apache.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Apache config
3 | Author: Ruslan Keba
4 | Contributors: Ivan Sagalaev
5 | Website: https://httpd.apache.org
6 | Description: language definition for Apache configuration files (httpd.conf & .htaccess)
7 | Category: common, config
8 | */
9 |
10 | export default function(hljs) {
11 | var NUMBER_REF = {className: 'number', begin: '[\\$%]\\d+'};
12 | var NUMBER = {className: 'number', begin: '\\d+'};
13 | var IP_ADDRESS = {
14 | className: "number",
15 | begin: '\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?'
16 | };
17 | var PORT_NUMBER = {
18 | className: "number",
19 | begin: ":\\d{1,5}"
20 | };
21 | return {
22 | name: 'Apache config',
23 | aliases: ['apacheconf'],
24 | case_insensitive: true,
25 | contains: [
26 | hljs.HASH_COMMENT_MODE,
27 | {className: 'section', begin: '?', end: '>',
28 | contains: [
29 | IP_ADDRESS,
30 | PORT_NUMBER,
31 | // low relevance prevents us from claming XML/HTML where this rule would
32 | // match strings inside of XML tags
33 | hljs.inherit(hljs.QUOTE_STRING_MODE, { relevance:0 })
34 | ]
35 | },
36 | {
37 | className: 'attribute',
38 | begin: /\w+/,
39 | relevance: 0,
40 | // keywords aren’t needed for highlighting per se, they only boost relevance
41 | // for a very generally defined mode (starts with a word, ends with line-end
42 | keywords: {
43 | nomarkup:
44 | 'order deny allow setenv rewriterule rewriteengine rewritecond documentroot ' +
45 | 'sethandler errordocument loadmodule options header listen serverroot ' +
46 | 'servername'
47 | },
48 | starts: {
49 | end: /$/,
50 | relevance: 0,
51 | keywords: {
52 | literal: 'on off all deny allow'
53 | },
54 | contains: [
55 | {
56 | className: 'meta',
57 | begin: '\\s\\[', end: '\\]$'
58 | },
59 | {
60 | className: 'variable',
61 | begin: '[\\$%]\\{', end: '\\}',
62 | contains: ['self', NUMBER_REF]
63 | },
64 | IP_ADDRESS,
65 | NUMBER,
66 | hljs.QUOTE_STRING_MODE
67 | ]
68 | }
69 | }
70 | ],
71 | illegal: /\S/
72 | };
73 | }
74 |
--------------------------------------------------------------------------------
/parse/highlight/languages/autohotkey.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: AutoHotkey
3 | Author: Seongwon Lee
4 | Description: AutoHotkey language definition
5 | Category: scripting
6 | */
7 |
8 | export default function(hljs) {
9 | var BACKTICK_ESCAPE = {
10 | begin: '`[\\s\\S]'
11 | };
12 |
13 | return {
14 | name: 'AutoHotkey',
15 | case_insensitive: true,
16 | aliases: ['ahk'],
17 | keywords: {
18 | keyword: 'Break Continue Critical Exit ExitApp Gosub Goto New OnExit Pause return SetBatchLines SetTimer Suspend Thread Throw Until ahk_id ahk_class ahk_pid ahk_exe ahk_group',
19 | literal: 'true false NOT AND OR',
20 | built_in: 'ComSpec Clipboard ClipboardAll ErrorLevel',
21 | },
22 | contains: [
23 | BACKTICK_ESCAPE,
24 | hljs.inherit(hljs.QUOTE_STRING_MODE, {contains: [BACKTICK_ESCAPE]}),
25 | hljs.COMMENT(';', '$', {relevance: 0}),
26 | hljs.C_BLOCK_COMMENT_MODE,
27 | {
28 | className: 'number',
29 | begin: hljs.NUMBER_RE,
30 | relevance: 0
31 | },
32 | {
33 | className: 'variable', //subst would be the most accurate however fails the point of highlighting. variable is comparably the most accurate that actually has some effect
34 | begin: '%[a-zA-Z0-9#_$@]+%'
35 | },
36 | {
37 | className: 'built_in',
38 | begin: '^\\s*\\w+\\s*(,|%)'
39 | //I don't really know if this is totally relevant
40 | },
41 | {
42 | className: 'title', //symbol would be most accurate however is higlighted just like built_in and that makes up a lot of AutoHotkey code
43 | //meaning that it would fail to highlight anything
44 | variants: [
45 | {begin: '^[^\\n";]+::(?!=)'},
46 | {begin: '^[^\\n";]+:(?!=)', relevance: 0} // zero relevance as it catches a lot of things
47 | // followed by a single ':' in many languages
48 | ]
49 | },
50 | {
51 | className: 'meta',
52 | begin: '^\\s*#\\w+', end:'$',
53 | relevance: 0
54 | },
55 | {
56 | className: 'built_in',
57 | begin: 'A_[a-zA-Z0-9]+'
58 | },
59 | {
60 | // consecutive commas, not for highlighting but just for relevance
61 | begin: ',\\s*,'
62 | }
63 | ]
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/parse/highlight/languages/awk.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Awk
3 | Author: Matthew Daly
4 | Website: https://www.gnu.org/software/gawk/manual/gawk.html
5 | Description: language definition for Awk scripts
6 | */
7 |
8 | export default function(hljs) {
9 | var VARIABLE = {
10 | className: 'variable',
11 | variants: [
12 | {begin: /\$[\w\d#@][\w\d_]*/},
13 | {begin: /\$\{(.*?)}/}
14 | ]
15 | };
16 | var KEYWORDS = 'BEGIN END if else while do for in break continue delete next nextfile function func exit|10';
17 | var STRING = {
18 | className: 'string',
19 | contains: [hljs.BACKSLASH_ESCAPE],
20 | variants: [
21 | {
22 | begin: /(u|b)?r?'''/, end: /'''/,
23 | relevance: 10
24 | },
25 | {
26 | begin: /(u|b)?r?"""/, end: /"""/,
27 | relevance: 10
28 | },
29 | {
30 | begin: /(u|r|ur)'/, end: /'/,
31 | relevance: 10
32 | },
33 | {
34 | begin: /(u|r|ur)"/, end: /"/,
35 | relevance: 10
36 | },
37 | {
38 | begin: /(b|br)'/, end: /'/
39 | },
40 | {
41 | begin: /(b|br)"/, end: /"/
42 | },
43 | hljs.APOS_STRING_MODE,
44 | hljs.QUOTE_STRING_MODE
45 | ]
46 | };
47 | return {
48 | name: 'Awk',
49 | keywords: {
50 | keyword: KEYWORDS
51 | },
52 | contains: [
53 | VARIABLE,
54 | STRING,
55 | hljs.REGEXP_MODE,
56 | hljs.HASH_COMMENT_MODE,
57 | hljs.NUMBER_MODE
58 | ]
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/parse/highlight/languages/axapta.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Microsoft Axapta (now Dynamics 365)
3 | Author: Dmitri Roudakov
4 | Website: https://dynamics.microsoft.com/en-us/ax-overview/
5 | Category: enterprise
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Dynamics 365',
11 | keywords: 'false int abstract private char boolean static null if for true ' +
12 | 'while long throw finally protected final return void enum else ' +
13 | 'break new catch byte super case short default double public try this switch ' +
14 | 'continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count ' +
15 | 'order group by asc desc index hint like dispaly edit client server ttsbegin ' +
16 | 'ttscommit str real date container anytype common div mod',
17 | contains: [
18 | hljs.C_LINE_COMMENT_MODE,
19 | hljs.C_BLOCK_COMMENT_MODE,
20 | hljs.APOS_STRING_MODE,
21 | hljs.QUOTE_STRING_MODE,
22 | hljs.C_NUMBER_MODE,
23 | {
24 | className: 'meta',
25 | begin: '#', end: '$'
26 | },
27 | {
28 | className: 'class',
29 | beginKeywords: 'class interface', end: '{', excludeEnd: true,
30 | illegal: ':',
31 | contains: [
32 | {beginKeywords: 'extends implements'},
33 | hljs.UNDERSCORE_TITLE_MODE
34 | ]
35 | }
36 | ]
37 | };
38 | }
39 |
--------------------------------------------------------------------------------
/parse/highlight/languages/basic.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: BASIC
3 | Author: Raphaël Assénat
4 | Description: Based on the BASIC reference from the Tandy 1000 guide
5 | Website: https://en.wikipedia.org/wiki/Tandy_1000
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'BASIC',
11 | case_insensitive: true,
12 | illegal: '^\.',
13 | // Support explicitly typed variables that end with $%! or #.
14 | lexemes: '[a-zA-Z][a-zA-Z0-9_\$\%\!\#]*',
15 | keywords: {
16 | keyword:
17 | 'ABS ASC AND ATN AUTO|0 BEEP BLOAD|10 BSAVE|10 CALL CALLS CDBL CHAIN CHDIR CHR$|10 CINT CIRCLE ' +
18 | 'CLEAR CLOSE CLS COLOR COM COMMON CONT COS CSNG CSRLIN CVD CVI CVS DATA DATE$ ' +
19 | 'DEFDBL DEFINT DEFSNG DEFSTR DEF|0 SEG USR DELETE DIM DRAW EDIT END ENVIRON ENVIRON$ ' +
20 | 'EOF EQV ERASE ERDEV ERDEV$ ERL ERR ERROR EXP FIELD FILES FIX FOR|0 FRE GET GOSUB|10 GOTO ' +
21 | 'HEX$ IF THEN ELSE|0 INKEY$ INP INPUT INPUT# INPUT$ INSTR IMP INT IOCTL IOCTL$ KEY ON ' +
22 | 'OFF LIST KILL LEFT$ LEN LET LINE LLIST LOAD LOC LOCATE LOF LOG LPRINT USING LSET ' +
23 | 'MERGE MID$ MKDIR MKD$ MKI$ MKS$ MOD NAME NEW NEXT NOISE NOT OCT$ ON OR PEN PLAY STRIG OPEN OPTION ' +
24 | 'BASE OUT PAINT PALETTE PCOPY PEEK PMAP POINT POKE POS PRINT PRINT] PSET PRESET ' +
25 | 'PUT RANDOMIZE READ REM RENUM RESET|0 RESTORE RESUME RETURN|0 RIGHT$ RMDIR RND RSET ' +
26 | 'RUN SAVE SCREEN SGN SHELL SIN SOUND SPACE$ SPC SQR STEP STICK STOP STR$ STRING$ SWAP ' +
27 | 'SYSTEM TAB TAN TIME$ TIMER TROFF TRON TO USR VAL VARPTR VARPTR$ VIEW WAIT WHILE ' +
28 | 'WEND WIDTH WINDOW WRITE XOR'
29 | },
30 | contains: [
31 | hljs.QUOTE_STRING_MODE,
32 | hljs.COMMENT('REM', '$', {relevance: 10}),
33 | hljs.COMMENT('\'', '$', {relevance: 0}),
34 | {
35 | // Match line numbers
36 | className: 'symbol',
37 | begin: '^[0-9]+\ ',
38 | relevance: 10
39 | },
40 | {
41 | // Match typed numeric constants (1000, 12.34!, 1.2e5, 1.5#, 1.2D2)
42 | className: 'number',
43 | begin: '\\b([0-9]+[0-9edED\.]*[#\!]?)',
44 | relevance: 0
45 | },
46 | {
47 | // Match hexadecimal numbers (&Hxxxx)
48 | className: 'number',
49 | begin: '(\&[hH][0-9a-fA-F]{1,4})'
50 | },
51 | {
52 | // Match octal numbers (&Oxxxxxx)
53 | className: 'number',
54 | begin: '(\&[oO][0-7]{1,6})'
55 | }
56 | ]
57 | };
58 | }
59 |
--------------------------------------------------------------------------------
/parse/highlight/languages/bnf.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Backus–Naur Form
3 | Website: https://en.wikipedia.org/wiki/Backus–Naur_form
4 | Author: Oleg Efimov
5 | */
6 |
7 | export default function(hljs){
8 | return {
9 | name: 'Backus–Naur Form',
10 | contains: [
11 | // Attribute
12 | {
13 | className: 'attribute',
14 | begin: /, end: />/
15 | },
16 | // Specific
17 | {
18 | begin: /::=/,
19 | end: /$/,
20 | contains: [
21 | {
22 | begin: /, end: />/
23 | },
24 | // Common
25 | hljs.C_LINE_COMMENT_MODE,
26 | hljs.C_BLOCK_COMMENT_MODE,
27 | hljs.APOS_STRING_MODE,
28 | hljs.QUOTE_STRING_MODE
29 | ]
30 | }
31 | ]
32 | };
33 | }
34 |
--------------------------------------------------------------------------------
/parse/highlight/languages/brainfuck.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Brainfuck
3 | Author: Evgeny Stepanischev
4 | Website: https://esolangs.org/wiki/Brainfuck
5 | */
6 |
7 | export default function(hljs){
8 | var LITERAL = {
9 | className: 'literal',
10 | begin: '[\\+\\-]',
11 | relevance: 0
12 | };
13 | return {
14 | name: 'Brainfuck',
15 | aliases: ['bf'],
16 | contains: [
17 | hljs.COMMENT(
18 | '[^\\[\\]\\.,\\+\\-<> \r\n]',
19 | '[\\[\\]\\.,\\+\\-<> \r\n]',
20 | {
21 | returnEnd: true,
22 | relevance: 0
23 | }
24 | ),
25 | {
26 | className: 'title',
27 | begin: '[\\[\\]]',
28 | relevance: 0
29 | },
30 | {
31 | className: 'string',
32 | begin: '[\\.,]',
33 | relevance: 0
34 | },
35 | {
36 | // this mode works as the only relevance counter
37 | begin: /(?:\+\+|\-\-)/,
38 | contains: [LITERAL]
39 | },
40 | LITERAL
41 | ]
42 | };
43 | }
44 |
--------------------------------------------------------------------------------
/parse/highlight/languages/c.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: C
3 | Category: common, system
4 | Website: https://en.wikipedia.org/wiki/C_(programming_language)
5 | Requires: c-like.js
6 | */
7 |
8 | export default function(hljs) {
9 |
10 | var lang = hljs.getLanguage('c-like').rawDefinition();
11 | // Until C is actually different than C++ there is no reason to auto-detect C
12 | // as it's own language since it would just fail auto-detect testing or
13 | // simply match with C++.
14 | //
15 | // See further comments in c-like.js.
16 |
17 | // lang.disableAutodetect = false;
18 | lang.name = 'C';
19 | lang.aliases = ['c', 'h'];
20 | return lang;
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/parse/highlight/languages/cal.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: C/AL
3 | Author: Kenneth Fuglsang Christensen
4 | Description: Provides highlighting of Microsoft Dynamics NAV C/AL code files
5 | Website: https://docs.microsoft.com/en-us/dynamics-nav/programming-in-c-al
6 | */
7 |
8 | export default function(hljs) {
9 | var KEYWORDS =
10 | 'div mod in and or not xor asserterror begin case do downto else end exit for if of repeat then to ' +
11 | 'until while with var';
12 | var LITERALS = 'false true';
13 | var COMMENT_MODES = [
14 | hljs.C_LINE_COMMENT_MODE,
15 | hljs.COMMENT(
16 | /\{/,
17 | /\}/,
18 | {
19 | relevance: 0
20 | }
21 | ),
22 | hljs.COMMENT(
23 | /\(\*/,
24 | /\*\)/,
25 | {
26 | relevance: 10
27 | }
28 | )
29 | ];
30 | var STRING = {
31 | className: 'string',
32 | begin: /'/, end: /'/,
33 | contains: [{begin: /''/}]
34 | };
35 | var CHAR_STRING = {
36 | className: 'string', begin: /(#\d+)+/
37 | };
38 | var DATE = {
39 | className: 'number',
40 | begin: '\\b\\d+(\\.\\d+)?(DT|D|T)',
41 | relevance: 0
42 | };
43 | var DBL_QUOTED_VARIABLE = {
44 | className: 'string', // not a string technically but makes sense to be highlighted in the same style
45 | begin: '"',
46 | end: '"'
47 | };
48 |
49 | var PROCEDURE = {
50 | className: 'function',
51 | beginKeywords: 'procedure', end: /[:;]/,
52 | keywords: 'procedure|10',
53 | contains: [
54 | hljs.TITLE_MODE,
55 | {
56 | className: 'params',
57 | begin: /\(/, end: /\)/,
58 | keywords: KEYWORDS,
59 | contains: [STRING, CHAR_STRING]
60 | }
61 | ].concat(COMMENT_MODES)
62 | };
63 |
64 | var OBJECT = {
65 | className: 'class',
66 | begin: 'OBJECT (Table|Form|Report|Dataport|Codeunit|XMLport|MenuSuite|Page|Query) (\\d+) ([^\\r\\n]+)',
67 | returnBegin: true,
68 | contains: [
69 | hljs.TITLE_MODE,
70 | PROCEDURE
71 | ]
72 | };
73 |
74 | return {
75 | name: 'C/AL',
76 | case_insensitive: true,
77 | keywords: { keyword: KEYWORDS, literal: LITERALS },
78 | illegal: /\/\*/,
79 | contains: [
80 | STRING, CHAR_STRING,
81 | DATE, DBL_QUOTED_VARIABLE,
82 | hljs.NUMBER_MODE,
83 | OBJECT,
84 | PROCEDURE
85 | ]
86 | };
87 | }
88 |
--------------------------------------------------------------------------------
/parse/highlight/languages/capnproto.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Cap’n Proto
3 | Author: Oleg Efimov
4 | Description: Cap’n Proto message definition format
5 | Website: https://capnproto.org/capnp-tool.html
6 | Category: protocols
7 | */
8 |
9 | export default function(hljs) {
10 | return {
11 | name: 'Cap’n Proto',
12 | aliases: ['capnp'],
13 | keywords: {
14 | keyword:
15 | 'struct enum interface union group import using const annotation extends in of on as with from fixed',
16 | built_in:
17 | 'Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 ' +
18 | 'Text Data AnyPointer AnyStruct Capability List',
19 | literal:
20 | 'true false'
21 | },
22 | contains: [
23 | hljs.QUOTE_STRING_MODE,
24 | hljs.NUMBER_MODE,
25 | hljs.HASH_COMMENT_MODE,
26 | {
27 | className: 'meta',
28 | begin: /@0x[\w\d]{16};/,
29 | illegal: /\n/
30 | },
31 | {
32 | className: 'symbol',
33 | begin: /@\d+\b/
34 | },
35 | {
36 | className: 'class',
37 | beginKeywords: 'struct enum', end: /\{/,
38 | illegal: /\n/,
39 | contains: [
40 | hljs.inherit(hljs.TITLE_MODE, {
41 | starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
42 | })
43 | ]
44 | },
45 | {
46 | className: 'class',
47 | beginKeywords: 'interface', end: /\{/,
48 | illegal: /\n/,
49 | contains: [
50 | hljs.inherit(hljs.TITLE_MODE, {
51 | starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
52 | })
53 | ]
54 | }
55 | ]
56 | };
57 | }
58 |
--------------------------------------------------------------------------------
/parse/highlight/languages/ceylon.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Ceylon
3 | Author: Lucas Werkmeister
4 | Website: https://ceylon-lang.org
5 | */
6 | export default function(hljs) {
7 | // 2.3. Identifiers and keywords
8 | var KEYWORDS =
9 | 'assembly module package import alias class interface object given value ' +
10 | 'assign void function new of extends satisfies abstracts in out return ' +
11 | 'break continue throw assert dynamic if else switch case for while try ' +
12 | 'catch finally then let this outer super is exists nonempty';
13 | // 7.4.1 Declaration Modifiers
14 | var DECLARATION_MODIFIERS =
15 | 'shared abstract formal default actual variable late native deprecated ' +
16 | 'final sealed annotation suppressWarnings small';
17 | // 7.4.2 Documentation
18 | var DOCUMENTATION =
19 | 'doc by license see throws tagged';
20 | var SUBST = {
21 | className: 'subst', excludeBegin: true, excludeEnd: true,
22 | begin: /``/, end: /``/,
23 | keywords: KEYWORDS,
24 | relevance: 10
25 | };
26 | var EXPRESSIONS = [
27 | {
28 | // verbatim string
29 | className: 'string',
30 | begin: '"""',
31 | end: '"""',
32 | relevance: 10
33 | },
34 | {
35 | // string literal or template
36 | className: 'string',
37 | begin: '"', end: '"',
38 | contains: [SUBST]
39 | },
40 | {
41 | // character literal
42 | className: 'string',
43 | begin: "'",
44 | end: "'"
45 | },
46 | {
47 | // numeric literal
48 | className: 'number',
49 | begin: '#[0-9a-fA-F_]+|\\$[01_]+|[0-9_]+(?:\\.[0-9_](?:[eE][+-]?\\d+)?)?[kMGTPmunpf]?',
50 | relevance: 0
51 | }
52 | ];
53 | SUBST.contains = EXPRESSIONS;
54 |
55 | return {
56 | name: 'Ceylon',
57 | keywords: {
58 | keyword: KEYWORDS + ' ' + DECLARATION_MODIFIERS,
59 | meta: DOCUMENTATION
60 | },
61 | illegal: '\\$[^01]|#[^0-9a-fA-F]',
62 | contains: [
63 | hljs.C_LINE_COMMENT_MODE,
64 | hljs.COMMENT('/\\*', '\\*/', {contains: ['self']}),
65 | {
66 | // compiler annotation
67 | className: 'meta',
68 | begin: '@[a-z]\\w*(?:\\:\"[^\"]*\")?'
69 | }
70 | ].concat(EXPRESSIONS)
71 | };
72 | }
73 |
--------------------------------------------------------------------------------
/parse/highlight/languages/clean.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Clean
3 | Author: Camil Staps
4 | Category: functional
5 | Website: http://clean.cs.ru.nl
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Clean',
11 | aliases: ['clean','icl','dcl'],
12 | keywords: {
13 | keyword:
14 | 'if let in with where case of class instance otherwise ' +
15 | 'implementation definition system module from import qualified as ' +
16 | 'special code inline foreign export ccall stdcall generic derive ' +
17 | 'infix infixl infixr',
18 | built_in:
19 | 'Int Real Char Bool',
20 | literal:
21 | 'True False'
22 | },
23 | contains: [
24 |
25 | hljs.C_LINE_COMMENT_MODE,
26 | hljs.C_BLOCK_COMMENT_MODE,
27 | hljs.APOS_STRING_MODE,
28 | hljs.QUOTE_STRING_MODE,
29 | hljs.C_NUMBER_MODE,
30 |
31 | {begin: '->|<-[|:]?|#!?|>>=|\\{\\||\\|\\}|:==|=:|<>'} // relevance booster
32 | ]
33 | };
34 | }
35 |
--------------------------------------------------------------------------------
/parse/highlight/languages/clojure-repl.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Clojure REPL
3 | Description: Clojure REPL sessions
4 | Author: Ivan Sagalaev
5 | Requires: clojure.js
6 | Website: https://clojure.org
7 | Category: lisp
8 | */
9 |
10 | export default function(hljs) {
11 | return {
12 | name: 'Clojure REPL',
13 | contains: [
14 | {
15 | className: 'meta',
16 | begin: /^([\w.-]+|\s*#_)?=>/,
17 | starts: {
18 | end: /$/,
19 | subLanguage: 'clojure'
20 | }
21 | }
22 | ]
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/parse/highlight/languages/cpp.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: C++
3 | Category: common, system
4 | Website: https://isocpp.org
5 | Requires: c-like.js
6 | */
7 |
8 | export default function(hljs) {
9 |
10 | var lang = hljs.getLanguage('c-like').rawDefinition();
11 | // return auto-detection back on
12 | lang.disableAutodetect = false;
13 | lang.name = 'C++';
14 | lang.aliases = ['cc', 'c++', 'h++', 'hpp', 'hh', 'hxx', 'cxx'];
15 | return lang;
16 | }
17 |
--------------------------------------------------------------------------------
/parse/highlight/languages/csp.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: CSP
3 | Description: Content Security Policy definition highlighting
4 | Author: Taras
5 | Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
6 |
7 | vim: ts=2 sw=2 st=2
8 | */
9 |
10 | export default function(hljs) {
11 | return {
12 | name: 'CSP',
13 | case_insensitive: false,
14 | lexemes: '[a-zA-Z][a-zA-Z0-9_-]*',
15 | keywords: {
16 | keyword: 'base-uri child-src connect-src default-src font-src form-action ' +
17 | 'frame-ancestors frame-src img-src media-src object-src plugin-types ' +
18 | 'report-uri sandbox script-src style-src',
19 | },
20 | contains: [
21 | {
22 | className: 'string',
23 | begin: "'", end: "'"
24 | },
25 | {
26 | className: 'attribute',
27 | begin: '^Content', end: ':', excludeEnd: true,
28 | },
29 | ]
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/parse/highlight/languages/diff.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Diff
3 | Description: Unified and context diff
4 | Author: Vasily Polovnyov
5 | Website: https://www.gnu.org/software/diffutils/
6 | Category: common
7 | */
8 |
9 | export default function(hljs) {
10 | return {
11 | name: 'Diff',
12 | aliases: ['patch'],
13 | contains: [
14 | {
15 | className: 'meta',
16 | relevance: 10,
17 | variants: [
18 | {begin: /^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},
19 | {begin: /^\*\*\* +\d+,\d+ +\*\*\*\*$/},
20 | {begin: /^\-\-\- +\d+,\d+ +\-\-\-\-$/}
21 | ]
22 | },
23 | {
24 | className: 'comment',
25 | variants: [
26 | {begin: /Index: /, end: /$/},
27 | {begin: /={3,}/, end: /$/},
28 | {begin: /^\-{3}/, end: /$/},
29 | {begin: /^\*{3} /, end: /$/},
30 | {begin: /^\+{3}/, end: /$/},
31 | {begin: /^\*{15}$/ }
32 | ]
33 | },
34 | {
35 | className: 'addition',
36 | begin: '^\\+', end: '$'
37 | },
38 | {
39 | className: 'deletion',
40 | begin: '^\\-', end: '$'
41 | },
42 | {
43 | className: 'addition',
44 | begin: '^\\!', end: '$'
45 | }
46 | ]
47 | };
48 | }
49 |
--------------------------------------------------------------------------------
/parse/highlight/languages/dns.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: DNS Zone
3 | Author: Tim Schumacher
4 | Category: config
5 | Website: https://en.wikipedia.org/wiki/Zone_file
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'DNS Zone',
11 | aliases: ['bind', 'zone'],
12 | keywords: {
13 | keyword:
14 | 'IN A AAAA AFSDB APL CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME DNSKEY DS HIP IPSECKEY KEY KX ' +
15 | 'LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR RRSIG RP SIG SOA SRV SSHFP TA TKEY TLSA TSIG TXT'
16 | },
17 | contains: [
18 | hljs.COMMENT(';', '$', {relevance: 0}),
19 | {
20 | className: 'meta',
21 | begin: /^\$(TTL|GENERATE|INCLUDE|ORIGIN)\b/
22 | },
23 | // IPv6
24 | {
25 | className: 'number',
26 | begin: '((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))\\b'
27 | },
28 | // IPv4
29 | {
30 | className: 'number',
31 | begin: '((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\b'
32 | },
33 | hljs.inherit(hljs.NUMBER_MODE, {begin: /\b\d+[dhwm]?/})
34 | ]
35 | };
36 | }
37 |
--------------------------------------------------------------------------------
/parse/highlight/languages/dockerfile.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Dockerfile
3 | Requires: bash.js
4 | Author: Alexis Hénaut
5 | Description: language definition for Dockerfile files
6 | Website: https://docs.docker.com/engine/reference/builder/
7 | Category: config
8 | */
9 |
10 | export default function(hljs) {
11 | return {
12 | name: 'Dockerfile',
13 | aliases: ['docker'],
14 | case_insensitive: true,
15 | keywords: 'from maintainer expose env arg user onbuild stopsignal',
16 | contains: [
17 | hljs.HASH_COMMENT_MODE,
18 | hljs.APOS_STRING_MODE,
19 | hljs.QUOTE_STRING_MODE,
20 | hljs.NUMBER_MODE,
21 | {
22 | beginKeywords: 'run cmd entrypoint volume add copy workdir label healthcheck shell',
23 | starts: {
24 | end: /[^\\]$/,
25 | subLanguage: 'bash'
26 | }
27 | }
28 | ],
29 | illegal: ''
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/parse/highlight/languages/dos.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Batch file (DOS)
3 | Author: Alexander Makarov
4 | Contributors: Anton Kochkov
5 | Website: https://en.wikipedia.org/wiki/Batch_file
6 | */
7 |
8 | export default function(hljs) {
9 | var COMMENT = hljs.COMMENT(
10 | /^\s*@?rem\b/, /$/,
11 | {
12 | relevance: 10
13 | }
14 | );
15 | var LABEL = {
16 | className: 'symbol',
17 | begin: '^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)',
18 | relevance: 0
19 | };
20 | return {
21 | name: 'Batch file (DOS)',
22 | aliases: ['bat', 'cmd'],
23 | case_insensitive: true,
24 | illegal: /\/\*/,
25 | keywords: {
26 | keyword:
27 | 'if else goto for in do call exit not exist errorlevel defined ' +
28 | 'equ neq lss leq gtr geq',
29 | built_in:
30 | 'prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux ' +
31 | 'shift cd dir echo setlocal endlocal set pause copy ' +
32 | 'append assoc at attrib break cacls cd chcp chdir chkdsk chkntfs cls cmd color ' +
33 | 'comp compact convert date dir diskcomp diskcopy doskey erase fs ' +
34 | 'find findstr format ftype graftabl help keyb label md mkdir mode more move path ' +
35 | 'pause print popd pushd promt rd recover rem rename replace restore rmdir shift ' +
36 | 'sort start subst time title tree type ver verify vol ' +
37 | // winutils
38 | 'ping net ipconfig taskkill xcopy ren del'
39 | },
40 | contains: [
41 | {
42 | className: 'variable', begin: /%%[^ ]|%[^ ]+?%|![^ ]+?!/
43 | },
44 | {
45 | className: 'function',
46 | begin: LABEL.begin, end: 'goto:eof',
47 | contains: [
48 | hljs.inherit(hljs.TITLE_MODE, {begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*'}),
49 | COMMENT
50 | ]
51 | },
52 | {
53 | className: 'number', begin: '\\b\\d+',
54 | relevance: 0
55 | },
56 | COMMENT
57 | ]
58 | };
59 | }
60 |
--------------------------------------------------------------------------------
/parse/highlight/languages/dsconfig.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: dsconfig
3 | Description: dsconfig batch configuration language for LDAP directory servers
4 | Contributors: Jacob Childress
5 | Category: enterprise, config
6 | */
7 | export default function(hljs) {
8 | var QUOTED_PROPERTY = {
9 | className: 'string',
10 | begin: /"/, end: /"/
11 | };
12 | var APOS_PROPERTY = {
13 | className: 'string',
14 | begin: /'/, end: /'/
15 | };
16 | var UNQUOTED_PROPERTY = {
17 | className: 'string',
18 | begin: '[\\w-?]+:\\w+', end: '\\W',
19 | relevance: 0
20 | };
21 | var VALUELESS_PROPERTY = {
22 | className: 'string',
23 | begin: '\\w+-?\\w+', end: '\\W',
24 | relevance: 0
25 | };
26 |
27 | return {
28 | keywords: 'dsconfig',
29 | contains: [
30 | {
31 | className: 'keyword',
32 | begin: '^dsconfig', end: '\\s', excludeEnd: true,
33 | relevance: 10
34 | },
35 | {
36 | className: 'built_in',
37 | begin: '(list|create|get|set|delete)-(\\w+)', end: '\\s', excludeEnd: true,
38 | illegal: '!@#$%^&*()',
39 | relevance: 10
40 | },
41 | {
42 | className: 'built_in',
43 | begin: '--(\\w+)', end: '\\s', excludeEnd: true
44 | },
45 | QUOTED_PROPERTY,
46 | APOS_PROPERTY,
47 | UNQUOTED_PROPERTY,
48 | VALUELESS_PROPERTY,
49 | hljs.HASH_COMMENT_MODE
50 | ]
51 | };
52 | }
53 |
--------------------------------------------------------------------------------
/parse/highlight/languages/dust.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Dust
3 | Requires: xml.js
4 | Author: Michael Allen
5 | Description: Matcher for dust.js templates.
6 | Website: https://www.dustjs.com
7 | Category: template
8 | */
9 |
10 | export default function(hljs) {
11 | var EXPRESSION_KEYWORDS = 'if eq ne lt lte gt gte select default math sep';
12 | return {
13 | name: 'Dust',
14 | aliases: ['dst'],
15 | case_insensitive: true,
16 | subLanguage: 'xml',
17 | contains: [
18 | {
19 | className: 'template-tag',
20 | begin: /\{[#\/]/, end: /\}/, illegal: /;/,
21 | contains: [
22 | {
23 | className: 'name',
24 | begin: /[a-zA-Z\.-]+/,
25 | starts: {
26 | endsWithParent: true, relevance: 0,
27 | contains: [
28 | hljs.QUOTE_STRING_MODE
29 | ]
30 | }
31 | }
32 | ]
33 | },
34 | {
35 | className: 'template-variable',
36 | begin: /\{/, end: /\}/, illegal: /;/,
37 | keywords: EXPRESSION_KEYWORDS
38 | }
39 | ]
40 | };
41 | }
42 |
--------------------------------------------------------------------------------
/parse/highlight/languages/ebnf.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Extended Backus-Naur Form
3 | Author: Alex McKibben
4 | Website: https://en.wikipedia.org/wiki/Extended_Backus–Naur_form
5 | */
6 |
7 | export default function(hljs) {
8 | var commentMode = hljs.COMMENT(/\(\*/, /\*\)/);
9 |
10 | var nonTerminalMode = {
11 | className: "attribute",
12 | begin: /^[ ]*[a-zA-Z][a-zA-Z-_]*([\s-_]+[a-zA-Z][a-zA-Z]*)*/
13 | };
14 |
15 | var specialSequenceMode = {
16 | className: "meta",
17 | begin: /\?.*\?/
18 | };
19 |
20 | var ruleBodyMode = {
21 | begin: /=/, end: /[.;]/,
22 | contains: [
23 | commentMode,
24 | specialSequenceMode,
25 | {
26 | // terminals
27 | className: 'string',
28 | variants: [
29 | hljs.APOS_STRING_MODE,
30 | hljs.QUOTE_STRING_MODE,
31 | {begin: '`', end: '`'},
32 | ]
33 | },
34 | ]
35 | };
36 |
37 | return {
38 | name: 'Extended Backus-Naur Form',
39 | illegal: /\S/,
40 | contains: [
41 | commentMode,
42 | nonTerminalMode,
43 | ruleBodyMode
44 | ]
45 | };
46 | }
47 |
--------------------------------------------------------------------------------
/parse/highlight/languages/elm.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Elm
3 | Author: Janis Voigtlaender
4 | Website: https://elm-lang.org
5 | Category: functional
6 | */
7 |
8 | export default function(hljs) {
9 | var COMMENT = {
10 | variants: [
11 | hljs.COMMENT('--', '$'),
12 | hljs.COMMENT(
13 | '{-',
14 | '-}',
15 | {
16 | contains: ['self']
17 | }
18 | )
19 | ]
20 | };
21 |
22 | var CONSTRUCTOR = {
23 | className: 'type',
24 | begin: '\\b[A-Z][\\w\']*', // TODO: other constructors (built-in, infix).
25 | relevance: 0
26 | };
27 |
28 | var LIST = {
29 | begin: '\\(', end: '\\)',
30 | illegal: '"',
31 | contains: [
32 | {className: 'type', begin: '\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?'},
33 | COMMENT
34 | ]
35 | };
36 |
37 | var RECORD = {
38 | begin: '{', end: '}',
39 | contains: LIST.contains
40 | };
41 |
42 | var CHARACTER = {
43 | className: 'string',
44 | begin: '\'\\\\?.', end: '\'',
45 | illegal: '.'
46 | };
47 |
48 | return {
49 | name: 'Elm',
50 | keywords:
51 | 'let in if then else case of where module import exposing ' +
52 | 'type alias as infix infixl infixr port effect command subscription',
53 | contains: [
54 |
55 | // Top-level constructions.
56 |
57 | {
58 | beginKeywords: 'port effect module', end: 'exposing',
59 | keywords: 'port effect module where command subscription exposing',
60 | contains: [LIST, COMMENT],
61 | illegal: '\\W\\.|;'
62 | },
63 | {
64 | begin: 'import', end: '$',
65 | keywords: 'import as exposing',
66 | contains: [LIST, COMMENT],
67 | illegal: '\\W\\.|;'
68 | },
69 | {
70 | begin: 'type', end: '$',
71 | keywords: 'type alias',
72 | contains: [CONSTRUCTOR, LIST, RECORD, COMMENT]
73 | },
74 | {
75 | beginKeywords: 'infix infixl infixr', end: '$',
76 | contains: [hljs.C_NUMBER_MODE, COMMENT]
77 | },
78 | {
79 | begin: 'port', end: '$',
80 | keywords: 'port',
81 | contains: [COMMENT]
82 | },
83 |
84 | // Literals and names.
85 |
86 | CHARACTER,
87 | hljs.QUOTE_STRING_MODE,
88 | hljs.C_NUMBER_MODE,
89 | CONSTRUCTOR,
90 | hljs.inherit(hljs.TITLE_MODE, {begin: '^[_a-z][\\w\']*'}),
91 | COMMENT,
92 |
93 | {begin: '->|<-'} // No markup, relevance booster
94 | ],
95 | illegal: /;/
96 | };
97 | }
98 |
--------------------------------------------------------------------------------
/parse/highlight/languages/erb.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: ERB (Embedded Ruby)
3 | Requires: xml.js, ruby.js
4 | Author: Lucas Mazza
5 | Contributors: Kassio Borges
6 | Description: "Bridge" language defining fragments of Ruby in HTML within <% .. %>
7 | Website: https://ruby-doc.org/stdlib-2.6.5/libdoc/erb/rdoc/ERB.html
8 | Category: template
9 | */
10 |
11 | export default function(hljs) {
12 | return {
13 | name: 'ERB',
14 | subLanguage: 'xml',
15 | contains: [
16 | hljs.COMMENT('<%#', '%>'),
17 | {
18 | begin: '<%[%=-]?', end: '[%-]?%>',
19 | subLanguage: 'ruby',
20 | excludeBegin: true,
21 | excludeEnd: true
22 | }
23 | ]
24 | };
25 | }
26 |
--------------------------------------------------------------------------------
/parse/highlight/languages/erlang-repl.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Erlang REPL
3 | Author: Sergey Ignatov
4 | Website: https://www.erlang.org
5 | Category: functional
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Erlang REPL',
11 | keywords: {
12 | built_in:
13 | 'spawn spawn_link self',
14 | keyword:
15 | 'after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if ' +
16 | 'let not of or orelse|10 query receive rem try when xor'
17 | },
18 | contains: [
19 | {
20 | className: 'meta', begin: '^[0-9]+> ',
21 | relevance: 10
22 | },
23 | hljs.COMMENT('%', '$'),
24 | {
25 | className: 'number',
26 | begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)',
27 | relevance: 0
28 | },
29 | hljs.APOS_STRING_MODE,
30 | hljs.QUOTE_STRING_MODE,
31 | {
32 | begin: '\\?(::)?([A-Z]\\w*(::)?)+'
33 | },
34 | {
35 | begin: '->'
36 | },
37 | {
38 | begin: 'ok'
39 | },
40 | {
41 | begin: '!'
42 | },
43 | {
44 | begin: '(\\b[a-z\'][a-zA-Z0-9_\']*:[a-z\'][a-zA-Z0-9_\']*)|(\\b[a-z\'][a-zA-Z0-9_\']*)',
45 | relevance: 0
46 | },
47 | {
48 | begin: '[A-Z][a-zA-Z0-9_\']*',
49 | relevance: 0
50 | }
51 | ]
52 | };
53 | }
54 |
--------------------------------------------------------------------------------
/parse/highlight/languages/fix.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: FIX
3 | Author: Brent Bradbury
4 | */
5 |
6 | export default function(hljs) {
7 | return {
8 | name: 'FIX',
9 | contains: [
10 | {
11 | begin: /[^\u2401\u0001]+/,
12 | end: /[\u2401\u0001]/,
13 | excludeEnd: true,
14 | returnBegin: true,
15 | returnEnd: false,
16 | contains: [
17 | {
18 | begin: /([^\u2401\u0001=]+)/,
19 | end: /=([^\u2401\u0001=]+)/,
20 | returnEnd: true,
21 | returnBegin: false,
22 | className: 'attr'
23 | },
24 | {
25 | begin: /=/,
26 | end: /([\u2401\u0001])/,
27 | excludeEnd: true,
28 | excludeBegin: true,
29 | className: 'string'
30 | }]
31 | }],
32 | case_insensitive: true
33 | };
34 | }
35 |
--------------------------------------------------------------------------------
/parse/highlight/languages/flix.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Flix
3 | Category: functional
4 | Author: Magnus Madsen
5 | Website: https://flix.dev/
6 | */
7 |
8 | export default function (hljs) {
9 |
10 | var CHAR = {
11 | className: 'string',
12 | begin: /'(.|\\[xXuU][a-zA-Z0-9]+)'/
13 | };
14 |
15 | var STRING = {
16 | className: 'string',
17 | variants: [
18 | {
19 | begin: '"', end: '"'
20 | }
21 | ]
22 | };
23 |
24 | var NAME = {
25 | className: 'title',
26 | begin: /[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/
27 | };
28 |
29 | var METHOD = {
30 | className: 'function',
31 | beginKeywords: 'def',
32 | end: /[:={\[(\n;]/,
33 | excludeEnd: true,
34 | contains: [NAME]
35 | };
36 |
37 | return {
38 | name: 'Flix',
39 | keywords: {
40 | literal: 'true false',
41 | keyword: 'case class def else enum if impl import in lat rel index let match namespace switch type yield with'
42 | },
43 | contains: [
44 | hljs.C_LINE_COMMENT_MODE,
45 | hljs.C_BLOCK_COMMENT_MODE,
46 | CHAR,
47 | STRING,
48 | METHOD,
49 | hljs.C_NUMBER_MODE
50 | ]
51 | };
52 | }
53 |
--------------------------------------------------------------------------------
/parse/highlight/languages/fsharp.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: F#
3 | Author: Jonas Follesø
4 | Contributors: Troy Kershaw , Henrik Feldt
5 | Website: https://docs.microsoft.com/en-us/dotnet/fsharp/
6 | Category: functional
7 | */
8 | export default function(hljs) {
9 | var TYPEPARAM = {
10 | begin: '<', end: '>',
11 | contains: [
12 | hljs.inherit(hljs.TITLE_MODE, {begin: /'[a-zA-Z0-9_]+/})
13 | ]
14 | };
15 |
16 | return {
17 | name: 'F#',
18 | aliases: ['fs'],
19 | keywords:
20 | 'abstract and as assert base begin class default delegate do done ' +
21 | 'downcast downto elif else end exception extern false finally for ' +
22 | 'fun function global if in inherit inline interface internal lazy let ' +
23 | 'match member module mutable namespace new null of open or ' +
24 | 'override private public rec return sig static struct then to ' +
25 | 'true try type upcast use val void when while with yield',
26 | illegal: /\/\*/,
27 | contains: [
28 | {
29 | // monad builder keywords (matches before non-bang kws)
30 | className: 'keyword',
31 | begin: /\b(yield|return|let|do)!/
32 | },
33 | {
34 | className: 'string',
35 | begin: '@"', end: '"',
36 | contains: [{begin: '""'}]
37 | },
38 | {
39 | className: 'string',
40 | begin: '"""', end: '"""'
41 | },
42 | hljs.COMMENT('\\(\\*', '\\*\\)'),
43 | {
44 | className: 'class',
45 | beginKeywords: 'type', end: '\\(|=|$', excludeEnd: true,
46 | contains: [
47 | hljs.UNDERSCORE_TITLE_MODE,
48 | TYPEPARAM
49 | ]
50 | },
51 | {
52 | className: 'meta',
53 | begin: '\\[<', end: '>\\]',
54 | relevance: 10
55 | },
56 | {
57 | className: 'symbol',
58 | begin: '\\B(\'[A-Za-z])\\b',
59 | contains: [hljs.BACKSLASH_ESCAPE]
60 | },
61 | hljs.C_LINE_COMMENT_MODE,
62 | hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
63 | hljs.C_NUMBER_MODE
64 | ]
65 | };
66 | }
67 |
--------------------------------------------------------------------------------
/parse/highlight/languages/gherkin.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Gherkin
3 | Author: Sam Pikesley (@pikesley)
4 | Description: Gherkin is the format for cucumber specifications. It is a domain specific language which helps you to describe business behavior without the need to go into detail of implementation.
5 | Website: https://cucumber.io/docs/gherkin/
6 | */
7 |
8 | export default function (hljs) {
9 | return {
10 | name: 'Gherkin',
11 | aliases: ['feature'],
12 | keywords: 'Feature Background Ability Business\ Need Scenario Scenarios Scenario\ Outline Scenario\ Template Examples Given And Then But When',
13 | contains: [
14 | {
15 | className: 'symbol',
16 | begin: '\\*',
17 | relevance: 0
18 | },
19 | {
20 | className: 'meta',
21 | begin: '@[^@\\s]+'
22 | },
23 | {
24 | begin: '\\|', end: '\\|\\w*$',
25 | contains: [
26 | {
27 | className: 'string',
28 | begin: '[^|]+'
29 | }
30 | ]
31 | },
32 | {
33 | className: 'variable',
34 | begin: '<', end: '>'
35 | },
36 | hljs.HASH_COMMENT_MODE,
37 | {
38 | className: 'string',
39 | begin: '"""', end: '"""'
40 | },
41 | hljs.QUOTE_STRING_MODE
42 | ]
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/parse/highlight/languages/go.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Go
3 | Author: Stephan Kountso aka StepLg
4 | Contributors: Evgeny Stepanischev
5 | Description: Google go language (golang). For info about language
6 | Website: http://golang.org/
7 | Category: common, system
8 | */
9 |
10 | export default function(hljs) {
11 | var GO_KEYWORDS = {
12 | keyword:
13 | 'break default func interface select case map struct chan else goto package switch ' +
14 | 'const fallthrough if range type continue for import return var go defer ' +
15 | 'bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 ' +
16 | 'uint16 uint32 uint64 int uint uintptr rune',
17 | literal:
18 | 'true false iota nil',
19 | built_in:
20 | 'append cap close complex copy imag len make new panic print println real recover delete'
21 | };
22 | return {
23 | name: 'Go',
24 | aliases: ['golang'],
25 | keywords: GO_KEYWORDS,
26 | illegal: '',
27 | contains: [
28 | hljs.C_LINE_COMMENT_MODE,
29 | hljs.C_BLOCK_COMMENT_MODE,
30 | {
31 | className: 'string',
32 | variants: [
33 | hljs.QUOTE_STRING_MODE,
34 | hljs.APOS_STRING_MODE,
35 | {begin: '`', end: '`'},
36 | ]
37 | },
38 | {
39 | className: 'number',
40 | variants: [
41 | {begin: hljs.C_NUMBER_RE + '[i]', relevance: 1},
42 | hljs.C_NUMBER_MODE
43 | ]
44 | },
45 | {
46 | begin: /:=/ // relevance booster
47 | },
48 | {
49 | className: 'function',
50 | beginKeywords: 'func', end: '\\s*(\\{|$)', excludeEnd: true,
51 | contains: [
52 | hljs.TITLE_MODE,
53 | {
54 | className: 'params',
55 | begin: /\(/, end: /\)/,
56 | keywords: GO_KEYWORDS,
57 | illegal: /["']/
58 | }
59 | ]
60 | }
61 | ]
62 | };
63 | }
64 |
--------------------------------------------------------------------------------
/parse/highlight/languages/golo.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Golo
3 | Author: Philippe Charriere
4 | Description: a lightweight dynamic language for the JVM
5 | Website: http://golo-lang.org/
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Golo',
11 | keywords: {
12 | keyword:
13 | 'println readln print import module function local return let var ' +
14 | 'while for foreach times in case when match with break continue ' +
15 | 'augment augmentation each find filter reduce ' +
16 | 'if then else otherwise try catch finally raise throw orIfNull ' +
17 | 'DynamicObject|10 DynamicVariable struct Observable map set vector list array',
18 | literal:
19 | 'true false null'
20 | },
21 | contains: [
22 | hljs.HASH_COMMENT_MODE,
23 | hljs.QUOTE_STRING_MODE,
24 | hljs.C_NUMBER_MODE,
25 | {
26 | className: 'meta', begin: '@[A-Za-z]+'
27 | }
28 | ]
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/parse/highlight/languages/gradle.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Gradle
3 | Description: Gradle is an open-source build automation tool focused on flexibility and performance.
4 | Website: https://gradle.org
5 | Author: Damian Mee
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Gradle',
11 | case_insensitive: true,
12 | keywords: {
13 | keyword:
14 | 'task project allprojects subprojects artifacts buildscript configurations ' +
15 | 'dependencies repositories sourceSets description delete from into include ' +
16 | 'exclude source classpath destinationDir includes options sourceCompatibility ' +
17 | 'targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant ' +
18 | 'def abstract break case catch continue default do else extends final finally ' +
19 | 'for if implements instanceof native new private protected public return static ' +
20 | 'switch synchronized throw throws transient try volatile while strictfp package ' +
21 | 'import false null super this true antlrtask checkstyle codenarc copy boolean ' +
22 | 'byte char class double float int interface long short void compile runTime ' +
23 | 'file fileTree abs any append asList asWritable call collect compareTo count ' +
24 | 'div dump each eachByte eachFile eachLine every find findAll flatten getAt ' +
25 | 'getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods ' +
26 | 'isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter ' +
27 | 'newReader newWriter next plus pop power previous print println push putAt read ' +
28 | 'readBytes readLines reverse reverseEach round size sort splitEachLine step subMap ' +
29 | 'times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader ' +
30 | 'withStream withWriter withWriterAppend write writeLine'
31 | },
32 | contains: [
33 | hljs.C_LINE_COMMENT_MODE,
34 | hljs.C_BLOCK_COMMENT_MODE,
35 | hljs.APOS_STRING_MODE,
36 | hljs.QUOTE_STRING_MODE,
37 | hljs.NUMBER_MODE,
38 | hljs.REGEXP_MODE
39 |
40 | ]
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/parse/highlight/languages/htmlbars.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: HTMLBars
3 | Requires: xml.js
4 | Author: Michael Johnston
5 | Description: Matcher for HTMLBars
6 | Website: https://github.com/tildeio/htmlbars
7 | Category: template
8 | */
9 |
10 | export default function(hljs) {
11 | var BUILT_INS = 'action collection component concat debugger each each-in else get hash if input link-to loc log mut outlet partial query-params render textarea unbound unless with yield view';
12 |
13 | var ATTR_ASSIGNMENT = {
14 | illegal: /\}\}/,
15 | begin: /[a-zA-Z0-9_]+=/,
16 | returnBegin: true,
17 | relevance: 0,
18 | contains: [
19 | {
20 | className: 'attr', begin: /[a-zA-Z0-9_]+/
21 | }
22 | ]
23 | };
24 |
25 | var SUB_EXPR = {
26 | illegal: /\}\}/,
27 | begin: /\)/, end: /\)/,
28 | contains: [
29 | {
30 | begin: /[a-zA-Z\.\-]+/,
31 | keywords: {built_in: BUILT_INS},
32 | starts: {
33 | endsWithParent: true, relevance: 0,
34 | contains: [
35 | hljs.QUOTE_STRING_MODE,
36 | ]
37 | }
38 | }
39 | ]
40 | };
41 |
42 | var TAG_INNARDS = {
43 | endsWithParent: true, relevance: 0,
44 | keywords: {keyword: 'as', built_in: BUILT_INS},
45 | contains: [
46 | hljs.QUOTE_STRING_MODE,
47 | ATTR_ASSIGNMENT,
48 | hljs.NUMBER_MODE
49 | ]
50 | };
51 |
52 | return {
53 | name: 'HTMLBars',
54 | case_insensitive: true,
55 | subLanguage: 'xml',
56 | contains: [
57 | hljs.COMMENT('{{!(--)?', '(--)?}}'),
58 | {
59 | className: 'template-tag',
60 | begin: /\{\{[#\/]/, end: /\}\}/,
61 | contains: [
62 | {
63 | className: 'name',
64 | begin: /[a-zA-Z\.\-]+/,
65 | keywords: {'builtin-name': BUILT_INS},
66 | starts: TAG_INNARDS
67 | }
68 | ]
69 | },
70 | {
71 | className: 'template-variable',
72 | begin: /\{\{[a-zA-Z][a-zA-Z\-]+/, end: /\}\}/,
73 | keywords: {keyword: 'as', built_in: BUILT_INS},
74 | contains: [
75 | hljs.QUOTE_STRING_MODE
76 | ]
77 | }
78 | ]
79 | };
80 | }
81 |
--------------------------------------------------------------------------------
/parse/highlight/languages/http.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: HTTP
3 | Description: HTTP request and response headers with automatic body highlighting
4 | Author: Ivan Sagalaev
5 | Category: common, protocols
6 | Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
7 | */
8 |
9 | export default function(hljs) {
10 | var VERSION = 'HTTP/[0-9\\.]+';
11 | return {
12 | name: 'HTTP',
13 | aliases: ['https'],
14 | illegal: '\\S',
15 | contains: [
16 | {
17 | begin: '^' + VERSION, end: '$',
18 | contains: [{className: 'number', begin: '\\b\\d{3}\\b'}]
19 | },
20 | {
21 | begin: '^[A-Z]+ (.*?) ' + VERSION + '$', returnBegin: true, end: '$',
22 | contains: [
23 | {
24 | className: 'string',
25 | begin: ' ', end: ' ',
26 | excludeBegin: true, excludeEnd: true
27 | },
28 | {
29 | begin: VERSION
30 | },
31 | {
32 | className: 'keyword',
33 | begin: '[A-Z]+'
34 | }
35 | ]
36 | },
37 | {
38 | className: 'attribute',
39 | begin: '^\\w', end: ': ', excludeEnd: true,
40 | illegal: '\\n|\\s|=',
41 | starts: {end: '$', relevance: 0}
42 | },
43 | {
44 | begin: '\\n\\n',
45 | starts: {subLanguage: [], endsWithParent: true}
46 | }
47 | ]
48 | };
49 | }
50 |
--------------------------------------------------------------------------------
/parse/highlight/languages/inform7.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Inform 7
3 | Author: Bruno Dias
4 | Description: Language definition for Inform 7, a DSL for writing parser interactive fiction.
5 | Website: http://inform7.com
6 | */
7 |
8 | export default function(hljs) {
9 | var START_BRACKET = '\\[';
10 | var END_BRACKET = '\\]';
11 | return {
12 | name: 'Inform 7',
13 | aliases: ['i7'],
14 | case_insensitive: true,
15 | keywords: {
16 | // Some keywords more or less unique to I7, for relevance.
17 | keyword:
18 | // kind:
19 | 'thing room person man woman animal container ' +
20 | 'supporter backdrop door ' +
21 | // characteristic:
22 | 'scenery open closed locked inside gender ' +
23 | // verb:
24 | 'is are say understand ' +
25 | // misc keyword:
26 | 'kind of rule'
27 | },
28 | contains: [
29 | {
30 | className: 'string',
31 | begin: '"', end: '"',
32 | relevance: 0,
33 | contains: [
34 | {
35 | className: 'subst',
36 | begin: START_BRACKET, end: END_BRACKET
37 | }
38 | ]
39 | },
40 | {
41 | className: 'section',
42 | begin: /^(Volume|Book|Part|Chapter|Section|Table)\b/,
43 | end: '$'
44 | },
45 | {
46 | // Rule definition
47 | // This is here for relevance.
48 | begin: /^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,
49 | end: ':',
50 | contains: [
51 | {
52 | //Rule name
53 | begin: '\\(This', end: '\\)'
54 | }
55 | ]
56 | },
57 | {
58 | className: 'comment',
59 | begin: START_BRACKET, end: END_BRACKET,
60 | contains: ['self']
61 | }
62 | ]
63 | };
64 | }
65 |
--------------------------------------------------------------------------------
/parse/highlight/languages/ini.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: TOML, also INI
3 | Description: TOML aims to be a minimal configuration file format that's easy to read due to obvious semantics.
4 | Contributors: Guillaume Gomez
5 | Category: common, config
6 | Website: https://github.com/toml-lang/toml
7 | */
8 |
9 | export default function(hljs) {
10 | var NUMBERS = {
11 | className: 'number',
12 | relevance: 0,
13 | variants: [
14 | { begin: /([\+\-]+)?[\d]+_[\d_]+/ },
15 | { begin: hljs.NUMBER_RE }
16 | ]
17 | };
18 | var COMMENTS = hljs.COMMENT();
19 | COMMENTS.variants = [
20 | {begin: /;/, end: /$/},
21 | {begin: /#/, end: /$/},
22 | ];
23 | var VARIABLES = {
24 | className: 'variable',
25 | variants: [
26 | { begin: /\$[\w\d"][\w\d_]*/ },
27 | { begin: /\$\{(.*?)}/ }
28 | ]
29 | };
30 | var LITERALS = {
31 | className: 'literal',
32 | begin: /\bon|off|true|false|yes|no\b/
33 | };
34 | var STRINGS = {
35 | className: "string",
36 | contains: [hljs.BACKSLASH_ESCAPE],
37 | variants: [
38 | { begin: "'''", end: "'''", relevance: 10 },
39 | { begin: '"""', end: '"""', relevance: 10 },
40 | { begin: '"', end: '"' },
41 | { begin: "'", end: "'" }
42 | ]
43 | };
44 | var ARRAY = {
45 | begin: /\[/, end: /\]/,
46 | contains: [
47 | COMMENTS,
48 | LITERALS,
49 | VARIABLES,
50 | STRINGS,
51 | NUMBERS,
52 | 'self'
53 | ],
54 | relevance:0
55 | };
56 |
57 | return {
58 | name: 'TOML, also INI',
59 | aliases: ['toml'],
60 | case_insensitive: true,
61 | illegal: /\S/,
62 | contains: [
63 | COMMENTS,
64 | {
65 | className: 'section',
66 | begin: /\[+/, end: /\]+/
67 | },
68 | {
69 | begin: /^[a-z0-9\[\]_\.-]+(?=\s*=\s*)/,
70 | className: 'attr',
71 | starts: {
72 | end: /$/,
73 | contains: [
74 | COMMENTS,
75 | ARRAY,
76 | LITERALS,
77 | VARIABLES,
78 | STRINGS,
79 | NUMBERS
80 | ]
81 | }
82 | }
83 | ]
84 | };
85 | }
86 |
--------------------------------------------------------------------------------
/parse/highlight/languages/jboss-cli.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: JBoss CLI
3 | Author: Raphaël Parrëe
4 | Description: language definition jboss cli
5 | Website: https://docs.jboss.org/author/display/WFLY/Command+Line+Interface
6 | Category: config
7 | */
8 |
9 | export default function (hljs) {
10 | var PARAM = {
11 | begin: /[\w-]+ *=/, returnBegin: true,
12 | relevance: 0,
13 | contains: [{className: 'attr', begin: /[\w-]+/}]
14 | };
15 | var PARAMSBLOCK = {
16 | className: 'params',
17 | begin: /\(/,
18 | end: /\)/,
19 | contains: [PARAM],
20 | relevance : 0
21 | };
22 | var OPERATION = {
23 | className: 'function',
24 | begin: /:[\w\-.]+/,
25 | relevance: 0
26 | };
27 | var PATH = {
28 | className: 'string',
29 | begin: /\B(([\/.])[\w\-.\/=]+)+/,
30 | };
31 | var COMMAND_PARAMS = {
32 | className: 'params',
33 | begin: /--[\w\-=\/]+/,
34 | };
35 | return {
36 | name: 'JBoss CLI',
37 | aliases: ['wildfly-cli'],
38 | lexemes: '[a-z\-]+',
39 | keywords: {
40 | keyword: 'alias batch cd clear command connect connection-factory connection-info data-source deploy ' +
41 | 'deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue|20 jms-topic|20 ls ' +
42 | 'patch pwd quit read-attribute read-operation reload rollout-plan run-batch set shutdown try unalias ' +
43 | 'undeploy unset version xa-data-source', // module
44 | literal: 'true false'
45 | },
46 | contains: [
47 | hljs.HASH_COMMENT_MODE,
48 | hljs.QUOTE_STRING_MODE,
49 | COMMAND_PARAMS,
50 | OPERATION,
51 | PATH,
52 | PARAMSBLOCK
53 | ]
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/parse/highlight/languages/json.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: JSON
3 | Description: JSON (JavaScript Object Notation) is a lightweight data-interchange format.
4 | Author: Ivan Sagalaev
5 | Website: http://www.json.org
6 | Category: common, protocols
7 | */
8 |
9 | export default function(hljs) {
10 | var LITERALS = {literal: 'true false null'};
11 | var ALLOWED_COMMENTS = [
12 | hljs.C_LINE_COMMENT_MODE,
13 | hljs.C_BLOCK_COMMENT_MODE
14 | ]
15 | var TYPES = [
16 | hljs.QUOTE_STRING_MODE,
17 | hljs.C_NUMBER_MODE
18 | ];
19 | var VALUE_CONTAINER = {
20 | end: ',', endsWithParent: true, excludeEnd: true,
21 | contains: TYPES,
22 | keywords: LITERALS
23 | };
24 | var OBJECT = {
25 | begin: '{', end: '}',
26 | contains: [
27 | {
28 | className: 'attr',
29 | begin: /"/, end: /"/,
30 | contains: [hljs.BACKSLASH_ESCAPE],
31 | illegal: '\\n',
32 | },
33 | hljs.inherit(VALUE_CONTAINER, {begin: /:/})
34 | ].concat(ALLOWED_COMMENTS),
35 | illegal: '\\S'
36 | };
37 | var ARRAY = {
38 | begin: '\\[', end: '\\]',
39 | contains: [hljs.inherit(VALUE_CONTAINER)], // inherit is a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents
40 | illegal: '\\S'
41 | };
42 | TYPES.push(OBJECT, ARRAY);
43 | ALLOWED_COMMENTS.forEach(function(rule) {
44 | TYPES.push(rule)
45 | })
46 | return {
47 | name: 'JSON',
48 | contains: TYPES,
49 | keywords: LITERALS,
50 | illegal: '\\S'
51 | };
52 | }
53 |
--------------------------------------------------------------------------------
/parse/highlight/languages/julia-repl.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Julia REPL
3 | Description: Julia REPL sessions
4 | Author: Morten Piibeleht
5 | Website: https://julialang.org
6 | Requires: julia.js
7 |
8 | The Julia REPL code blocks look something like the following:
9 |
10 | julia> function foo(x)
11 | x + 1
12 | end
13 | foo (generic function with 1 method)
14 |
15 | They start on a new line with "julia>". Usually there should also be a space after this, but
16 | we also allow the code to start right after the > character. The code may run over multiple
17 | lines, but the additional lines must start with six spaces (i.e. be indented to match
18 | "julia>"). The rest of the code is assumed to be output from the executed code and will be
19 | left un-highlighted.
20 |
21 | Using simply spaces to identify line continuations may get a false-positive if the output
22 | also prints out six spaces, but such cases should be rare.
23 | */
24 |
25 | export default function(hljs) {
26 | return {
27 | name: 'Julia REPL',
28 | contains: [
29 | {
30 | className: 'meta',
31 | begin: /^julia>/,
32 | relevance: 10,
33 | starts: {
34 | // end the highlighting if we are on a new line and the line does not have at
35 | // least six spaces in the beginning
36 | end: /^(?![ ]{6})/,
37 | subLanguage: 'julia'
38 | },
39 | // jldoctest Markdown blocks are used in the Julia manual and package docs indicate
40 | // code snippets that should be verified when the documentation is built. They can be
41 | // either REPL-like or script-like, but are usually REPL-like and therefore we apply
42 | // julia-repl highlighting to them. More information can be found in Documenter's
43 | // manual: https://juliadocs.github.io/Documenter.jl/latest/man/doctests.html
44 | aliases: ['jldoctest']
45 | }
46 | ]
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/parse/highlight/languages/latex.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: LaTeX
3 | Author: Vladimir Moskva
4 | Website: https://www.latex-project.org
5 | Category: markup
6 | */
7 |
8 | export default function(hljs) {
9 | var COMMAND = {
10 | className: 'tag',
11 | begin: /\\/,
12 | relevance: 0,
13 | contains: [
14 | {
15 | className: 'name',
16 | variants: [
17 | {begin: /[a-zA-Z\u0430-\u044f\u0410-\u042f]+[*]?/},
18 | {begin: /[^a-zA-Z\u0430-\u044f\u0410-\u042f0-9]/}
19 | ],
20 | starts: {
21 | endsWithParent: true,
22 | relevance: 0,
23 | contains: [
24 | {
25 | className: 'string', // because it looks like attributes in HTML tags
26 | variants: [
27 | {begin: /\[/, end: /\]/},
28 | {begin: /\{/, end: /\}/}
29 | ]
30 | },
31 | {
32 | begin: /\s*=\s*/, endsWithParent: true,
33 | relevance: 0,
34 | contains: [
35 | {
36 | className: 'number',
37 | begin: /-?\d*\.?\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?/
38 | }
39 | ]
40 | }
41 | ]
42 | }
43 | }
44 | ]
45 | };
46 |
47 | return {
48 | name: 'LaTeX',
49 | aliases: ['tex'],
50 | contains: [
51 | COMMAND,
52 | {
53 | className: 'formula',
54 | contains: [COMMAND],
55 | relevance: 0,
56 | variants: [
57 | {begin: /\$\$/, end: /\$\$/},
58 | {begin: /\$/, end: /\$/}
59 | ]
60 | },
61 | hljs.COMMENT(
62 | '%',
63 | '$',
64 | {
65 | relevance: 0
66 | }
67 | )
68 | ]
69 | };
70 | }
71 |
--------------------------------------------------------------------------------
/parse/highlight/languages/ldif.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: LDIF
3 | Contributors: Jacob Childress
4 | Category: enterprise, config
5 | Website: https://en.wikipedia.org/wiki/LDAP_Data_Interchange_Format
6 | */
7 | export default function(hljs) {
8 | return {
9 | name: 'LDIF',
10 | contains: [
11 | {
12 | className: 'attribute',
13 | begin: '^dn', end: ': ', excludeEnd: true,
14 | starts: {end: '$', relevance: 0},
15 | relevance: 10
16 | },
17 | {
18 | className: 'attribute',
19 | begin: '^\\w', end: ': ', excludeEnd: true,
20 | starts: {end: '$', relevance: 0}
21 | },
22 | {
23 | className: 'literal',
24 | begin: '^-', end: '$'
25 | },
26 | hljs.HASH_COMMENT_MODE
27 | ]
28 | };
29 | }
30 |
--------------------------------------------------------------------------------
/parse/highlight/languages/leaf.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Leaf
3 | Author: Hale Chan
4 | Description: Based on the Leaf reference from https://vapor.github.io/documentation/guide/leaf.html.
5 | */
6 |
7 | export default function (hljs) {
8 | return {
9 | name: 'Leaf',
10 | contains: [
11 | {
12 | className: 'function',
13 | begin: '#+' + '[A-Za-z_0-9]*' + '\\(',
14 | end:' {',
15 | returnBegin: true,
16 | excludeEnd: true,
17 | contains : [
18 | {
19 | className: 'keyword',
20 | begin: '#+'
21 | },
22 | {
23 | className: 'title',
24 | begin: '[A-Za-z_][A-Za-z_0-9]*'
25 | },
26 | {
27 | className: 'params',
28 | begin: '\\(', end: '\\)',
29 | endsParent: true,
30 | contains: [
31 | {
32 | className: 'string',
33 | begin: '"',
34 | end: '"'
35 | },
36 | {
37 | className: 'variable',
38 | begin: '[A-Za-z_][A-Za-z_0-9]*'
39 | }
40 | ]
41 | }
42 | ]
43 | }
44 | ]
45 | };
46 | }
47 |
--------------------------------------------------------------------------------
/parse/highlight/languages/makefile.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Makefile
3 | Author: Ivan Sagalaev
4 | Contributors: Joël Porquet
5 | Website: https://www.gnu.org/software/make/manual/html_node/Introduction.html
6 | Category: common
7 | */
8 |
9 | export default function(hljs) {
10 | /* Variables: simple (eg $(var)) and special (eg $@) */
11 | var VARIABLE = {
12 | className: 'variable',
13 | variants: [
14 | {
15 | begin: '\\$\\(' + hljs.UNDERSCORE_IDENT_RE + '\\)',
16 | contains: [hljs.BACKSLASH_ESCAPE],
17 | },
18 | {
19 | begin: /\$[@%\^\+\*]/
20 | },
21 | ]
22 | };
23 | /* Quoted string with variables inside */
24 | var QUOTE_STRING = {
25 | className: 'string',
26 | begin: /"/, end: /"/,
27 | contains: [
28 | hljs.BACKSLASH_ESCAPE,
29 | VARIABLE,
30 | ]
31 | };
32 | /* Function: $(func arg,...) */
33 | var FUNC = {
34 | className: 'variable',
35 | begin: /\$\([\w-]+\s/, end: /\)/,
36 | keywords: {
37 | built_in:
38 | 'subst patsubst strip findstring filter filter-out sort ' +
39 | 'word wordlist firstword lastword dir notdir suffix basename ' +
40 | 'addsuffix addprefix join wildcard realpath abspath error warning ' +
41 | 'shell origin flavor foreach if or and call eval file value',
42 | },
43 | contains: [
44 | VARIABLE,
45 | ]
46 | };
47 | /* Variable assignment */
48 | var ASSIGNMENT = {
49 | begin: '^' + hljs.UNDERSCORE_IDENT_RE + '\\s*(?=[:+?]?=)'
50 | };
51 | /* Meta targets (.PHONY) */
52 | var META = {
53 | className: 'meta',
54 | begin: /^\.PHONY:/, end: /$/,
55 | keywords: {'meta-keyword': '.PHONY'},
56 | lexemes: /[\.\w]+/
57 | };
58 | /* Targets */
59 | var TARGET = {
60 | className: 'section',
61 | begin: /^[^\s]+:/, end: /$/,
62 | contains: [VARIABLE,]
63 | };
64 | return {
65 | name: 'Makefile',
66 | aliases: ['mk', 'mak'],
67 | keywords:
68 | 'define endef undefine ifdef ifndef ifeq ifneq else endif ' +
69 | 'include -include sinclude override export unexport private vpath',
70 | lexemes: /[\w-]+/,
71 | contains: [
72 | hljs.HASH_COMMENT_MODE,
73 | VARIABLE,
74 | QUOTE_STRING,
75 | FUNC,
76 | ASSIGNMENT,
77 | META,
78 | TARGET,
79 | ]
80 | };
81 | }
82 |
--------------------------------------------------------------------------------
/parse/highlight/languages/mizar.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Mizar
3 | Description: The Mizar Language is a formal language derived from the mathematical vernacular.
4 | Author: Kelley van Evert
5 | Website: http://mizar.org/language/
6 | Category: scientific
7 | */
8 |
9 | export default function(hljs) {
10 | return {
11 | name: 'Mizar',
12 | keywords:
13 | 'environ vocabularies notations constructors definitions ' +
14 | 'registrations theorems schemes requirements begin end definition ' +
15 | 'registration cluster existence pred func defpred deffunc theorem ' +
16 | 'proof let take assume then thus hence ex for st holds consider ' +
17 | 'reconsider such that and in provided of as from be being by means ' +
18 | 'equals implies iff redefine define now not or attr is mode ' +
19 | 'suppose per cases set thesis contradiction scheme reserve struct ' +
20 | 'correctness compatibility coherence symmetry assymetry ' +
21 | 'reflexivity irreflexivity connectedness uniqueness commutativity ' +
22 | 'idempotence involutiveness projectivity',
23 | contains: [
24 | hljs.COMMENT('::', '$')
25 | ]
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/parse/highlight/languages/mojolicious.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Mojolicious
3 | Requires: xml.js, perl.js
4 | Author: Dotan Dimet
5 | Description: Mojolicious .ep (Embedded Perl) templates
6 | Website: https://mojolicious.org
7 | Category: template
8 | */
9 | export default function(hljs) {
10 | return {
11 | name: 'Mojolicious',
12 | subLanguage: 'xml',
13 | contains: [
14 | {
15 | className: 'meta',
16 | begin: '^__(END|DATA)__$'
17 | },
18 | // mojolicious line
19 | {
20 | begin: "^\\s*%{1,2}={0,2}", end: '$',
21 | subLanguage: 'perl'
22 | },
23 | // mojolicious block
24 | {
25 | begin: "<%{1,2}={0,2}",
26 | end: "={0,1}%>",
27 | subLanguage: 'perl',
28 | excludeBegin: true,
29 | excludeEnd: true
30 | }
31 | ]
32 | };
33 | }
34 |
--------------------------------------------------------------------------------
/parse/highlight/languages/monkey.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Monkey
3 | Description: Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research.
4 | Author: Arthur Bikmullin
5 | Website: https://blitzresearch.itch.io/monkey2
6 | */
7 |
8 | export default function(hljs) {
9 | var NUMBER = {
10 | className: 'number', relevance: 0,
11 | variants: [
12 | {
13 | begin: '[$][a-fA-F0-9]+'
14 | },
15 | hljs.NUMBER_MODE
16 | ]
17 | };
18 |
19 | return {
20 | name: 'Monkey',
21 | case_insensitive: true,
22 | keywords: {
23 | keyword: 'public private property continue exit extern new try catch ' +
24 | 'eachin not abstract final select case default const local global field ' +
25 | 'end if then else elseif endif while wend repeat until forever for ' +
26 | 'to step next return module inline throw import',
27 |
28 | built_in: 'DebugLog DebugStop Error Print ACos ACosr ASin ASinr ATan ATan2 ATan2r ATanr Abs Abs Ceil ' +
29 | 'Clamp Clamp Cos Cosr Exp Floor Log Max Max Min Min Pow Sgn Sgn Sin Sinr Sqrt Tan Tanr Seed PI HALFPI TWOPI',
30 |
31 | literal: 'true false null and or shl shr mod'
32 | },
33 | illegal: /\/\*/,
34 | contains: [
35 | hljs.COMMENT('#rem', '#end'),
36 | hljs.COMMENT(
37 | "'",
38 | '$',
39 | {
40 | relevance: 0
41 | }
42 | ),
43 | {
44 | className: 'function',
45 | beginKeywords: 'function method', end: '[(=:]|$',
46 | illegal: /\n/,
47 | contains: [
48 | hljs.UNDERSCORE_TITLE_MODE
49 | ]
50 | },
51 | {
52 | className: 'class',
53 | beginKeywords: 'class interface', end: '$',
54 | contains: [
55 | {
56 | beginKeywords: 'extends implements'
57 | },
58 | hljs.UNDERSCORE_TITLE_MODE
59 | ]
60 | },
61 | {
62 | className: 'built_in',
63 | begin: '\\b(self|super)\\b'
64 | },
65 | {
66 | className: 'meta',
67 | begin: '\\s*#', end: '$',
68 | keywords: {'meta-keyword': 'if else elseif endif end then'}
69 | },
70 | {
71 | className: 'meta',
72 | begin: '^\\s*strict\\b'
73 | },
74 | {
75 | beginKeywords: 'alias', end: '=',
76 | contains: [hljs.UNDERSCORE_TITLE_MODE]
77 | },
78 | hljs.QUOTE_STRING_MODE,
79 | NUMBER
80 | ]
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/parse/highlight/languages/nim.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Nim
3 | Description: Nim is a statically typed compiled systems programming language.
4 | Website: https://nim-lang.org
5 | Category: system
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Nim',
11 | aliases: ['nim'],
12 | keywords: {
13 | keyword:
14 | 'addr and as asm bind block break case cast const continue converter ' +
15 | 'discard distinct div do elif else end enum except export finally ' +
16 | 'for from generic if import in include interface is isnot iterator ' +
17 | 'let macro method mixin mod nil not notin object of or out proc ptr ' +
18 | 'raise ref return shl shr static template try tuple type using var ' +
19 | 'when while with without xor yield',
20 | literal:
21 | 'shared guarded stdin stdout stderr result true false',
22 | built_in:
23 | 'int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float ' +
24 | 'float32 float64 bool char string cstring pointer expr stmt void ' +
25 | 'auto any range array openarray varargs seq set clong culong cchar ' +
26 | 'cschar cshort cint csize clonglong cfloat cdouble clongdouble ' +
27 | 'cuchar cushort cuint culonglong cstringarray semistatic'
28 | },
29 | contains: [ {
30 | className: 'meta', // Actually pragma
31 | begin: /{\./,
32 | end: /\.}/,
33 | relevance: 10
34 | }, {
35 | className: 'string',
36 | begin: /[a-zA-Z]\w*"/,
37 | end: /"/,
38 | contains: [{begin: /""/}]
39 | }, {
40 | className: 'string',
41 | begin: /([a-zA-Z]\w*)?"""/,
42 | end: /"""/
43 | },
44 | hljs.QUOTE_STRING_MODE,
45 | {
46 | className: 'type',
47 | begin: /\b[A-Z]\w+\b/,
48 | relevance: 0
49 | }, {
50 | className: 'number',
51 | relevance: 0,
52 | variants: [
53 | {begin: /\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?/},
54 | {begin: /\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?/},
55 | {begin: /\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?/},
56 | {begin: /\b(\d[_\d]*)('?[iIuUfF](8|16|32|64))?/}
57 | ]
58 | },
59 | hljs.HASH_COMMENT_MODE
60 | ]
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/parse/highlight/languages/nix.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Nix
3 | Author: Domen Kožar
4 | Description: Nix functional language
5 | Website: http://nixos.org/nix
6 | */
7 |
8 |
9 | export default function(hljs) {
10 | var NIX_KEYWORDS = {
11 | keyword:
12 | 'rec with let in inherit assert if else then',
13 | literal:
14 | 'true false or and null',
15 | built_in:
16 | 'import abort baseNameOf dirOf isNull builtins map removeAttrs throw ' +
17 | 'toString derivation'
18 | };
19 | var ANTIQUOTE = {
20 | className: 'subst',
21 | begin: /\$\{/,
22 | end: /}/,
23 | keywords: NIX_KEYWORDS
24 | };
25 | var ATTRS = {
26 | begin: /[a-zA-Z0-9-_]+(\s*=)/, returnBegin: true,
27 | relevance: 0,
28 | contains: [
29 | {
30 | className: 'attr',
31 | begin: /\S+/
32 | }
33 | ]
34 | };
35 | var STRING = {
36 | className: 'string',
37 | contains: [ANTIQUOTE],
38 | variants: [
39 | {begin: "''", end: "''"},
40 | {begin: '"', end: '"'}
41 | ]
42 | };
43 | var EXPRESSIONS = [
44 | hljs.NUMBER_MODE,
45 | hljs.HASH_COMMENT_MODE,
46 | hljs.C_BLOCK_COMMENT_MODE,
47 | STRING,
48 | ATTRS
49 | ];
50 | ANTIQUOTE.contains = EXPRESSIONS;
51 | return {
52 | name: 'Nix',
53 | aliases: ["nixos"],
54 | keywords: NIX_KEYWORDS,
55 | contains: EXPRESSIONS
56 | };
57 | }
58 |
--------------------------------------------------------------------------------
/parse/highlight/languages/openscad.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: OpenSCAD
3 | Author: Dan Panzarella
4 | Description: OpenSCAD is a language for the 3D CAD modeling software of the same name.
5 | Website: https://www.openscad.org
6 | Category: scientific
7 | */
8 |
9 | export default function(hljs) {
10 | var SPECIAL_VARS = {
11 | className: 'keyword',
12 | begin: '\\$(f[asn]|t|vp[rtd]|children)'
13 | },
14 | LITERALS = {
15 | className: 'literal',
16 | begin: 'false|true|PI|undef'
17 | },
18 | NUMBERS = {
19 | className: 'number',
20 | begin: '\\b\\d+(\\.\\d+)?(e-?\\d+)?', //adds 1e5, 1e-10
21 | relevance: 0
22 | },
23 | STRING = hljs.inherit(hljs.QUOTE_STRING_MODE,{illegal: null}),
24 | PREPRO = {
25 | className: 'meta',
26 | keywords: {'meta-keyword': 'include use'},
27 | begin: 'include|use <',
28 | end: '>'
29 | },
30 | PARAMS = {
31 | className: 'params',
32 | begin: '\\(', end: '\\)',
33 | contains: ['self', NUMBERS, STRING, SPECIAL_VARS, LITERALS]
34 | },
35 | MODIFIERS = {
36 | begin: '[*!#%]',
37 | relevance: 0
38 | },
39 | FUNCTIONS = {
40 | className: 'function',
41 | beginKeywords: 'module function',
42 | end: '\\=|\\{',
43 | contains: [PARAMS, hljs.UNDERSCORE_TITLE_MODE]
44 | };
45 |
46 | return {
47 | name: 'OpenSCAD',
48 | aliases: ['scad'],
49 | keywords: {
50 | keyword: 'function module include use for intersection_for if else \\%',
51 | literal: 'false true PI undef',
52 | built_in: 'circle square polygon text sphere cube cylinder polyhedron translate rotate scale resize mirror multmatrix color offset hull minkowski union difference intersection abs sign sin cos tan acos asin atan atan2 floor round ceil ln log pow sqrt exp rands min max concat lookup str chr search version version_num norm cross parent_module echo import import_dxf dxf_linear_extrude linear_extrude rotate_extrude surface projection render children dxf_cross dxf_dim let assign'
53 | },
54 | contains: [
55 | hljs.C_LINE_COMMENT_MODE,
56 | hljs.C_BLOCK_COMMENT_MODE,
57 | NUMBERS,
58 | PREPRO,
59 | STRING,
60 | SPECIAL_VARS,
61 | MODIFIERS,
62 | FUNCTIONS
63 | ]
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/parse/highlight/languages/parser3.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Parser3
3 | Requires: xml.js
4 | Author: Oleg Volchkov
5 | Website: https://www.parser.ru/en/
6 | Category: template
7 | */
8 |
9 | export default function(hljs) {
10 | var CURLY_SUBCOMMENT = hljs.COMMENT(
11 | '{',
12 | '}',
13 | {
14 | contains: ['self']
15 | }
16 | );
17 | return {
18 | name: 'Parser3',
19 | subLanguage: 'xml', relevance: 0,
20 | contains: [
21 | hljs.COMMENT('^#', '$'),
22 | hljs.COMMENT(
23 | '\\^rem{',
24 | '}',
25 | {
26 | relevance: 10,
27 | contains: [
28 | CURLY_SUBCOMMENT
29 | ]
30 | }
31 | ),
32 | {
33 | className: 'meta',
34 | begin: '^@(?:BASE|USE|CLASS|OPTIONS)$',
35 | relevance: 10
36 | },
37 | {
38 | className: 'title',
39 | begin: '@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$'
40 | },
41 | {
42 | className: 'variable',
43 | begin: '\\$\\{?[\\w\\-\\.\\:]+\\}?'
44 | },
45 | {
46 | className: 'keyword',
47 | begin: '\\^[\\w\\-\\.\\:]+'
48 | },
49 | {
50 | className: 'number',
51 | begin: '\\^#[0-9a-fA-F]+'
52 | },
53 | hljs.C_NUMBER_MODE
54 | ]
55 | };
56 | }
57 |
--------------------------------------------------------------------------------
/parse/highlight/languages/pf.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Packet Filter config
3 | Description: pf.conf — packet filter configuration file (OpenBSD)
4 | Author: Peter Piwowarski
5 | Website: http://man.openbsd.org/pf.conf
6 | Category: config
7 | */
8 |
9 | export default function(hljs) {
10 | var MACRO = {
11 | className: 'variable',
12 | begin: /\$[\w\d#@][\w\d_]*/
13 | };
14 | var TABLE = {
15 | className: 'variable',
16 | begin: /<(?!\/)/, end: />/
17 | };
18 | var QUOTE_STRING = {
19 | className: 'string',
20 | begin: /"/, end: /"/
21 | };
22 |
23 | return {
24 | name: 'Packet Filter config',
25 | aliases: ['pf.conf'],
26 | lexemes: /[a-z0-9_<>-]+/,
27 | keywords: {
28 | built_in: /* block match pass are "actions" in pf.conf(5), the rest are
29 | * lexically similar top-level commands.
30 | */
31 | 'block match pass load anchor|5 antispoof|10 set table',
32 | keyword:
33 | 'in out log quick on rdomain inet inet6 proto from port os to route ' +
34 | 'allow-opts divert-packet divert-reply divert-to flags group icmp-type ' +
35 | 'icmp6-type label once probability recieved-on rtable prio queue ' +
36 | 'tos tag tagged user keep fragment for os drop ' +
37 | 'af-to|10 binat-to|10 nat-to|10 rdr-to|10 bitmask least-stats random round-robin ' +
38 | 'source-hash static-port ' +
39 | 'dup-to reply-to route-to ' +
40 | 'parent bandwidth default min max qlimit ' +
41 | 'block-policy debug fingerprints hostid limit loginterface optimization ' +
42 | 'reassemble ruleset-optimization basic none profile skip state-defaults ' +
43 | 'state-policy timeout ' +
44 | 'const counters persist ' +
45 | 'no modulate synproxy state|5 floating if-bound no-sync pflow|10 sloppy ' +
46 | 'source-track global rule max-src-nodes max-src-states max-src-conn ' +
47 | 'max-src-conn-rate overload flush ' +
48 | 'scrub|5 max-mss min-ttl no-df|10 random-id',
49 | literal:
50 | 'all any no-route self urpf-failed egress|5 unknown'
51 | },
52 | contains: [
53 | hljs.HASH_COMMENT_MODE,
54 | hljs.NUMBER_MODE,
55 | hljs.QUOTE_STRING_MODE,
56 | MACRO,
57 | TABLE
58 | ]
59 | };
60 | }
61 |
--------------------------------------------------------------------------------
/parse/highlight/languages/php-template.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: PHP Template
3 | Requires: xml.js, php.js
4 | Author: Josh Goebel
5 | Website: https://www.php.net
6 | Category: common
7 | */
8 |
9 | export default function(hljs) {
10 | return {
11 | name: "PHP template",
12 | subLanguage: 'xml',
13 | contains: [
14 | {
15 | begin: /<\?(php|=)?/,
16 | end: /\?>/,
17 | subLanguage: 'php',
18 | contains: [
19 | // We don't want the php closing tag ?> to close the PHP block when
20 | // inside any of the following blocks:
21 | {begin: '/\\*', end: '\\*/', skip: true},
22 | {begin: 'b"', end: '"', skip: true},
23 | {begin: 'b\'', end: '\'', skip: true},
24 | hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null, className: null, contains: null, skip: true}),
25 | hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null, className: null, contains: null, skip: true})
26 | ]
27 | }
28 | ]
29 | };
30 | }
31 |
--------------------------------------------------------------------------------
/parse/highlight/languages/plaintext.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Plain text
3 | Author: Egor Rogov (e.rogov@postgrespro.ru)
4 | Description: Plain text without any highlighting.
5 | Category: common
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Plain text',
11 | aliases: ['text', 'txt'],
12 | disableAutodetect: true
13 | };
14 | }
15 |
--------------------------------------------------------------------------------
/parse/highlight/languages/pony.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Pony
3 | Author: Joe Eli McIlvain
4 | Description: Pony is an open-source, object-oriented, actor-model,
5 | capabilities-secure, high performance programming language.
6 | Website: https://www.ponylang.io
7 | */
8 |
9 | export default function(hljs) {
10 | var KEYWORDS = {
11 | keyword:
12 | 'actor addressof and as be break class compile_error compile_intrinsic ' +
13 | 'consume continue delegate digestof do else elseif embed end error ' +
14 | 'for fun if ifdef in interface is isnt lambda let match new not object ' +
15 | 'or primitive recover repeat return struct then trait try type until ' +
16 | 'use var where while with xor',
17 | meta:
18 | 'iso val tag trn box ref',
19 | literal:
20 | 'this false true'
21 | };
22 |
23 | var TRIPLE_QUOTE_STRING_MODE = {
24 | className: 'string',
25 | begin: '"""', end: '"""',
26 | relevance: 10
27 | };
28 |
29 | var QUOTE_STRING_MODE = {
30 | className: 'string',
31 | begin: '"', end: '"',
32 | contains: [hljs.BACKSLASH_ESCAPE]
33 | };
34 |
35 | var SINGLE_QUOTE_CHAR_MODE = {
36 | className: 'string',
37 | begin: '\'', end: '\'',
38 | contains: [hljs.BACKSLASH_ESCAPE],
39 | relevance: 0
40 | };
41 |
42 | var TYPE_NAME = {
43 | className: 'type',
44 | begin: '\\b_?[A-Z][\\w]*',
45 | relevance: 0
46 | };
47 |
48 | var PRIMED_NAME = {
49 | begin: hljs.IDENT_RE + '\'', relevance: 0
50 | };
51 |
52 | var NUMBER_MODE = {
53 | className: 'number',
54 | begin: '(-?)(\\b0[xX][a-fA-F0-9]+|\\b0[bB][01]+|(\\b\\d+(_\\d+)?(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)',
55 | relevance: 0
56 | };
57 |
58 | /**
59 | * The `FUNCTION` and `CLASS` modes were intentionally removed to simplify
60 | * highlighting and fix cases like
61 | * ```
62 | * interface Iterator[A: A]
63 | * fun has_next(): Bool
64 | * fun next(): A?
65 | * ```
66 | * where it is valid to have a function head without a body
67 | */
68 |
69 | return {
70 | name: 'Pony',
71 | keywords: KEYWORDS,
72 | contains: [
73 | TYPE_NAME,
74 | TRIPLE_QUOTE_STRING_MODE,
75 | QUOTE_STRING_MODE,
76 | SINGLE_QUOTE_CHAR_MODE,
77 | PRIMED_NAME,
78 | NUMBER_MODE,
79 | hljs.C_LINE_COMMENT_MODE,
80 | hljs.C_BLOCK_COMMENT_MODE
81 | ]
82 | };
83 | }
84 |
--------------------------------------------------------------------------------
/parse/highlight/languages/profile.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Python profiler
3 | Description: Python profiler results
4 | Author: Brian Beck
5 | */
6 |
7 | export default function(hljs) {
8 | return {
9 | name: 'Python profiler',
10 | contains: [
11 | hljs.C_NUMBER_MODE,
12 | {
13 | begin: '[a-zA-Z_][\\da-zA-Z_]+\\.[\\da-zA-Z_]{1,3}', end: ':',
14 | excludeEnd: true
15 | },
16 | {
17 | begin: '(ncalls|tottime|cumtime)', end: '$',
18 | keywords: 'ncalls tottime|10 cumtime|10 filename',
19 | relevance: 10
20 | },
21 | {
22 | begin: 'function calls', end: '$',
23 | contains: [hljs.C_NUMBER_MODE],
24 | relevance: 10
25 | },
26 | hljs.APOS_STRING_MODE,
27 | hljs.QUOTE_STRING_MODE,
28 | {
29 | className: 'string',
30 | begin: '\\(', end: '\\)$',
31 | excludeBegin: true, excludeEnd: true,
32 | relevance: 0
33 | }
34 | ]
35 | };
36 | }
37 |
--------------------------------------------------------------------------------
/parse/highlight/languages/prolog.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Prolog
3 | Description: Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics.
4 | Author: Raivo Laanemets
5 | Website: https://en.wikipedia.org/wiki/Prolog
6 | */
7 |
8 | export default function(hljs) {
9 |
10 | var ATOM = {
11 |
12 | begin: /[a-z][A-Za-z0-9_]*/,
13 | relevance: 0
14 | };
15 |
16 | var VAR = {
17 |
18 | className: 'symbol',
19 | variants: [
20 | {begin: /[A-Z][a-zA-Z0-9_]*/},
21 | {begin: /_[A-Za-z0-9_]*/},
22 | ],
23 | relevance: 0
24 | };
25 |
26 | var PARENTED = {
27 |
28 | begin: /\(/,
29 | end: /\)/,
30 | relevance: 0
31 | };
32 |
33 | var LIST = {
34 |
35 | begin: /\[/,
36 | end: /\]/
37 | };
38 |
39 | var LINE_COMMENT = {
40 |
41 | className: 'comment',
42 | begin: /%/, end: /$/,
43 | contains: [hljs.PHRASAL_WORDS_MODE]
44 | };
45 |
46 | var BACKTICK_STRING = {
47 |
48 | className: 'string',
49 | begin: /`/, end: /`/,
50 | contains: [hljs.BACKSLASH_ESCAPE]
51 | };
52 |
53 | var CHAR_CODE = {
54 |
55 | className: 'string', // 0'a etc.
56 | begin: /0\'(\\\'|.)/
57 | };
58 |
59 | var SPACE_CODE = {
60 |
61 | className: 'string',
62 | begin: /0\'\\s/ // 0'\s
63 | };
64 |
65 | var PRED_OP = { // relevance booster
66 | begin: /:-/
67 | };
68 |
69 | var inner = [
70 |
71 | ATOM,
72 | VAR,
73 | PARENTED,
74 | PRED_OP,
75 | LIST,
76 | LINE_COMMENT,
77 | hljs.C_BLOCK_COMMENT_MODE,
78 | hljs.QUOTE_STRING_MODE,
79 | hljs.APOS_STRING_MODE,
80 | BACKTICK_STRING,
81 | CHAR_CODE,
82 | SPACE_CODE,
83 | hljs.C_NUMBER_MODE
84 | ];
85 |
86 | PARENTED.contains = inner;
87 | LIST.contains = inner;
88 |
89 | return {
90 | name: 'Prolog',
91 | contains: inner.concat([
92 | {begin: /\.$/} // relevance booster
93 | ])
94 | };
95 | }
96 |
--------------------------------------------------------------------------------
/parse/highlight/languages/properties.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: .properties
3 | Contributors: Valentin Aitken , Egor Rogov
4 | Website: https://en.wikipedia.org/wiki/.properties
5 | Category: common, config
6 | */
7 |
8 | export default function(hljs) {
9 |
10 | // whitespaces: space, tab, formfeed
11 | var WS0 = '[ \\t\\f]*';
12 | var WS1 = '[ \\t\\f]+';
13 | // delimiter
14 | var DELIM = '(' + WS0+'[:=]'+WS0+ '|' + WS1 + ')';
15 | var KEY_ALPHANUM = '([^\\\\\\W:= \\t\\f\\n]|\\\\.)+';
16 | var KEY_OTHER = '([^\\\\:= \\t\\f\\n]|\\\\.)+';
17 |
18 | var DELIM_AND_VALUE = {
19 | // skip DELIM
20 | end: DELIM,
21 | relevance: 0,
22 | starts: {
23 | // value: everything until end of line (again, taking into account backslashes)
24 | className: 'string',
25 | end: /$/,
26 | relevance: 0,
27 | contains: [
28 | { begin: '\\\\\\n' }
29 | ]
30 | }
31 | };
32 |
33 | return {
34 | name: '.properties',
35 | case_insensitive: true,
36 | illegal: /\S/,
37 | contains: [
38 | hljs.COMMENT('^\\s*[!#]', '$'),
39 | // key: everything until whitespace or = or : (taking into account backslashes)
40 | // case of a "normal" key
41 | {
42 | begin: KEY_ALPHANUM + DELIM,
43 | returnBegin: true,
44 | contains: [
45 | {
46 | className: 'attr',
47 | begin: KEY_ALPHANUM,
48 | endsParent: true,
49 | relevance: 0
50 | }
51 | ],
52 | starts: DELIM_AND_VALUE
53 | },
54 | // case of key containing non-alphanumeric chars => relevance = 0
55 | {
56 | begin: KEY_OTHER + DELIM,
57 | returnBegin: true,
58 | relevance: 0,
59 | contains: [
60 | {
61 | className: 'meta',
62 | begin: KEY_OTHER,
63 | endsParent: true,
64 | relevance: 0
65 | }
66 | ],
67 | starts: DELIM_AND_VALUE
68 | },
69 | // case of an empty key
70 | {
71 | className: 'attr',
72 | relevance: 0,
73 | begin: KEY_OTHER + WS0 + '$'
74 | }
75 | ]
76 | };
77 | }
78 |
--------------------------------------------------------------------------------
/parse/highlight/languages/protobuf.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Protocol Buffers
3 | Author: Dan Tao
4 | Description: Protocol buffer message definition format
5 | Website: https://developers.google.com/protocol-buffers/docs/proto3
6 | Category: protocols
7 | */
8 |
9 | export default function(hljs) {
10 | return {
11 | name: 'Protocol Buffers',
12 | keywords: {
13 | keyword: 'package import option optional required repeated group oneof',
14 | built_in: 'double float int32 int64 uint32 uint64 sint32 sint64 ' +
15 | 'fixed32 fixed64 sfixed32 sfixed64 bool string bytes',
16 | literal: 'true false'
17 | },
18 | contains: [
19 | hljs.QUOTE_STRING_MODE,
20 | hljs.NUMBER_MODE,
21 | hljs.C_LINE_COMMENT_MODE,
22 | {
23 | className: 'class',
24 | beginKeywords: 'message enum service', end: /\{/,
25 | illegal: /\n/,
26 | contains: [
27 | hljs.inherit(hljs.TITLE_MODE, {
28 | starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
29 | })
30 | ]
31 | },
32 | {
33 | className: 'function',
34 | beginKeywords: 'rpc',
35 | end: /[{;]/, excludeEnd: true,
36 | keywords: 'rpc returns'
37 | },
38 | {
39 | begin: /^\s*[A-Z_]+/,
40 | end: /\s*=/, excludeEnd: true
41 | }
42 | ]
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/parse/highlight/languages/python-repl.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Python REPL
3 | Requires: python.js
4 | Author: Josh Goebel
5 | Category: common
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | aliases: ['pycon'],
11 | contains: [
12 | {
13 | className: 'meta',
14 | starts: {
15 | // a space separates the REPL prefix from the actual code
16 | // this is purely for cleaner HTML output
17 | end: / |$/,
18 | starts: {
19 | end: '$', subLanguage: 'python'
20 | }
21 | },
22 | variants: [
23 | { begin: /^>>>(?=[ ]|$)/ },
24 | { begin: /^\.\.\.(?=[ ]|$)/ }
25 | ]
26 | },
27 | ]
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/parse/highlight/languages/q.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Q
3 | Description: Q is a vector-based functional paradigm programming language built into the kdb+ database.
4 | (K/Q/Kdb+ from Kx Systems)
5 | Author: Sergey Vidyuk
6 | Website: https://kx.com/connect-with-us/developers/
7 | */
8 | export default function(hljs) {
9 | var Q_KEYWORDS = {
10 | keyword:
11 | 'do while select delete by update from',
12 | literal:
13 | '0b 1b',
14 | built_in:
15 | 'neg not null string reciprocal floor ceiling signum mod xbar xlog and or each scan over prior mmu lsq inv md5 ltime gtime count first var dev med cov cor all any rand sums prds mins maxs fills deltas ratios avgs differ prev next rank reverse iasc idesc asc desc msum mcount mavg mdev xrank mmin mmax xprev rotate distinct group where flip type key til get value attr cut set upsert raze union inter except cross sv vs sublist enlist read0 read1 hopen hclose hdel hsym hcount peach system ltrim rtrim trim lower upper ssr view tables views cols xcols keys xkey xcol xasc xdesc fkeys meta lj aj aj0 ij pj asof uj ww wj wj1 fby xgroup ungroup ej save load rsave rload show csv parse eval min max avg wavg wsum sin cos tan sum',
16 | type:
17 | '`float `double int `timestamp `timespan `datetime `time `boolean `symbol `char `byte `short `long `real `month `date `minute `second `guid'
18 | };
19 | return {
20 | name: 'Q',
21 | aliases:['k', 'kdb'],
22 | keywords: Q_KEYWORDS,
23 | lexemes: /(`?)[A-Za-z0-9_]+\b/,
24 | contains: [
25 | hljs.C_LINE_COMMENT_MODE,
26 | hljs.QUOTE_STRING_MODE,
27 | hljs.C_NUMBER_MODE
28 | ]
29 | };
30 | }
31 |
--------------------------------------------------------------------------------
/parse/highlight/languages/r.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: R
3 | Description: R is a free software environment for statistical computing and graphics.
4 | Author: Joe Cheng
5 | Website: https://www.r-project.org
6 | Category: scientific
7 | */
8 |
9 | export default function(hljs) {
10 | var IDENT_RE = '([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*';
11 |
12 | return {
13 | name: 'R',
14 | contains: [
15 | hljs.HASH_COMMENT_MODE,
16 | {
17 | begin: IDENT_RE,
18 | lexemes: IDENT_RE,
19 | keywords: {
20 | keyword:
21 | 'function if in break next repeat else for return switch while try tryCatch ' +
22 | 'stop warning require library attach detach source setMethod setGeneric ' +
23 | 'setGroupGeneric setClass ...',
24 | literal:
25 | 'NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 ' +
26 | 'NA_complex_|10'
27 | },
28 | relevance: 0
29 | },
30 | {
31 | // hex value
32 | className: 'number',
33 | begin: "0[xX][0-9a-fA-F]+[Li]?\\b",
34 | relevance: 0
35 | },
36 | {
37 | // explicit integer
38 | className: 'number',
39 | begin: "\\d+(?:[eE][+\\-]?\\d*)?L\\b",
40 | relevance: 0
41 | },
42 | {
43 | // number with trailing decimal
44 | className: 'number',
45 | begin: "\\d+\\.(?!\\d)(?:i\\b)?",
46 | relevance: 0
47 | },
48 | {
49 | // number
50 | className: 'number',
51 | begin: "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",
52 | relevance: 0
53 | },
54 | {
55 | // number with leading decimal
56 | className: 'number',
57 | begin: "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",
58 | relevance: 0
59 | },
60 |
61 | {
62 | // escaped identifier
63 | begin: '`',
64 | end: '`',
65 | relevance: 0
66 | },
67 |
68 | {
69 | className: 'string',
70 | contains: [hljs.BACKSLASH_ESCAPE],
71 | variants: [
72 | {begin: '"', end: '"'},
73 | {begin: "'", end: "'"}
74 | ]
75 | }
76 | ]
77 | };
78 | }
79 |
--------------------------------------------------------------------------------
/parse/highlight/languages/rib.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: RenderMan RIB
3 | Author: Konstantin Evdokimenko
4 | Contributors: Shuen-Huei Guan
5 | Website: https://renderman.pixar.com/resources/RenderMan_20/ribBinding.html
6 | Category: graphics
7 | */
8 |
9 | export default function(hljs) {
10 | return {
11 | name: 'RenderMan RIB',
12 | keywords:
13 | 'ArchiveRecord AreaLightSource Atmosphere Attribute AttributeBegin AttributeEnd Basis ' +
14 | 'Begin Blobby Bound Clipping ClippingPlane Color ColorSamples ConcatTransform Cone ' +
15 | 'CoordinateSystem CoordSysTransform CropWindow Curves Cylinder DepthOfField Detail ' +
16 | 'DetailRange Disk Displacement Display End ErrorHandler Exposure Exterior Format ' +
17 | 'FrameAspectRatio FrameBegin FrameEnd GeneralPolygon GeometricApproximation Geometry ' +
18 | 'Hider Hyperboloid Identity Illuminate Imager Interior LightSource ' +
19 | 'MakeCubeFaceEnvironment MakeLatLongEnvironment MakeShadow MakeTexture Matte ' +
20 | 'MotionBegin MotionEnd NuPatch ObjectBegin ObjectEnd ObjectInstance Opacity Option ' +
21 | 'Orientation Paraboloid Patch PatchMesh Perspective PixelFilter PixelSamples ' +
22 | 'PixelVariance Points PointsGeneralPolygons PointsPolygons Polygon Procedural Projection ' +
23 | 'Quantize ReadArchive RelativeDetail ReverseOrientation Rotate Scale ScreenWindow ' +
24 | 'ShadingInterpolation ShadingRate Shutter Sides Skew SolidBegin SolidEnd Sphere ' +
25 | 'SubdivisionMesh Surface TextureCoordinates Torus Transform TransformBegin TransformEnd ' +
26 | 'TransformPoints Translate TrimCurve WorldBegin WorldEnd',
27 | illegal: '',
28 | contains: [
29 | hljs.HASH_COMMENT_MODE,
30 | hljs.C_NUMBER_MODE,
31 | hljs.APOS_STRING_MODE,
32 | hljs.QUOTE_STRING_MODE
33 | ]
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/parse/highlight/languages/roboconf.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Roboconf
3 | Author: Vincent Zurczak
4 | Description: Syntax highlighting for Roboconf's DSL
5 | Website: http://roboconf.net
6 | Category: config
7 | */
8 |
9 | export default function(hljs) {
10 | var IDENTIFIER = '[a-zA-Z-_][^\\n{]+\\{';
11 |
12 | var PROPERTY = {
13 | className: 'attribute',
14 | begin: /[a-zA-Z-_]+/, end: /\s*:/, excludeEnd: true,
15 | starts: {
16 | end: ';',
17 | relevance: 0,
18 | contains: [
19 | {
20 | className: 'variable',
21 | begin: /\.[a-zA-Z-_]+/
22 | },
23 | {
24 | className: 'keyword',
25 | begin: /\(optional\)/
26 | }
27 | ]
28 | }
29 | };
30 |
31 | return {
32 | name: 'Roboconf',
33 | aliases: ['graph', 'instances'],
34 | case_insensitive: true,
35 | keywords: 'import',
36 | contains: [
37 | // Facet sections
38 | {
39 | begin: '^facet ' + IDENTIFIER,
40 | end: '}',
41 | keywords: 'facet',
42 | contains: [
43 | PROPERTY,
44 | hljs.HASH_COMMENT_MODE
45 | ]
46 | },
47 |
48 | // Instance sections
49 | {
50 | begin: '^\\s*instance of ' + IDENTIFIER,
51 | end: '}',
52 | keywords: 'name count channels instance-data instance-state instance of',
53 | illegal: /\S/,
54 | contains: [
55 | 'self',
56 | PROPERTY,
57 | hljs.HASH_COMMENT_MODE
58 | ]
59 | },
60 |
61 | // Component sections
62 | {
63 | begin: '^' + IDENTIFIER,
64 | end: '}',
65 | contains: [
66 | PROPERTY,
67 | hljs.HASH_COMMENT_MODE
68 | ]
69 | },
70 |
71 | // Comments
72 | hljs.HASH_COMMENT_MODE
73 | ]
74 | };
75 | }
76 |
--------------------------------------------------------------------------------
/parse/highlight/languages/rsl.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: RenderMan RSL
3 | Author: Konstantin Evdokimenko
4 | Contributors: Shuen-Huei Guan
5 | Website: https://renderman.pixar.com/resources/RenderMan_20/shadingLanguage.html
6 | Category: graphics
7 | */
8 |
9 | export default function(hljs) {
10 | return {
11 | name: 'RenderMan RSL',
12 | keywords: {
13 | keyword:
14 | 'float color point normal vector matrix while for if do return else break extern continue',
15 | built_in:
16 | 'abs acos ambient area asin atan atmosphere attribute calculatenormal ceil cellnoise ' +
17 | 'clamp comp concat cos degrees depth Deriv diffuse distance Du Dv environment exp ' +
18 | 'faceforward filterstep floor format fresnel incident length lightsource log match ' +
19 | 'max min mod noise normalize ntransform opposite option phong pnoise pow printf ' +
20 | 'ptlined radians random reflect refract renderinfo round setcomp setxcomp setycomp ' +
21 | 'setzcomp shadow sign sin smoothstep specular specularbrdf spline sqrt step tan ' +
22 | 'texture textureinfo trace transform vtransform xcomp ycomp zcomp'
23 | },
24 | illegal: '',
25 | contains: [
26 | hljs.C_LINE_COMMENT_MODE,
27 | hljs.C_BLOCK_COMMENT_MODE,
28 | hljs.QUOTE_STRING_MODE,
29 | hljs.APOS_STRING_MODE,
30 | hljs.C_NUMBER_MODE,
31 | {
32 | className: 'meta',
33 | begin: '#', end: '$'
34 | },
35 | {
36 | className: 'class',
37 | beginKeywords: 'surface displacement light volume imager', end: '\\('
38 | },
39 | {
40 | beginKeywords: 'illuminate illuminance gather', end: '\\('
41 | }
42 | ]
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/parse/highlight/languages/scilab.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Scilab
3 | Author: Sylvestre Ledru
4 | Origin: matlab.js
5 | Description: Scilab is a port from Matlab
6 | Website: https://www.scilab.org
7 | Category: scientific
8 | */
9 |
10 | export default function(hljs) {
11 |
12 | var COMMON_CONTAINS = [
13 | hljs.C_NUMBER_MODE,
14 | {
15 | className: 'string',
16 | begin: '\'|\"', end: '\'|\"',
17 | contains: [hljs.BACKSLASH_ESCAPE, {begin: '\'\''}]
18 | }
19 | ];
20 |
21 | return {
22 | name: 'Scilab',
23 | aliases: ['sci'],
24 | lexemes: /%?\w+/,
25 | keywords: {
26 | keyword: 'abort break case clear catch continue do elseif else endfunction end for function '+
27 | 'global if pause return resume select try then while',
28 | literal:
29 | '%f %F %t %T %pi %eps %inf %nan %e %i %z %s',
30 | built_in: // Scilab has more than 2000 functions. Just list the most commons
31 | 'abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp error '+
32 | 'exec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isempty '+
33 | 'isinfisnan isvector lasterror length load linspace list listfiles log10 log2 log '+
34 | 'max min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand real '+
35 | 'round sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tan '+
36 | 'type typename warning zeros matrix'
37 | },
38 | illegal: '("|#|/\\*|\\s+/\\w+)',
39 | contains: [
40 | {
41 | className: 'function',
42 | beginKeywords: 'function', end: '$',
43 | contains: [
44 | hljs.UNDERSCORE_TITLE_MODE,
45 | {
46 | className: 'params',
47 | begin: '\\(', end: '\\)'
48 | }
49 | ]
50 | },
51 | {
52 | begin: '[a-zA-Z_][a-zA-Z_0-9]*(\'+[\\.\']*|[\\.\']+)', end: '',
53 | relevance: 0
54 | },
55 | {
56 | begin: '\\[', end: '\\]\'*[\\.\']*',
57 | relevance: 0,
58 | contains: COMMON_CONTAINS
59 | },
60 | hljs.COMMENT('//', '$')
61 | ].concat(COMMON_CONTAINS)
62 | };
63 | }
64 |
--------------------------------------------------------------------------------
/parse/highlight/languages/shell.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Shell Session
3 | Requires: bash.js
4 | Author: TSUYUSATO Kitsune
5 | Category: common
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Shell Session',
11 | aliases: ['console'],
12 | contains: [
13 | {
14 | className: 'meta',
15 | begin: '^\\s{0,3}[/\\w\\d\\[\\]()@-]*[>%$#]',
16 | starts: {
17 | end: '$', subLanguage: 'bash'
18 | }
19 | }
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/parse/highlight/languages/smali.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Smali
3 | Author: Dennis Titze
4 | Description: Basic Smali highlighting
5 | Website: https://github.com/JesusFreke/smali
6 | */
7 |
8 | export default function(hljs) {
9 | var smali_instr_low_prio = ['add', 'and', 'cmp', 'cmpg', 'cmpl', 'const', 'div', 'double', 'float', 'goto', 'if', 'int', 'long', 'move', 'mul', 'neg', 'new', 'nop', 'not', 'or', 'rem', 'return', 'shl', 'shr', 'sput', 'sub', 'throw', 'ushr', 'xor'];
10 | var smali_instr_high_prio = ['aget', 'aput', 'array', 'check', 'execute', 'fill', 'filled', 'goto/16', 'goto/32', 'iget', 'instance', 'invoke', 'iput', 'monitor', 'packed', 'sget', 'sparse'];
11 | var smali_keywords = ['transient', 'constructor', 'abstract', 'final', 'synthetic', 'public', 'private', 'protected', 'static', 'bridge', 'system'];
12 | return {
13 | name: 'Smali',
14 | aliases: ['smali'],
15 | contains: [
16 | {
17 | className: 'string',
18 | begin: '"', end: '"',
19 | relevance: 0
20 | },
21 | hljs.COMMENT(
22 | '#',
23 | '$',
24 | {
25 | relevance: 0
26 | }
27 | ),
28 | {
29 | className: 'keyword',
30 | variants: [
31 | {begin: '\\s*\\.end\\s[a-zA-Z0-9]*'},
32 | {begin: '^[ ]*\\.[a-zA-Z]*', relevance: 0},
33 | {begin: '\\s:[a-zA-Z_0-9]*', relevance: 0},
34 | {begin: '\\s(' + smali_keywords.join('|') + ')'}
35 | ]
36 | },
37 | {
38 | className: 'built_in',
39 | variants : [
40 | {
41 | begin: '\\s('+smali_instr_low_prio.join('|')+')\\s'
42 | },
43 | {
44 | begin: '\\s('+smali_instr_low_prio.join('|')+')((\\-|/)[a-zA-Z0-9]+)+\\s',
45 | relevance: 10
46 | },
47 | {
48 | begin: '\\s('+smali_instr_high_prio.join('|')+')((\\-|/)[a-zA-Z0-9]+)*\\s',
49 | relevance: 10
50 | },
51 | ]
52 | },
53 | {
54 | className: 'class',
55 | begin: 'L[^\(;:\n]*;',
56 | relevance: 0
57 | },
58 | {
59 | begin: '[vp][0-9]+',
60 | }
61 | ]
62 | };
63 | }
64 |
--------------------------------------------------------------------------------
/parse/highlight/languages/smalltalk.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Smalltalk
3 | Description: Smalltalk is an object-oriented, dynamically typed reflective programming language.
4 | Author: Vladimir Gubarkov
5 | Website: https://en.wikipedia.org/wiki/Smalltalk
6 | */
7 |
8 | export default function(hljs) {
9 | var VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*';
10 | var CHAR = {
11 | className: 'string',
12 | begin: '\\$.{1}'
13 | };
14 | var SYMBOL = {
15 | className: 'symbol',
16 | begin: '#' + hljs.UNDERSCORE_IDENT_RE
17 | };
18 | return {
19 | name: 'Smalltalk',
20 | aliases: ['st'],
21 | keywords: 'self super nil true false thisContext', // only 6
22 | contains: [
23 | hljs.COMMENT('"', '"'),
24 | hljs.APOS_STRING_MODE,
25 | {
26 | className: 'type',
27 | begin: '\\b[A-Z][A-Za-z0-9_]*',
28 | relevance: 0
29 | },
30 | {
31 | begin: VAR_IDENT_RE + ':',
32 | relevance: 0
33 | },
34 | hljs.C_NUMBER_MODE,
35 | SYMBOL,
36 | CHAR,
37 | {
38 | // This looks more complicated than needed to avoid combinatorial
39 | // explosion under V8. It effectively means `| var1 var2 ... |` with
40 | // whitespace adjacent to `|` being optional.
41 | begin: '\\|[ ]*' + VAR_IDENT_RE + '([ ]+' + VAR_IDENT_RE + ')*[ ]*\\|',
42 | returnBegin: true, end: /\|/,
43 | illegal: /\S/,
44 | contains: [{begin: '(\\|[ ]*)?' + VAR_IDENT_RE}]
45 | },
46 | {
47 | begin: '\\#\\(', end: '\\)',
48 | contains: [
49 | hljs.APOS_STRING_MODE,
50 | CHAR,
51 | hljs.C_NUMBER_MODE,
52 | SYMBOL
53 | ]
54 | }
55 | ]
56 | };
57 | }
58 |
--------------------------------------------------------------------------------
/parse/highlight/languages/sml.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: SML (Standard ML)
3 | Author: Edwin Dalorzo
4 | Description: SML language definition.
5 | Website: https://www.smlnj.org
6 | Origin: ocaml.js
7 | Category: functional
8 | */
9 | export default function(hljs) {
10 | return {
11 | name: 'SML (Standard ML)',
12 | aliases: ['ml'],
13 | keywords: {
14 | keyword:
15 | /* according to Definition of Standard ML 97 */
16 | 'abstype and andalso as case datatype do else end eqtype ' +
17 | 'exception fn fun functor handle if in include infix infixr ' +
18 | 'let local nonfix of op open orelse raise rec sharing sig ' +
19 | 'signature struct structure then type val with withtype where while',
20 | built_in:
21 | /* built-in types according to basis library */
22 | 'array bool char exn int list option order real ref string substring vector unit word',
23 | literal:
24 | 'true false NONE SOME LESS EQUAL GREATER nil'
25 | },
26 | illegal: /\/\/|>>/,
27 | lexemes: '[a-z_]\\w*!?',
28 | contains: [
29 | {
30 | className: 'literal',
31 | begin: /\[(\|\|)?\]|\(\)/,
32 | relevance: 0
33 | },
34 | hljs.COMMENT(
35 | '\\(\\*',
36 | '\\*\\)',
37 | {
38 | contains: ['self']
39 | }
40 | ),
41 | { /* type variable */
42 | className: 'symbol',
43 | begin: '\'[A-Za-z_](?!\')[\\w\']*'
44 | /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */
45 | },
46 | { /* polymorphic variant */
47 | className: 'type',
48 | begin: '`[A-Z][\\w\']*'
49 | },
50 | { /* module or constructor */
51 | className: 'type',
52 | begin: '\\b[A-Z][\\w\']*',
53 | relevance: 0
54 | },
55 | { /* don't color identifiers, but safely catch all identifiers with '*/
56 | begin: '[a-z_]\\w*\'[\\w\']*'
57 | },
58 | hljs.inherit(hljs.APOS_STRING_MODE, {className: 'string', relevance: 0}),
59 | hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
60 | {
61 | className: 'number',
62 | begin:
63 | '\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +
64 | '0[oO][0-7_]+[Lln]?|' +
65 | '0[bB][01_]+[Lln]?|' +
66 | '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',
67 | relevance: 0
68 | },
69 | {
70 | begin: /[-=]>/ // relevance booster
71 | }
72 | ]
73 | };
74 | }
75 |
--------------------------------------------------------------------------------
/parse/highlight/languages/step21.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: STEP Part 21
3 | Contributors: Adam Joseph Cook
4 | Description: Syntax highlighter for STEP Part 21 files (ISO 10303-21).
5 | Website: https://en.wikipedia.org/wiki/ISO_10303-21
6 | */
7 |
8 | export default function(hljs) {
9 | var STEP21_IDENT_RE = '[A-Z_][A-Z0-9_.]*';
10 | var STEP21_KEYWORDS = {
11 | keyword: 'HEADER ENDSEC DATA'
12 | };
13 | var STEP21_START = {
14 | className: 'meta',
15 | begin: 'ISO-10303-21;',
16 | relevance: 10
17 | };
18 | var STEP21_CLOSE = {
19 | className: 'meta',
20 | begin: 'END-ISO-10303-21;',
21 | relevance: 10
22 | };
23 |
24 | return {
25 | name: 'STEP Part 21',
26 | aliases: ['p21', 'step', 'stp'],
27 | case_insensitive: true, // STEP 21 is case insensitive in theory, in practice all non-comments are capitalized.
28 | lexemes: STEP21_IDENT_RE,
29 | keywords: STEP21_KEYWORDS,
30 | contains: [
31 | STEP21_START,
32 | STEP21_CLOSE,
33 | hljs.C_LINE_COMMENT_MODE,
34 | hljs.C_BLOCK_COMMENT_MODE,
35 | hljs.COMMENT('/\\*\\*!', '\\*/'),
36 | hljs.C_NUMBER_MODE,
37 | hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}),
38 | hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
39 | {
40 | className: 'string',
41 | begin: "'", end: "'"
42 | },
43 | {
44 | className: 'symbol',
45 | variants: [
46 | {
47 | begin: '#', end: '\\d+',
48 | illegal: '\\W'
49 | }
50 | ]
51 | }
52 | ]
53 | };
54 | }
55 |
--------------------------------------------------------------------------------
/parse/highlight/languages/subunit.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: SubUnit
3 | Author: Sergey Bronnikov
4 | Website: https://pypi.org/project/python-subunit/
5 | */
6 |
7 | export default function(hljs) {
8 | var DETAILS = {
9 | className: 'string',
10 | begin: '\\[\n(multipart)?', end: '\\]\n'
11 | };
12 | var TIME = {
13 | className: 'string',
14 | begin: '\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}\.\\d+Z'
15 | };
16 | var PROGRESSVALUE = {
17 | className: 'string',
18 | begin: '(\\+|-)\\d+'
19 | };
20 | var KEYWORDS = {
21 | className: 'keyword',
22 | relevance: 10,
23 | variants: [
24 | { begin: '^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?' },
25 | { begin: '^progress(:?)(\\s+)?(pop|push)?' },
26 | { begin: '^tags:' },
27 | { begin: '^time:' }
28 | ],
29 | };
30 | return {
31 | name: 'SubUnit',
32 | case_insensitive: true,
33 | contains: [
34 | DETAILS,
35 | TIME,
36 | PROGRESSVALUE,
37 | KEYWORDS
38 | ]
39 | };
40 | }
41 |
--------------------------------------------------------------------------------
/parse/highlight/languages/taggerscript.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Tagger Script
3 | Author: Philipp Wolfer
4 | Description: Syntax Highlighting for the Tagger Script as used by MusicBrainz Picard.
5 | Website: https://picard.musicbrainz.org
6 | */
7 | export default function(hljs) {
8 |
9 | var COMMENT = {
10 | className: 'comment',
11 | begin: /\$noop\(/,
12 | end: /\)/,
13 | contains: [{
14 | begin: /\(/,
15 | end: /\)/,
16 | contains: ['self', {
17 | begin: /\\./
18 | }]
19 | }],
20 | relevance: 10
21 | };
22 |
23 | var FUNCTION = {
24 | className: 'keyword',
25 | begin: /\$(?!noop)[a-zA-Z][_a-zA-Z0-9]*/,
26 | end: /\(/,
27 | excludeEnd: true
28 | };
29 |
30 | var VARIABLE = {
31 | className: 'variable',
32 | begin: /%[_a-zA-Z0-9:]*/,
33 | end: '%'
34 | };
35 |
36 | var ESCAPE_SEQUENCE = {
37 | className: 'symbol',
38 | begin: /\\./
39 | };
40 |
41 | return {
42 | name: 'Tagger Script',
43 | contains: [
44 | COMMENT,
45 | FUNCTION,
46 | VARIABLE,
47 | ESCAPE_SEQUENCE
48 | ]
49 | };
50 | }
51 |
--------------------------------------------------------------------------------
/parse/highlight/languages/tap.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Test Anything Protocol
3 | Description: TAP, the Test Anything Protocol, is a simple text-based interface between testing modules in a test harness.
4 | Requires: yaml.js
5 | Author: Sergey Bronnikov
6 | Website: https://testanything.org
7 | */
8 |
9 | export default function(hljs) {
10 | return {
11 | name: 'Test Anything Protocol',
12 | case_insensitive: true,
13 | contains: [
14 | hljs.HASH_COMMENT_MODE,
15 | // version of format and total amount of testcases
16 | {
17 | className: 'meta',
18 | variants: [
19 | { begin: '^TAP version (\\d+)$' },
20 | { begin: '^1\\.\\.(\\d+)$' }
21 | ],
22 | },
23 | // YAML block
24 | {
25 | begin: '(\s+)?---$', end: '\\.\\.\\.$',
26 | subLanguage: 'yaml',
27 | relevance: 0
28 | },
29 | // testcase number
30 | {
31 | className: 'number',
32 | begin: ' (\\d+) '
33 | },
34 | // testcase status and description
35 | {
36 | className: 'symbol',
37 | variants: [
38 | { begin: '^ok' },
39 | { begin: '^not ok' }
40 | ],
41 | },
42 | ]
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/parse/highlight/languages/thrift.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Thrift
3 | Author: Oleg Efimov
4 | Description: Thrift message definition format
5 | Website: https://thrift.apache.org
6 | Category: protocols
7 | */
8 |
9 | export default function(hljs) {
10 | var BUILT_IN_TYPES = 'bool byte i16 i32 i64 double string binary';
11 | return {
12 | name: 'Thrift',
13 | keywords: {
14 | keyword:
15 | 'namespace const typedef struct enum service exception void oneway set list map required optional',
16 | built_in:
17 | BUILT_IN_TYPES,
18 | literal:
19 | 'true false'
20 | },
21 | contains: [
22 | hljs.QUOTE_STRING_MODE,
23 | hljs.NUMBER_MODE,
24 | hljs.C_LINE_COMMENT_MODE,
25 | hljs.C_BLOCK_COMMENT_MODE,
26 | {
27 | className: 'class',
28 | beginKeywords: 'struct enum service exception', end: /\{/,
29 | illegal: /\n/,
30 | contains: [
31 | hljs.inherit(hljs.TITLE_MODE, {
32 | starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
33 | })
34 | ]
35 | },
36 | {
37 | begin: '\\b(set|list|map)\\s*<', end: '>',
38 | keywords: BUILT_IN_TYPES,
39 | contains: ['self']
40 | }
41 | ]
42 | };
43 | }
44 |
--------------------------------------------------------------------------------
/parse/highlight/languages/twig.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Twig
3 | Requires: xml.js
4 | Author: Luke Holder
5 | Description: Twig is a templating language for PHP
6 | Website: https://twig.symfony.com
7 | Category: template
8 | */
9 |
10 | export default function(hljs) {
11 | var PARAMS = {
12 | className: 'params',
13 | begin: '\\(', end: '\\)'
14 | };
15 |
16 | var FUNCTION_NAMES = 'attribute block constant cycle date dump include ' +
17 | 'max min parent random range source template_from_string';
18 |
19 | var FUNCTIONS = {
20 | beginKeywords: FUNCTION_NAMES,
21 | keywords: {name: FUNCTION_NAMES},
22 | relevance: 0,
23 | contains: [
24 | PARAMS
25 | ]
26 | };
27 |
28 | var FILTER = {
29 | begin: /\|[A-Za-z_]+:?/,
30 | keywords:
31 | 'abs batch capitalize column convert_encoding date date_modify default ' +
32 | 'escape filter first format inky_to_html inline_css join json_encode keys last ' +
33 | 'length lower map markdown merge nl2br number_format raw reduce replace ' +
34 | 'reverse round slice sort spaceless split striptags title trim upper url_encode',
35 | contains: [
36 | FUNCTIONS
37 | ]
38 | };
39 |
40 | var TAGS = 'apply autoescape block deprecated do embed extends filter flush for from ' +
41 | 'if import include macro sandbox set use verbatim with';
42 |
43 | TAGS = TAGS + ' ' + TAGS.split(' ').map(function(t){return 'end' + t}).join(' ');
44 |
45 | return {
46 | name: 'Twig',
47 | aliases: ['craftcms'],
48 | case_insensitive: true,
49 | subLanguage: 'xml',
50 | contains: [
51 | hljs.COMMENT(/\{#/, /#}/),
52 | {
53 | className: 'template-tag',
54 | begin: /\{%/, end: /%}/,
55 | contains: [
56 | {
57 | className: 'name',
58 | begin: /\w+/,
59 | keywords: TAGS,
60 | starts: {
61 | endsWithParent: true,
62 | contains: [FILTER, FUNCTIONS],
63 | relevance: 0
64 | }
65 | }
66 | ]
67 | },
68 | {
69 | className: 'template-variable',
70 | begin: /\{\{/, end: /}}/,
71 | contains: ['self', FILTER, FUNCTIONS]
72 | }
73 | ]
74 | };
75 | }
76 |
--------------------------------------------------------------------------------
/parse/highlight/languages/vala.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Vala
3 | Author: Antono Vasiljev
4 | Description: Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C.
5 | Website: https://wiki.gnome.org/Projects/Vala
6 | */
7 |
8 | export default function(hljs) {
9 | return {
10 | name: 'Vala',
11 | keywords: {
12 | keyword:
13 | // Value types
14 | 'char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 ' +
15 | 'uint16 uint32 uint64 float double bool struct enum string void ' +
16 | // Reference types
17 | 'weak unowned owned ' +
18 | // Modifiers
19 | 'async signal static abstract interface override virtual delegate ' +
20 | // Control Structures
21 | 'if while do for foreach else switch case break default return try catch ' +
22 | // Visibility
23 | 'public private protected internal ' +
24 | // Other
25 | 'using new this get set const stdout stdin stderr var',
26 | built_in:
27 | 'DBus GLib CCode Gee Object Gtk Posix',
28 | literal:
29 | 'false true null'
30 | },
31 | contains: [
32 | {
33 | className: 'class',
34 | beginKeywords: 'class interface namespace', end: '{', excludeEnd: true,
35 | illegal: '[^,:\\n\\s\\.]',
36 | contains: [
37 | hljs.UNDERSCORE_TITLE_MODE
38 | ]
39 | },
40 | hljs.C_LINE_COMMENT_MODE,
41 | hljs.C_BLOCK_COMMENT_MODE,
42 | {
43 | className: 'string',
44 | begin: '"""', end: '"""',
45 | relevance: 5
46 | },
47 | hljs.APOS_STRING_MODE,
48 | hljs.QUOTE_STRING_MODE,
49 | hljs.C_NUMBER_MODE,
50 | {
51 | className: 'meta',
52 | begin: '^#', end: '$',
53 | relevance: 2
54 | }
55 | ]
56 | };
57 | }
58 |
--------------------------------------------------------------------------------
/parse/highlight/languages/vbscript-html.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: VBScript in HTML
3 | Requires: xml.js, vbscript.js
4 | Author: Ivan Sagalaev
5 | Description: "Bridge" language defining fragments of VBScript in HTML within <% .. %>
6 | Website: https://en.wikipedia.org/wiki/VBScript
7 | Category: scripting
8 | */
9 |
10 | export default function(hljs) {
11 | return {
12 | name: 'VBScript in HTML',
13 | subLanguage: 'xml',
14 | contains: [
15 | {
16 | begin: '<%', end: '%>',
17 | subLanguage: 'vbscript'
18 | }
19 | ]
20 | };
21 | }
22 |
--------------------------------------------------------------------------------
/parse/highlight/languages/vbscript.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: VBScript
3 | Description: VBScript ("Microsoft Visual Basic Scripting Edition") is an Active Scripting language developed by Microsoft that is modeled on Visual Basic.
4 | Author: Nikita Ledyaev
5 | Contributors: Michal Gabrukiewicz
6 | Website: https://en.wikipedia.org/wiki/VBScript
7 | Category: scripting
8 | */
9 |
10 | export default function(hljs) {
11 | return {
12 | name: 'VBScript',
13 | aliases: ['vbs'],
14 | case_insensitive: true,
15 | keywords: {
16 | keyword:
17 | 'call class const dim do loop erase execute executeglobal exit for each next function ' +
18 | 'if then else on error option explicit new private property let get public randomize ' +
19 | 'redim rem select case set stop sub while wend with end to elseif is or xor and not ' +
20 | 'class_initialize class_terminate default preserve in me byval byref step resume goto',
21 | built_in:
22 | 'lcase month vartype instrrev ubound setlocale getobject rgb getref string ' +
23 | 'weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency ' +
24 | 'conversions csng timevalue second year space abs clng timeserial fixs len asc ' +
25 | 'isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate ' +
26 | 'instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex ' +
27 | 'chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim ' +
28 | 'strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion ' +
29 | 'scriptengine split scriptengineminorversion cint sin datepart ltrim sqr ' +
30 | 'scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw ' +
31 | 'chrw regexp server response request cstr err',
32 | literal:
33 | 'true false null nothing empty'
34 | },
35 | illegal: '//',
36 | contains: [
37 | hljs.inherit(hljs.QUOTE_STRING_MODE, {contains: [{begin: '""'}]}),
38 | hljs.COMMENT(
39 | /'/,
40 | /$/,
41 | {
42 | relevance: 0
43 | }
44 | ),
45 | hljs.C_NUMBER_MODE
46 | ]
47 | };
48 | }
49 |
--------------------------------------------------------------------------------
/parse/highlight/style/github.wxss:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | github.com style (c) Vasily Polovnyov
4 |
5 | */
6 |
7 | .h2w-light .hljs {
8 | display: block;
9 | overflow-x: auto;
10 | padding: 0.5em;
11 | color: #333;
12 | background: #f8f8f8;
13 | }
14 |
15 | .h2w-light .hljs-comment,
16 | .h2w-light .hljs-quote {
17 | color: #998;
18 | font-style: italic;
19 | }
20 |
21 | .h2w-light .hljs-keyword,
22 | .h2w-light .hljs-selector-tag,
23 | .h2w-light .hljs-subst {
24 | color: #333;
25 | font-weight: bold;
26 | }
27 |
28 | .h2w-light .hljs-number,
29 | .h2w-light .hljs-literal,
30 | .h2w-light .hljs-variable,
31 | .h2w-light .hljs-template-variable,
32 | .h2w-light .hljs-tag .hljs-attr {
33 | color: #008080;
34 | }
35 |
36 | .h2w-light .hljs-string,
37 | .h2w-light .hljs-doctag {
38 | color: #d14;
39 | }
40 |
41 | .h2w-light .hljs-title,
42 | .h2w-light .hljs-section,
43 | .h2w-light .hljs-selector-id {
44 | color: #900;
45 | font-weight: bold;
46 | }
47 |
48 | .h2w-light .hljs-subst {
49 | font-weight: normal;
50 | }
51 |
52 | .h2w-light .hljs-type,
53 | .h2w-light .hljs-class .hljs-title {
54 | color: #458;
55 | font-weight: bold;
56 | }
57 |
58 | .h2w-light .hljs-tag,
59 | .h2w-light .hljs-name,
60 | .h2w-light .hljs-attribute {
61 | color: #000080;
62 | font-weight: normal;
63 | }
64 |
65 | .h2w-light .hljs-regexp,
66 | .h2w-light .hljs-link {
67 | color: #009926;
68 | }
69 |
70 | .h2w-light .hljs-symbol,
71 | .h2w-light .hljs-bullet {
72 | color: #990073;
73 | }
74 |
75 | .h2w-light .hljs-built_in,
76 | .h2w-light .hljs-builtin-name {
77 | color: #0086b3;
78 | }
79 |
80 | .h2w-light .hljs-meta {
81 | color: #999;
82 | font-weight: bold;
83 | }
84 |
85 | .h2w-light .hljs-deletion {
86 | background: #fdd;
87 | }
88 |
89 | .h2w-light .hljs-addition {
90 | background: #dfd;
91 | }
92 |
93 | .h2w-light .hljs-emphasis {
94 | font-style: italic;
95 | }
96 |
97 | .h2w-light .hljs-strong {
98 | font-weight: bold;
99 | }
100 |
--------------------------------------------------------------------------------
/parse/highlight/style/monokai.wxss:
--------------------------------------------------------------------------------
1 | /*
2 | Monokai style - ported by Luigi Maselli - http://grigio.org
3 | */
4 |
5 | .h2w-dark .hljs {
6 | display: block;
7 | overflow-x: auto;
8 | padding: 0.5em;
9 | background: #272822; color: #ddd;
10 | }
11 |
12 | .h2w-dark .hljs-tag,
13 | .h2w-dark .hljs-keyword,
14 | .h2w-dark .hljs-selector-tag,
15 | .h2w-dark .hljs-literal,
16 | .h2w-dark .hljs-strong,
17 | .h2w-dark .hljs-name {
18 | color: #f92672;
19 | }
20 |
21 | .h2w-dark .hljs-code {
22 | color: #66d9ef;
23 | }
24 |
25 | .h2w-dark .hljs-class .hljs-title {
26 | color: white;
27 | }
28 |
29 | .h2w-dark .hljs-attribute,
30 | .h2w-dark .hljs-symbol,
31 | .h2w-dark .hljs-regexp,
32 | .h2w-dark .hljs-link {
33 | color: #bf79db;
34 | }
35 |
36 | .h2w-dark .hljs-string,
37 | .h2w-dark .hljs-bullet,
38 | .h2w-dark .hljs-subst,
39 | .h2w-dark .hljs-title,
40 | .h2w-dark .hljs-section,
41 | .h2w-dark .hljs-emphasis,
42 | .h2w-dark .hljs-type,
43 | .h2w-dark .hljs-built_in,
44 | .h2w-dark .hljs-builtin-name,
45 | .h2w-dark .hljs-selector-attr,
46 | .h2w-dark .hljs-selector-pseudo,
47 | .h2w-dark .hljs-addition,
48 | .h2w-dark .hljs-variable,
49 | .h2w-dark .hljs-template-tag,
50 | .h2w-dark .hljs-template-variable {
51 | color: #a6e22e;
52 | }
53 |
54 | .h2w-dark .hljs-comment,
55 | .h2w-dark .hljs-quote,
56 | .h2w-dark .hljs-deletion,
57 | .h2w-dark .hljs-meta {
58 | color: #75715e;
59 | }
60 |
61 | .h2w-dark .hljs-keyword,
62 | .h2w-dark .hljs-selector-tag,
63 | .h2w-dark .hljs-literal,
64 | .h2w-dark .hljs-doctag,
65 | .h2w-dark .hljs-title,
66 | .h2w-dark .hljs-section,
67 | .h2w-dark .hljs-type,
68 | .h2w-dark .hljs-selector-id {
69 | font-weight: bold;
70 | }
71 |
--------------------------------------------------------------------------------
/parse/markdown/index.js:
--------------------------------------------------------------------------------
1 | let hljs;
2 | hljs = require('../highlight/index');
3 |
4 | const config = require('../../config'),
5 | mdOption = (()=>{
6 | let result = {
7 | html: true,
8 | xhtmlOut: true,
9 | typographer: true,
10 | breaks: true,
11 | };
12 |
13 | if(config.highlight.length && hljs){
14 | result.highlight = (code,lang,callback)=>{
15 | let lineLen = code.split(/\r|\n/ig).length,
16 | result = hljs.highlightAuto(code).value;
17 |
18 | // 代码块多换行的问题
19 | result = result.replace(/(\r|\n){2,}/g, str => {
20 | return new Array(str.length).join("
")
21 | });
22 | result = result.replace(/\r|\n/g, str => {
23 | return "
"
24 | });
25 |
26 | // 代码空格处理
27 | result = result.replace(/>[^<]+ {
28 | return str.replace(/\s/g," ");
29 | }).replace(/\t/g,new Array(4).join(" "));
30 |
31 | if(config.showLineNumber){
32 | let lineStr = (()=>{
33 | let str = ``;
34 | for(let i=0;i${i+1}`
36 | };
37 |
38 | str += `
`;
39 | return str;
40 | })();
41 | return lineStr + result;
42 | };
43 | return result;
44 | }
45 | };
46 | return result;
47 | })(),
48 | md = require('./markdown')(mdOption);
49 |
50 | // 应用Markdown解析扩展,包括自定义组件(['sub','sup','ins','mark','emoji','todo','latex','yuml','echarts'])
51 | // [...config.markdown,...config.components].forEach(item => {
52 | // if(!/^audio-player|table|todogroup|img$/.test(item)){
53 | // md.use(require(`./plugins/${item}`));
54 | // };
55 | // });
56 | //@regMarkdownPlugins
57 |
58 | // 定义emoji渲染规则
59 | md.renderer.rules.emoji = (token,index)=>{
60 | let item = token[index];
61 | return `${item.content}`;
62 | };
63 |
64 | // 导出模块
65 | module.exports = str => {
66 | return md.render(str);
67 | };
--------------------------------------------------------------------------------
/parse/markdown/plugins/echarts.js:
--------------------------------------------------------------------------------
1 | module.exports = md => {
2 | const temp = md.renderer.rules.fence.bind(md.renderer.rules)
3 | md.renderer.rules.fence = (tokens, idx, options, env, slf) => {
4 | const token = tokens[idx]
5 | const code = token.content.trim();
6 | if (token.info === 'echarts') {
7 | return ``;
8 | };
9 | return temp(tokens, idx, options, env, slf)
10 | }
11 | };
--------------------------------------------------------------------------------
/parse/markdown/plugins/ins.js:
--------------------------------------------------------------------------------
1 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.markdownitIns=e()}}(function(){return function e(n,t,o){function r(s,f){if(!t[s]){if(!n[s]){var u="function"==typeof require&&require;if(!f&&u)return u(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var p=t[s]={exports:{}};n[s][0].call(p.exports,function(e){var t=n[s][1][e];return r(t?t:e)},p,p.exports,e,n,t,o)}return t[s].exports}for(var i="function"==typeof require&&require,s=0;si)return!1;for(i%2&&(r=e.push("text","",0),r.content=s,i--),t=0;i>t;t+=2)r=e.push("text","",0),r.content=s+s,e.delimiters.push({marker:u,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function t(e){var n,t,o,r,i,s=[],f=e.delimiters,u=e.delimiters.length;for(n=0;u>n;n++)o=f[n],43===o.marker&&-1!==o.end&&(r=f[o.end],i=e.tokens[o.token],i.type="ins_open",i.tag="ins",i.nesting=1,i.markup="++",i.content="",i=e.tokens[r.token],i.type="ins_close",i.tag="ins",i.nesting=-1,i.markup="++",i.content="","text"===e.tokens[r.token-1].type&&"+"===e.tokens[r.token-1].content&&s.push(r.token-1));for(;s.length;){for(n=s.pop(),t=n+1;ti)return!1;for(i%2&&(r=e.push("text","",0),r.content=s,i--),t=0;i>t;t+=2)r=e.push("text","",0),r.content=s+s,e.delimiters.push({marker:u,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function t(e){var n,t,o,r,i,s=[],f=e.delimiters,u=e.delimiters.length;for(n=0;u>n;n++)o=f[n],61===o.marker&&-1!==o.end&&(r=f[o.end],i=e.tokens[o.token],i.type="mark_open",i.tag="mark",i.nesting=1,i.markup="==",i.content="",i=e.tokens[r.token],i.type="mark_close",i.tag="mark",i.nesting=-1,i.markup="==",i.content="","text"===e.tokens[r.token-1].type&&"="===e.tokens[r.token-1].content&&s.push(r.token-1));for(;s.length;){for(n=s.pop(),t=n+1;t=i)return!1;for(e.pos=u+1;e.pos?@[\]^_`{|}~-])/g;r.exports=function(e){e.inline.ruler.after("emphasis","sub",o)}},{}]},{},[1])(1)});
--------------------------------------------------------------------------------
/parse/markdown/plugins/sup.js:
--------------------------------------------------------------------------------
1 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.markdownitSup=e()}}(function(){return function e(r,o,n){function t(i,p){if(!o[i]){if(!r[i]){var u="function"==typeof require&&require;if(!p&&u)return u(i,!0);if(s)return s(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var a=o[i]={exports:{}};r[i][0].call(a.exports,function(e){var o=r[i][1][e];return t(o?o:e)},a,a.exports,e,r,o,n)}return o[i].exports}for(var s="function"==typeof require&&require,i=0;i=i)return!1;for(e.pos=p+1;e.pos?@[\]^_`{|}~-])/g;r.exports=function(e){e.inline.ruler.after("emphasis","sup",o)}},{}]},{},[1])(1)});
--------------------------------------------------------------------------------
/parse/markdown/plugins/yuml.js:
--------------------------------------------------------------------------------
1 | const config = require('../../../config');
2 | const mermaidChart = (code) => {
3 | return ``;
4 | }
5 |
6 | module.exports = md => {
7 | const temp = md.renderer.rules.fence.bind(md.renderer.rules)
8 | md.renderer.rules.fence = (tokens, idx, options, env, slf) => {
9 | const token = tokens[idx]
10 | const code = token.content.trim();
11 | if (token.info === 'yuml') {
12 | return mermaidChart(code)
13 | };
14 | // const firstLine = code.split(/\n/)[0].trim()
15 | // if (firstLine === 'gantt' || firstLine === 'sequenceDiagram' || firstLine.match(/^graph (?:TB|BT|RL|LR|TD);?$/)) {
16 | // return mermaidChart(code)
17 | // }
18 | return temp(tokens, idx, options, env, slf)
19 | }
20 | };
--------------------------------------------------------------------------------
/parse/parse2/domelementtype/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0;
4 | /** Types of elements found in htmlparser2's DOM */
5 | var ElementType;
6 | (function (ElementType) {
7 | /** Type for the root element of a document */
8 | ElementType["Root"] = "root";
9 | /** Type for Text */
10 | ElementType["Text"] = "text";
11 | /** Type for ... ?> */
12 | ElementType["Directive"] = "directive";
13 | /** Type for */
14 | ElementType["Comment"] = "comment";
15 | /** Type for