forked from NYANDEV/forgejo
add highlight js
This commit is contained in:
parent
e44852ff79
commit
70e0153b93
9 changed files with 174 additions and 88 deletions
|
@ -86,89 +86,6 @@
|
||||||
"randomFootnoteNumbers": 0,
|
"randomFootnoteNumbers": 0,
|
||||||
"useCompatibilityMode": 0
|
"useCompatibilityMode": 0
|
||||||
},
|
},
|
||||||
"\/public\/css\/dropzone.css": {
|
|
||||||
"fileType": 16,
|
|
||||||
"ignore": 0,
|
|
||||||
"ignoreWasSetByUser": 0,
|
|
||||||
"inputAbbreviatedPath": "\/public\/css\/dropzone.css",
|
|
||||||
"outputAbbreviatedPath": "No Output Path",
|
|
||||||
"outputPathIsOutsideProject": 0,
|
|
||||||
"outputPathIsSetByUser": 0
|
|
||||||
},
|
|
||||||
"\/public\/css\/font-awesome.min.css": {
|
|
||||||
"fileType": 16,
|
|
||||||
"ignore": 0,
|
|
||||||
"ignoreWasSetByUser": 0,
|
|
||||||
"inputAbbreviatedPath": "\/public\/css\/font-awesome.min.css",
|
|
||||||
"outputAbbreviatedPath": "No Output Path",
|
|
||||||
"outputPathIsOutsideProject": 0,
|
|
||||||
"outputPathIsSetByUser": 0
|
|
||||||
},
|
|
||||||
"\/public\/css\/github.min.css": {
|
|
||||||
"fileType": 16,
|
|
||||||
"ignore": 0,
|
|
||||||
"ignoreWasSetByUser": 0,
|
|
||||||
"inputAbbreviatedPath": "\/public\/css\/github.min.css",
|
|
||||||
"outputAbbreviatedPath": "No Output Path",
|
|
||||||
"outputPathIsOutsideProject": 0,
|
|
||||||
"outputPathIsSetByUser": 0
|
|
||||||
},
|
|
||||||
"\/public\/css\/gogs.css": {
|
|
||||||
"fileType": 16,
|
|
||||||
"ignore": 0,
|
|
||||||
"ignoreWasSetByUser": 0,
|
|
||||||
"inputAbbreviatedPath": "\/public\/css\/gogs.css",
|
|
||||||
"outputAbbreviatedPath": "No Output Path",
|
|
||||||
"outputPathIsOutsideProject": 0,
|
|
||||||
"outputPathIsSetByUser": 0
|
|
||||||
},
|
|
||||||
"\/public\/css\/gogs.min.css": {
|
|
||||||
"fileType": 16,
|
|
||||||
"ignore": 1,
|
|
||||||
"ignoreWasSetByUser": 0,
|
|
||||||
"inputAbbreviatedPath": "\/public\/css\/gogs.min.css",
|
|
||||||
"outputAbbreviatedPath": "No Output Path",
|
|
||||||
"outputPathIsOutsideProject": 0,
|
|
||||||
"outputPathIsSetByUser": 0
|
|
||||||
},
|
|
||||||
"\/public\/css\/jquery.datetimepicker.css": {
|
|
||||||
"fileType": 16,
|
|
||||||
"ignore": 0,
|
|
||||||
"ignoreWasSetByUser": 0,
|
|
||||||
"inputAbbreviatedPath": "\/public\/css\/jquery.datetimepicker.css",
|
|
||||||
"outputAbbreviatedPath": "No Output Path",
|
|
||||||
"outputPathIsOutsideProject": 0,
|
|
||||||
"outputPathIsSetByUser": 0
|
|
||||||
},
|
|
||||||
"\/public\/css\/jquery.minicolors.css": {
|
|
||||||
"fileType": 16,
|
|
||||||
"ignore": 0,
|
|
||||||
"ignoreWasSetByUser": 0,
|
|
||||||
"inputAbbreviatedPath": "\/public\/css\/jquery.minicolors.css",
|
|
||||||
"outputAbbreviatedPath": "No Output Path",
|
|
||||||
"outputPathIsOutsideProject": 0,
|
|
||||||
"outputPathIsSetByUser": 0
|
|
||||||
},
|
|
||||||
"\/public\/css\/semantic.min.css": {
|
|
||||||
"fileType": 16,
|
|
||||||
"ignore": 0,
|
|
||||||
"ignoreWasSetByUser": 0,
|
|
||||||
"inputAbbreviatedPath": "\/public\/css\/semantic.min.css",
|
|
||||||
"outputAbbreviatedPath": "No Output Path",
|
|
||||||
"outputPathIsOutsideProject": 0,
|
|
||||||
"outputPathIsSetByUser": 0
|
|
||||||
},
|
|
||||||
"\/public\/css\/themes\/default\/assets\/images\/flags.png": {
|
|
||||||
"fileType": 32768,
|
|
||||||
"ignore": 0,
|
|
||||||
"ignoreWasSetByUser": 0,
|
|
||||||
"initialSize": 28123,
|
|
||||||
"inputAbbreviatedPath": "\/public\/css\/themes\/default\/assets\/images\/flags.png",
|
|
||||||
"outputAbbreviatedPath": "\/public\/css\/themes\/default\/assets\/images\/flags.png",
|
|
||||||
"outputPathIsOutsideProject": 0,
|
|
||||||
"outputPathIsSetByUser": 0,
|
|
||||||
"processed": 0
|
|
||||||
},
|
|
||||||
"\/public\/img\/404.png": {
|
"\/public\/img\/404.png": {
|
||||||
"fileType": 32768,
|
"fileType": 32768,
|
||||||
"ignore": 0,
|
"ignore": 0,
|
||||||
|
@ -1750,7 +1667,7 @@
|
||||||
"sassUseLibsass": 0,
|
"sassUseLibsass": 0,
|
||||||
"shouldRunAutoprefixer": 0,
|
"shouldRunAutoprefixer": 0,
|
||||||
"shouldRunBless": 0,
|
"shouldRunBless": 0,
|
||||||
"skippedItemsString": "_cache, logs, _logs, cache, \/public\/js\/lib, .git, \/public\/js, log, .svn, .hg",
|
"skippedItemsString": "_cache, logs, \/public\/css, _logs, cache, \/public\/js\/lib, .git, \/public\/js, log, .svn, .hg",
|
||||||
"slimAutoOutputPathEnabled": 1,
|
"slimAutoOutputPathEnabled": 1,
|
||||||
"slimAutoOutputPathFilenamePattern": "*.html",
|
"slimAutoOutputPathFilenamePattern": "*.html",
|
||||||
"slimAutoOutputPathRelativePath": "",
|
"slimAutoOutputPathRelativePath": "",
|
||||||
|
|
2
public/css/gogs.min.css
vendored
2
public/css/gogs.min.css
vendored
File diff suppressed because one or more lines are too long
155
public/css/highlightjs/default.css
Normal file
155
public/css/highlightjs/default.css
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.hljs {
|
||||||
|
display: block;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding: 0.5em;
|
||||||
|
background: #f0f0f0;
|
||||||
|
-webkit-text-size-adjust: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs,
|
||||||
|
.hljs-subst,
|
||||||
|
.hljs-tag .hljs-title,
|
||||||
|
.nginx .hljs-title {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-string,
|
||||||
|
.hljs-title,
|
||||||
|
.hljs-constant,
|
||||||
|
.hljs-parent,
|
||||||
|
.hljs-tag .hljs-value,
|
||||||
|
.hljs-rule .hljs-value,
|
||||||
|
.hljs-preprocessor,
|
||||||
|
.hljs-pragma,
|
||||||
|
.hljs-name,
|
||||||
|
.haml .hljs-symbol,
|
||||||
|
.ruby .hljs-symbol,
|
||||||
|
.ruby .hljs-symbol .hljs-string,
|
||||||
|
.hljs-template_tag,
|
||||||
|
.django .hljs-variable,
|
||||||
|
.smalltalk .hljs-class,
|
||||||
|
.hljs-addition,
|
||||||
|
.hljs-flow,
|
||||||
|
.hljs-stream,
|
||||||
|
.bash .hljs-variable,
|
||||||
|
.pf .hljs-variable,
|
||||||
|
.apache .hljs-tag,
|
||||||
|
.apache .hljs-cbracket,
|
||||||
|
.tex .hljs-command,
|
||||||
|
.tex .hljs-special,
|
||||||
|
.erlang_repl .hljs-function_or_atom,
|
||||||
|
.asciidoc .hljs-header,
|
||||||
|
.markdown .hljs-header,
|
||||||
|
.coffeescript .hljs-attribute,
|
||||||
|
.tp .hljs-variable {
|
||||||
|
color: #800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.smartquote,
|
||||||
|
.hljs-comment,
|
||||||
|
.hljs-annotation,
|
||||||
|
.diff .hljs-header,
|
||||||
|
.hljs-chunk,
|
||||||
|
.asciidoc .hljs-blockquote,
|
||||||
|
.markdown .hljs-blockquote {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-number,
|
||||||
|
.hljs-date,
|
||||||
|
.hljs-regexp,
|
||||||
|
.hljs-literal,
|
||||||
|
.hljs-hexcolor,
|
||||||
|
.smalltalk .hljs-symbol,
|
||||||
|
.smalltalk .hljs-char,
|
||||||
|
.go .hljs-constant,
|
||||||
|
.hljs-change,
|
||||||
|
.lasso .hljs-variable,
|
||||||
|
.makefile .hljs-variable,
|
||||||
|
.asciidoc .hljs-bullet,
|
||||||
|
.markdown .hljs-bullet,
|
||||||
|
.asciidoc .hljs-link_url,
|
||||||
|
.markdown .hljs-link_url {
|
||||||
|
color: #080;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-label,
|
||||||
|
.ruby .hljs-string,
|
||||||
|
.hljs-decorator,
|
||||||
|
.hljs-filter .hljs-argument,
|
||||||
|
.hljs-localvars,
|
||||||
|
.hljs-array,
|
||||||
|
.hljs-attr_selector,
|
||||||
|
.hljs-important,
|
||||||
|
.hljs-pseudo,
|
||||||
|
.hljs-pi,
|
||||||
|
.haml .hljs-bullet,
|
||||||
|
.hljs-doctype,
|
||||||
|
.hljs-deletion,
|
||||||
|
.hljs-envvar,
|
||||||
|
.hljs-shebang,
|
||||||
|
.apache .hljs-sqbracket,
|
||||||
|
.nginx .hljs-built_in,
|
||||||
|
.tex .hljs-formula,
|
||||||
|
.erlang_repl .hljs-reserved,
|
||||||
|
.hljs-prompt,
|
||||||
|
.asciidoc .hljs-link_label,
|
||||||
|
.markdown .hljs-link_label,
|
||||||
|
.vhdl .hljs-attribute,
|
||||||
|
.clojure .hljs-attribute,
|
||||||
|
.asciidoc .hljs-attribute,
|
||||||
|
.lasso .hljs-attribute,
|
||||||
|
.coffeescript .hljs-property,
|
||||||
|
.hljs-phony {
|
||||||
|
color: #88f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-keyword,
|
||||||
|
.hljs-id,
|
||||||
|
.hljs-title,
|
||||||
|
.hljs-built_in,
|
||||||
|
.css .hljs-tag,
|
||||||
|
.hljs-doctag,
|
||||||
|
.smalltalk .hljs-class,
|
||||||
|
.hljs-winutils,
|
||||||
|
.bash .hljs-variable,
|
||||||
|
.pf .hljs-variable,
|
||||||
|
.apache .hljs-tag,
|
||||||
|
.hljs-type,
|
||||||
|
.hljs-typename,
|
||||||
|
.tex .hljs-command,
|
||||||
|
.asciidoc .hljs-strong,
|
||||||
|
.markdown .hljs-strong,
|
||||||
|
.hljs-request,
|
||||||
|
.hljs-status,
|
||||||
|
.tp .hljs-data,
|
||||||
|
.tp .hljs-io {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.asciidoc .hljs-emphasis,
|
||||||
|
.markdown .hljs-emphasis,
|
||||||
|
.tp .hljs-units {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nginx .hljs-built_in {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coffeescript .javascript,
|
||||||
|
.javascript .xml,
|
||||||
|
.lasso .markup,
|
||||||
|
.tex .hljs-formula,
|
||||||
|
.xml .javascript,
|
||||||
|
.xml .vbscript,
|
||||||
|
.xml .css,
|
||||||
|
.xml .hljs-cdata {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
|
@ -408,6 +408,9 @@ $(document).ready(function () {
|
||||||
$($(this).data('target')).slideToggle(100);
|
$($(this).data('target')).slideToggle(100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Highlight JS
|
||||||
|
hljs.initHighlightingOnLoad();
|
||||||
|
|
||||||
// Dropzone
|
// Dropzone
|
||||||
if ($('#dropzone').length > 0) {
|
if ($('#dropzone').length > 0) {
|
||||||
// Disable auto discover for all elements:
|
// Disable auto discover for all elements:
|
||||||
|
|
1
public/js/libs/highlight.pack.js
Normal file
1
public/js/libs/highlight.pack.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -659,11 +659,15 @@
|
||||||
padding: 0;
|
padding: 0;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
* {
|
> * {
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
pre {
|
pre {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
.hljs {
|
||||||
|
padding: 0;
|
||||||
|
background-color: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,6 +418,8 @@ func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkWebhook(ctx *middleware.Context) (*OrgRepoCtx, *models.Webhook) {
|
func checkWebhook(ctx *middleware.Context) (*OrgRepoCtx, *models.Webhook) {
|
||||||
|
ctx.Data["RequireHighlightJS"] = true
|
||||||
|
|
||||||
orCtx, err := getOrgRepoCtx(ctx)
|
orCtx, err := getOrgRepoCtx(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "getOrgRepoCtx", err)
|
ctx.Handle(500, "getOrgRepoCtx", err)
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
<script src="{{AppSubUrl}}/js/gogs.js?v={{AppVer}}"></script>
|
<script src="{{AppSubUrl}}/js/gogs.js?v={{AppVer}}"></script>
|
||||||
|
|
||||||
<!-- Third-party libraries -->
|
<!-- Third-party libraries -->
|
||||||
|
{{if .RequireHighlightJS}}
|
||||||
|
<link rel="stylesheet" href="{{AppSubUrl}}/css/highlightjs/default.css?v={{AppVer}}">
|
||||||
|
<script src="{{AppSubUrl}}/js/libs/highlight.pack.js?v={{AppVer}}"></script>
|
||||||
|
{{end}}
|
||||||
{{if .RequireMinicolors}}
|
{{if .RequireMinicolors}}
|
||||||
<link rel="stylesheet" href="{{AppSubUrl}}/css/jquery.minicolors.css?v={{AppVer}}">
|
<link rel="stylesheet" href="{{AppSubUrl}}/css/jquery.minicolors.css?v={{AppVer}}">
|
||||||
<script src="{{AppSubUrl}}/js/libs/jquery.minicolors.min.js?v={{AppVer}}"></script>
|
<script src="{{AppSubUrl}}/js/libs/jquery.minicolors.min.js?v={{AppVer}}"></script>
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
{{ range $key, $val := .RequestInfo.Headers }}<strong>{{$key}}:</strong> {{$val}}
|
{{ range $key, $val := .RequestInfo.Headers }}<strong>{{$key}}:</strong> {{$val}}
|
||||||
{{end}}</pre>
|
{{end}}</pre>
|
||||||
<h5>{{$.i18n.Tr "repo.settings.webhook.payload"}}</h5>
|
<h5>{{$.i18n.Tr "repo.settings.webhook.payload"}}</h5>
|
||||||
<pre class="raw">{{.PayloadContent}}</pre>
|
<pre class="raw"><code class="json">{{.PayloadContent}}</code></pre>
|
||||||
{{else}}
|
{{else}}
|
||||||
N/A
|
N/A
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<pre class="raw">{{ range $key, $val := .ResponseInfo.Headers }}<strong>{{$key}}:</strong> {{$val}}
|
<pre class="raw">{{ range $key, $val := .ResponseInfo.Headers }}<strong>{{$key}}:</strong> {{$val}}
|
||||||
{{end}}</pre>
|
{{end}}</pre>
|
||||||
<h5>{{$.i18n.Tr "repo.settings.webhook.body"}}</h5>
|
<h5>{{$.i18n.Tr "repo.settings.webhook.body"}}</h5>
|
||||||
<pre class="raw">{{.ResponseInfo.Body}}</pre>
|
<pre class="raw"><code>{{.ResponseInfo.Body}}</code></pre>
|
||||||
{{else}}
|
{{else}}
|
||||||
N/A
|
N/A
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in a new issue