Skip to content

Commit ce73c24

Browse files
authored
fix inline code font size in headings (#48)
1 parent 7ec8857 commit ce73c24

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

.changeset/khaki-mugs-cover.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@primer/doctocat-nextjs': patch
3+
---
4+
5+
- Fix inline code font-size in markdown headings. Now inherits size used in the heading.
6+
- Increased spacing below React code blocks, which was previously too small.

packages/site/content/content-example/kitchen-sink.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,7 @@ flowchart LR
115115
<Grid.Column span={2}></Grid.Column>
116116
</Grid>
117117
```
118+
119+
## Heading with `inline code`
120+
121+
This heading has an inline code element in it. The code will be displayed at the same font size as the regular text.

packages/theme/components/layout/code-block/ReactCodeBlock.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.CodeBlock {
2+
--spacing: var(--base-size-40);
23
margin-block: var(--base-size-24);
34
background-color: var(--brand-color-canvas-default);
45
border: var(--brand-borderWidth-thin) solid var(--brand-color-border-default);

packages/theme/css/prose.module.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@
211211
background-color: var(--base-color-scale-indigo-0);
212212
}
213213

214+
/* Inline code inside headings should inherit font-size */
215+
.Prose :is(h1, h2, h3, h4, h5, h6):has(code) code:not(:global(.custom-component) code) {
216+
font-size: inherit;
217+
}
218+
214219
[data-color-mode='dark'] .Prose code:not(:global(.custom-component) code) {
215220
background-color: var(--base-color-scale-indigo-9);
216221
}

0 commit comments

Comments
 (0)