-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use highlight.js for syntax coloring
* Add highlight.js, highlight-mojo-light.css and plugins Start of try replacing prettify.js with highlight.js * Update templates for highlight.js * Mojolicious::Plugin::MojoDocs: Revise highlighting logic for code blocks Filter out code blocks we want highlighted, then apply "nohighlight" to those we don't, while preserving existing CSS classes (if any.) * Remove prettify.js and css Thanks for the service!
- Loading branch information
Showing
12 changed files
with
591 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
hljs.registerLanguage("apache",function(){"use strict";return function(e){ | ||
var n={className:"number", | ||
begin:"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?"};return{ | ||
name:"Apache config",aliases:["apacheconf"],case_insensitive:!0, | ||
contains:[e.HASH_COMMENT_MODE,{className:"section",begin:"</?",end:">", | ||
contains:[n,{className:"number",begin:":\\d{1,5}" | ||
},e.inherit(e.QUOTE_STRING_MODE,{relevance:0})]},{className:"attribute", | ||
begin:/\w+/,relevance:0,keywords:{ | ||
nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername" | ||
},starts:{end:/$/,relevance:0,keywords:{literal:"on off all deny allow"}, | ||
contains:[{className:"meta",begin:"\\s\\[",end:"\\]$"},{className:"variable", | ||
begin:"[\\$%]\\{",end:"\\}",contains:["self",{className:"number", | ||
begin:"[\\$%]\\d+"}]},n,{className:"number",begin:"\\d+"},e.QUOTE_STRING_MODE]} | ||
}],illegal:/\S/}}}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.hljs { | ||
display: block; | ||
overflow-x: auto; | ||
} | ||
|
||
.hljs-keyword, | ||
.hljs-selector-tag, | ||
.hljs-literal, | ||
.hljs-section, | ||
.hljs-link { | ||
color:#0184bc; | ||
} | ||
|
||
.hljs, | ||
.hljs-subst { | ||
color:#383a42; | ||
} | ||
|
||
.hljs-string, | ||
.hljs-title, | ||
.hljs-name, | ||
.hljs-type, | ||
.hljs-attribute, | ||
.hljs-symbol, | ||
.hljs-bullet, | ||
.hljs-built_in, | ||
.hljs-addition, | ||
.hljs-variable, | ||
.hljs-template-tag, | ||
.hljs-template-variable { | ||
color: #50a14f; | ||
} | ||
|
||
.hljs-comment, | ||
.hljs-quote, | ||
.hljs-deletion, | ||
.hljs-meta { | ||
color:#a0a1a7; | ||
} | ||
|
||
.hljs-keyword, | ||
.hljs-selector-tag, | ||
.hljs-literal, | ||
.hljs-title, | ||
.hljs-section, | ||
.hljs-doctag, | ||
.hljs-type, | ||
.hljs-name, | ||
.hljs-strong { | ||
font-weight: bold; | ||
color:#a626a4; | ||
} | ||
|
||
.hljs-emphasis { | ||
font-style: italic; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
hljs.registerLanguage("ini",function(){"use strict";function e(e){ | ||
return e?"string"==typeof e?e:e.source:null}function n(...n){ | ||
return n.map((n=>e(n))).join("")}return function(a){var s={className:"number", | ||
relevance:0,variants:[{begin:/([\+\-]+)?[\d]+_[\d_]+/},{begin:a.NUMBER_RE}] | ||
},i=a.COMMENT();i.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];var t={ | ||
className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)}/}] | ||
},r={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={ | ||
className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[{begin:"'''", | ||
end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"' | ||
},{begin:"'",end:"'"}]},c={begin:/\[/,end:/\]/,contains:[i,r,t,l,s,"self"], | ||
relevance:0 | ||
},g="("+[/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/].map((n=>e(n))).join("|")+")" | ||
;return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/, | ||
contains:[i,{className:"section",begin:/\[+/,end:/\]+/},{ | ||
begin:n(g,"(\\s*\\.\\s*",g,")*",n("(?=",/\s*=\s*[^#\s]/,")")),className:"attr", | ||
starts:{end:/$/,contains:[i,c,r,t,l,s]}}]}}}()); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
hljs.registerLanguage("nginx",function(){"use strict";return function(e){var n={ | ||
className:"variable",variants:[{begin:/\$\d+/},{begin:/\$\{/,end:/}/},{ | ||
begin:"[\\$\\@]"+e.UNDERSCORE_IDENT_RE}]},a={endsWithParent:!0,keywords:{ | ||
$pattern:"[a-z/_]+", | ||
literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll" | ||
},relevance:0,illegal:"=>",contains:[e.HASH_COMMENT_MODE,{className:"string", | ||
contains:[e.BACKSLASH_ESCAPE,n],variants:[{begin:/"/,end:/"/},{begin:/'/,end:/'/ | ||
}]},{begin:"([a-z]+):/",end:"\\s",endsWithParent:!0,excludeEnd:!0,contains:[n] | ||
},{className:"regexp",contains:[e.BACKSLASH_ESCAPE,n],variants:[{begin:"\\s\\^", | ||
end:"\\s|{|;",returnEnd:!0},{begin:"~\\*?\\s+",end:"\\s|{|;",returnEnd:!0},{ | ||
begin:"\\*(\\.[a-z\\-]+)+"},{begin:"([a-z\\-]+\\.)+\\*"}]},{className:"number", | ||
begin:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{ | ||
className:"number",begin:"\\b\\d+[kKmMgGdshdwy]*\\b",relevance:0},n]};return{ | ||
name:"Nginx config",aliases:["nginxconf"],contains:[e.HASH_COMMENT_MODE,{ | ||
begin:e.UNDERSCORE_IDENT_RE+"\\s+{",returnBegin:!0,end:"{",contains:[{ | ||
className:"section",begin:e.UNDERSCORE_IDENT_RE}],relevance:0},{ | ||
begin:e.UNDERSCORE_IDENT_RE+"\\s",end:";|{",returnBegin:!0,contains:[{ | ||
className:"attribute",begin:e.UNDERSCORE_IDENT_RE,starts:a}],relevance:0}], | ||
illegal:"[^\\s\\}]"}}}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
hljs.registerLanguage("yaml",function(){"use strict";return function(e){ | ||
var n="true false yes no null",a="[\\w#;/?:@&=+$,.~*\\'()[\\]]+",s={ | ||
className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/ | ||
},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable", | ||
variants:[{begin:"{{",end:"}}"},{begin:"%{",end:"}"}]}]},i=e.inherit(s,{ | ||
variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),l={ | ||
end:",",endsWithParent:!0,excludeEnd:!0,contains:[],keywords:n,relevance:0},t={ | ||
begin:"{",end:"}",contains:[l],illegal:"\\n",relevance:0},g={begin:"\\[", | ||
end:"\\]",contains:[l],illegal:"\\n",relevance:0},b=[{className:"attr", | ||
variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ \t]|$)"},{ | ||
begin:'"\\w[\\w :\\/.-]*":(?=[ \t]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ \t]|$)" | ||
}]},{className:"meta",begin:"^---s*$",relevance:10},{className:"string", | ||
begin:"[\\|>]([0-9]?[+-])?[ ]*\\n( *)[\\S ]+\\n(\\2[\\S ]+\\n?)*"},{ | ||
begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0, | ||
relevance:0},{className:"type",begin:"!\\w+!"+a},{className:"type", | ||
begin:"!<"+a+">"},{className:"type",begin:"!"+a},{className:"type",begin:"!!"+a | ||
},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta", | ||
begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"\\-(?=[ ]|$)", | ||
relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},{ | ||
className:"number", | ||
begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b" | ||
},{className:"number",begin:e.C_NUMBER_RE+"\\b"},t,g,s],c=[...b];return c.pop(), | ||
c.push(i),l.contains=c,{name:"YAML",case_insensitive:!0,aliases:["yml","YAML"], | ||
contains:b}}}()); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.