Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: code output in markdown (#4911)

Myles Scolnicka3bbeebecc80
diff --git a/frontend/src/components/editor/output/Outputs.css b/frontend/src/components/editor/output/Outputs.css
index 2de978ebfe..ff23ef0eff 100644
--- a/frontend/src/components/editor/output/Outputs.css
+++ b/frontend/src/components/editor/output/Outputs.css
@@ -38,6 +38,7 @@
> blockquote,
> details,
div.codehilite,
+ div.codehilite-wrapper,
div.admonition,
/* Target <span> that is not empty and does not consist entirely of child elements;
* this makes sure text with embedded HTML (such as a slider) has a max width,
diff --git a/frontend/src/plugins/core/RenderHTML.tsx b/frontend/src/plugins/core/RenderHTML.tsx
index 0e85bffddc..fa60799ae1 100644
--- a/frontend/src/plugins/core/RenderHTML.tsx
+++ b/frontend/src/plugins/core/RenderHTML.tsx
@@ -81,20 +81,22 @@ const addCopyButtonToCodehilite: TransformFn = (
const CopyableCode = ({ children }: { children: ReactNode }) => {
const id = useId();
return (
- <div className="relative group codehilite" id={id}>
+ <div className="relative group codehilite-wrapper" id={id}>
{children}
- <CopyClipboardIcon
- tooltip={false}
- className="absolute top-2 right-2 p-1 opacity-0 group-hover:opacity-100 transition-opacity"
- value={() => {
- const codeElement = document.getElementById(id)?.firstChild;
- if (codeElement) {
- return codeElement.textContent || "";
- }
- return "";
- }}
- />
+ <div className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <CopyClipboardIcon
+ tooltip={false}
+ className="p-1"
+ value={() => {
+ const codeElement = document.getElementById(id)?.firstChild;
+ if (codeElement) {
+ return codeElement.textContent || "";
+ }
+ return "";
+ }}
+ />
+ </div>
</div>
);
};