Skip to content

Build your personal knowledge base with Trilium Notes

client: Use correct background for code note preview

Elian Doran1261bdbb2999
diff --git a/src/public/app/services/content_renderer.js b/src/public/app/services/content_renderer.js
index 3593662829..a19c47e5b5 100644
--- a/src/public/app/services/content_renderer.js
+++ b/src/public/app/services/content_renderer.js
@@ -122,10 +122,10 @@ async function renderText(note, $renderedContent) {
async function renderCode(note, $renderedContent) {
const blob = await note.getBlob();
- const $codeBlock = $("<pre>");
+ const $codeBlock = $("<code>");
$codeBlock.text(blob.content);
- applySingleBlockSyntaxHighlight($codeBlock, mime_types.normalizeMimeTypeForCKEditor(note.mime));
- $renderedContent.append($codeBlock);
+ $renderedContent.append($("<pre>").append($codeBlock));
+ await applySingleBlockSyntaxHighlight($codeBlock, mime_types.normalizeMimeTypeForCKEditor(note.mime));
}
function renderImage(entity, $renderedContent, options = {}) {