mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 14:03:24 +09:00
@@ -215,7 +215,7 @@ func renderCellCode(output htmlutil.HTMLWriter, cell Cell, language string) erro
|
|||||||
|
|
||||||
// Highlight code
|
// Highlight code
|
||||||
lexer := highlight.DetectChromaLexerByFileName("", language)
|
lexer := highlight.DetectChromaLexerByFileName("", language)
|
||||||
output.WriteFormat(`<div class="cell-right cell-input"><pre><code class="chroma language-%s">`, strings.ToLower(language))
|
output.WriteFormat(`<div class="cell-right cell-input"><pre><code class="chroma language-%s">`, strings.ToLower(lexer.Config().Name))
|
||||||
output.WriteHTML(highlight.RenderCodeByLexer(lexer, source))
|
output.WriteHTML(highlight.RenderCodeByLexer(lexer, source))
|
||||||
output.WriteHTML("</code></pre></div>")
|
output.WriteHTML("</code></pre></div>")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ func TestIntegrationAndSanitization(t *testing.T) {
|
|||||||
maliciousNotebook := `{
|
maliciousNotebook := `{
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 2,
|
"nbformat_minor": 2,
|
||||||
"metadata": {},
|
"metadata": {"language_info":{"name":"any lang"}},
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@@ -295,8 +295,8 @@ func TestIntegrationAndSanitization(t *testing.T) {
|
|||||||
<div class="cell-line">
|
<div class="cell-line">
|
||||||
<div class="cell-left cell-prompt">In [1]:</div>
|
<div class="cell-left cell-prompt">In [1]:</div>
|
||||||
<div class="cell-right cell-input">
|
<div class="cell-right cell-input">
|
||||||
<pre><code class="chroma language-python">
|
<pre><code class="chroma language-fallback">
|
||||||
<span class="n">a</span><span class="o">=</span><span class="mi">1</span>
|
a=1
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user