diff --git a/webui2/src/components/code/file-viewer.tsx b/webui2/src/components/code/file-viewer.tsx index 41514cf392655e450ea0a4bf7894897968682294..0177d3a6942e86f4e5f58f7f122ccdc5a09020dd 100644 --- a/webui2/src/components/code/file-viewer.tsx +++ b/webui2/src/components/code/file-viewer.tsx @@ -95,6 +95,9 @@ function lineNumberTransformer(): ShikiTransformer { return { line(node, line) { node.properties["dataLineNumber"] = line; + // Append a \n text node inside each .line so copy-paste preserves newlines + // (we strip the inter-element whitespace nodes in code() below). + node.children.push({ type: "text", value: "\n" }); }, // Remove whitespace text nodes between .line spans — they create // empty anonymous table rows when using display: table-row.