Skip to content

Commit 6e1a69a

Browse files
rowanc1agoose77
andauthored
🎨 Update HTML styles for buttons, kbd, etc. (#186)
Co-authored-by: Angus Hollands <goosey15@gmail.com>
1 parent c0b022b commit 6e1a69a

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

‎src/renderers.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ export const renderers: Record<string, NodeRenderer> = {
1818
if (sanitizer !== undefined) {
1919
return (
2020
<span
21+
className="jp-RenderedHTMLCommon not-prose"
2122
dangerouslySetInnerHTML={{ __html: sanitizer.sanitize(node.value) }}
2223
></span>
2324
);
2425
} else {
25-
return <pre> {`${node.value}`} </pre>;
26+
return <pre>{node.value}</pre>;
2627
}
2728
}
2829
};

‎style/preflight.css‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
/* This is a highly simplified version of https://tailwindcss.com/docs/preflight to work with JupyterLab */
77

8-
.myst * {
8+
.myst
9+
:where(*):not(
10+
:where([class~='jp-RenderedHTMLCommon'], [class~='jp-RenderedHTMLCommon'] *)
11+
) {
912
box-sizing: border-box; /* 1 */
1013
border-width: 0; /* 2 */
1114
border-style: solid; /* 2 */
@@ -21,17 +24,26 @@
2124
2. Remove default button styles.
2225
*/
2326

24-
.myst button {
27+
.myst
28+
:where(button):not(
29+
:where([class~='jp-RenderedHTMLCommon'], [class~='jp-RenderedHTMLCommon'] *)
30+
) {
2531
-webkit-appearance: button; /* 1 */
2632
background-color: transparent; /* 2 */
2733
background-image: none; /* 2 */
2834
}
2935

30-
.myst img {
36+
.myst
37+
:where(img):not(
38+
:where([class~='jp-RenderedHTMLCommon'], [class~='jp-RenderedHTMLCommon'] *)
39+
) {
3140
max-width: 100%;
3241
}
3342

34-
.myst figure img {
43+
.myst
44+
:where(figure img):not(
45+
:where([class~='jp-RenderedHTMLCommon'], [class~='jp-RenderedHTMLCommon'] *)
46+
) {
3547
display: block;
3648
max-width: 100%;
3749
}

0 commit comments

Comments
 (0)