Skip to content

Commit

Permalink
fix rendering of code blocks in JupyterLab >=4.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dlqqq committed Nov 12, 2024
1 parent 461bd06 commit 189d54b
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions packages/jupyter-ai/style/rendermime-markdown.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/* ************************************** */

/*
* Styles below are for JupyterLab >=4.0.0,<4.3.0.
*/

/* ************************************** */

.jp-ai-rendermime-markdown .jp-RenderedHTMLCommon {
padding-right: 0;
}
Expand All @@ -20,3 +28,40 @@
.jp-ai-rendermime-markdown mjx-container {
font-size: 119%;
}

/* ************************************** */

/*
* Styles below are for JupyterLab >=4.3.0.
*
* Selectors must be nested in `.jp-ThemedContainer` to have a higher
* specificity than selectors in rules provided by JupyterLab.
*
* See: https://jupyterlab.readthedocs.io/en/latest/extension/extension_migration.html#css-styling
* See also: https://github.com/jupyterlab/jupyter-ai/issues/1090
*/

/* ************************************** */

.jp-ThemedContainer .jp-ai-rendermime-markdown .jp-RenderedHTMLCommon {
padding-right: 0;
}

.jp-ThemedContainer .jp-ai-rendermime-markdown pre {
background-color: var(--jp-cell-editor-background);
overflow-x: auto;
white-space: pre;
margin: 0;
padding: 4px 2px 0 6px;
border: var(--jp-border-width) solid var(--jp-cell-editor-border-color);
}

.jp-ThemedContainer .jp-ai-rendermime-markdown pre > code {
background-color: inherit;
overflow-x: inherit;
white-space: inherit;
}

.jp-ThemedContainer .jp-ai-rendermime-markdown mjx-container {
font-size: 119%;
}

0 comments on commit 189d54b

Please sign in to comment.