Skip to content

Commit 7be7f41

Browse files
committed
fix(markdown): reset all margins on code-block pre
1 parent 1b59dd5 commit 7be7f41

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/components/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ export const outlookFallbackProp = {
5858
/**
5959
* Default utility classes for a code-block `<pre>`. `whitespace-pre!` is
6060
* forced important so Gmail's stylesheet can't reset it to `normal`, and
61-
* `mb-0` strips the browser's default `<pre>` bottom margin.
61+
* `m-0` strips the browser's default `<pre>` margins so it isn't spaced
62+
* away from its wrapper.
6263
*/
6364
export function codeBlockPreClass(bg: string): string {
64-
return `font-mono bg-[${bg}] p-4 mb-0 overflow-auto whitespace-pre! [word-wrap:normal] [word-break:normal] [word-spacing:normal]`
65+
return `font-mono bg-[${bg}] p-4 m-0 overflow-auto whitespace-pre! [word-wrap:normal] [word-break:normal] [word-spacing:normal]`
6566
}
6667

6768
/**

src/tests/components/CodeBlock.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('CodeBlock', () => {
7171

7272
expect(html).toMatch(/<pre class="[^"]*\bbg-\[#fff\]/)
7373
expect(html).toMatch(/<pre class="[^"]*\bp-4\b/)
74-
expect(html).toMatch(/<pre class="[^"]*\bmb-0\b/)
74+
expect(html).toMatch(/<pre class="[^"]*\bm-0\b/)
7575
expect(html).toMatch(/<pre class="[^"]*\boverflow-auto\b/)
7676
expect(html).toMatch(/<pre class="[^"]*whitespace-pre!/)
7777
expect(html).toMatch(/<pre class="[^"]*\[word-wrap:normal\]/)

0 commit comments

Comments
 (0)