Skip to content

Commit 1381a68

Browse files
committed
Fix Heading in hint blocks are huge in published content
Also fix `flip-heading-hash` behaviour which wasn't working anymore
1 parent 64f3596 commit 1381a68

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

packages/gitbook/src/components/DocumentView/Heading.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ export function Heading(props: BlockProps<DocumentBlockHeading>) {
3636
<HashLinkButton
3737
id={id}
3838
block={block}
39-
className={tcls('-ml-6', 'pr-2')}
39+
className={tcls(
40+
'-ml-6 pr-2',
41+
'[.flip-heading-hash_&]:order-last [.flip-heading-hash_&]:ml-1 [.flip-heading-hash_&]:pl-2'
42+
)}
4043
iconClassName={tcls('size-4')}
4144
label="Direct link to heading"
4245
/>

packages/gitbook/src/components/DocumentView/Hint.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export function Hint({
6565
{hasHeading ? (
6666
<Block
6767
style={tcls(
68-
'w-full items-start py-4! pl-3 text-[1em] *:flex-none',
68+
'w-full items-start py-4! pl-3 text-[1em]! *:flex-none',
6969
// Heading hash styles
70-
'flip-heading-hash pr-8',
70+
'flip-heading-hash pr-8 [&_.hash]:bg-transparent',
7171
hintStyle.header
7272
)}
7373
ancestorBlocks={[...ancestorBlocks, block]}

packages/gitbook/src/components/DocumentView/ListItem.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ export function ListItem(props: BlockProps<DocumentBlockListItem>) {
3232
ancestorBlocks={[...ancestorBlocks, block]}
3333
blockStyle={tcls(
3434
'min-h-lh',
35-
// flip heading hash icon if list item is a heading
36-
'flip-heading-hash',
3735
// remove margin-top for the first heading in a list
3836
'[h2]:pt-0',
3937
'[h3]:pt-0',

packages/gitbook/src/components/RootLayout/globals.css

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,6 @@
276276
/* Don't apply antialiased to `code` and `pre` elements */
277277
@apply subpixel-antialiased;
278278
}
279-
280-
.flip-heading-hash {
281-
@apply [h1,h2,h3,h4]:content-start;
282-
@apply [h1,h2,h3,h4]:auto-cols-[auto_1fr];
283-
@apply [&:is(h1,h2,h3,h4)>div:first-child]:[grid-area:1/2];
284-
@apply [&:is(h1,h2,h3,h4)>div:first-child]:ml-1;
285-
}
286279
}
287280

288281
html {

0 commit comments

Comments
 (0)