Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/site-kit/src/lib/markdown/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,13 @@ export async function render_content_markdown(
? await generate_ts_from_js(source, token.lang, options)
: undefined;

let html = '<div class="code-block"><div class="controls">';
let html = '<div class="code-block">';

const needs_controls = options.link || options.copy || converted;

if (needs_controls) {
html += '<div class="controls">';
}

if (options.file) {
const ext = options.file.slice(options.file.lastIndexOf('.'));
Expand All @@ -243,7 +249,9 @@ export async function render_content_markdown(
html += `<button class="copy-to-clipboard raised" title="Copy to clipboard" aria-label="Copy to clipboard"></button>`;
}

html += '</div>';
if (needs_controls) {
html += '</div>';
}

html += await syntax_highlight({ filename, language: token.lang, prelude, source, check });

Expand Down
Loading