change highlight.js to language-bash
This commit is contained in:
parent
578ff13f60
commit
9cf4401f13
12
static/js/highlight.log.js
Normal file
12
static/js/highlight.log.js
Normal file
@ -0,0 +1,12 @@
|
||||
// static/js/highlight.log.js
|
||||
hljs.registerLanguage('log', function(hljs) {
|
||||
return {
|
||||
contains: [
|
||||
{ className: 'timestamp', begin: /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/, relevance: 10 },
|
||||
{ className: 'level', begin: /\| (INFO|WARNING|ERROR|DEBUG|CRITICAL) +\|/, relevance: 10 },
|
||||
{ className: 'traceback', begin: /Traceback/, end: /$/, contains: [hljs.BACKSLASH_ESCAPE] },
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.NUMBER_MODE
|
||||
]
|
||||
};
|
||||
});
|
||||
@ -15,12 +15,37 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<pre class="bg-dark text-light p-4 rounded" style="max-height: 70vh; overflow-y: auto; font-size: 0.95rem;">
|
||||
<code class="language-log">
|
||||
{{ logs | safe }}
|
||||
</code>
|
||||
</pre>
|
||||
-->
|
||||
<!-- Zeilennummern + Wort-Wrap -->
|
||||
<pre class="bg-dark text-light p-4 rounded hljs" style="max-height: 70vh; overflow-y: auto; font-size: 0.95rem; white-space: pre-wrap; word-wrap: break-word; line-height: 1.5;">
|
||||
<code class="language-bash">
|
||||
{{ logs | safe }}
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
<style>
|
||||
pre code {
|
||||
counter-reset: line;
|
||||
}
|
||||
pre code span {
|
||||
counter-increment: line;
|
||||
}
|
||||
/* Optional: Zeilennummern (braucht CSS) */
|
||||
pre code::before {
|
||||
content: counter(line) " ";
|
||||
display: inline-block;
|
||||
width: 3em;
|
||||
text-align: right;
|
||||
color: #6a9955;
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<a href="{{ url_for('admin') }}" class="btn btn-secondary mt-3">Zurück zum Admin</a>
|
||||
</div>
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
<!-- highlight.js für Syntax-Highlighting in Logs -->
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/default.min.css') }}">
|
||||
<script src="{{ url_for('static', filename='js/highlight.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/highlight.log.js') }}"></script>
|
||||
<script>hljs.highlightAll();</script>
|
||||
|
||||
<!-- Eigenes CSS (optional – später erweitern) -->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user