Skip to content

Commit de56507

Browse files
author
Dimitri POSTOLOV
authoredJul 11, 2024··
[v3] fix vertical margin for nested ordered <ol /> and unordered <ul /> lists (#2969)
* fix * prettier * use pnpm/action-setup@v4
1 parent 7b36102 commit de56507

File tree

11 files changed

+55
-14
lines changed

11 files changed

+55
-14
lines changed
 

‎.changeset/giant-gifts-care.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'nextra-theme-docs': patch
3+
---
4+
5+
fix vertical margin for nested ordered `<ol />` and unordered `<ul />` lists

‎.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Checkout Master
2121
uses: actions/checkout@v4
2222

23-
- uses: pnpm/action-setup@v2.4.0
23+
- uses: pnpm/action-setup@v4
2424

2525
- name: Use Node.js ${{ matrix.node-version }}
2626
uses: actions/setup-node@v4

‎.github/workflows/nextjs-bundle-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- uses: actions/checkout@v4
2828

29-
- uses: pnpm/action-setup@v2.4.0
29+
- uses: pnpm/action-setup@v4
3030

3131
- name: Install Node.js
3232
uses: actions/setup-node@v4

‎.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515

16-
- uses: pnpm/action-setup@v2.4.0
16+
- uses: pnpm/action-setup@v4
1717

1818
- name: Install Node.js
1919
uses: actions/setup-node@v4

‎.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Checkout Master
2323
uses: actions/checkout@v4
2424

25-
- uses: pnpm/action-setup@v2.4.0
25+
- uses: pnpm/action-setup@v4
2626

2727
- name: Use Node.js ${{ matrix.node-version }}
2828
uses: actions/setup-node@v4

‎examples/blog/pages/posts/lists.mdx

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Lists
3+
date: 2024/7/11
4+
description: Example of ordered/unordered nested lists.
5+
tag: web development
6+
author: Dimitri POSTOLOV
7+
---
8+
9+
- **foo**
10+
- bar
11+
- **baz**
12+
- qux
13+
- **qwe**
14+
1. he
15+
1. **be**
16+
1. wo
17+
1. **be** da
18+
- da
19+
- ba

‎examples/swr-site/pages/en/docs/getting-started.mdx

+12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ import { Callout, FileTree, Steps } from 'nextra/components'
55

66
https://google.com/da;djaldhksagfugsufgasuyfgyuasgfuasgdjasbdjasdjkasfuydfasyrdyafsdygasjdgasgdsafgdhjfasgjdfsahjdfsahjgdasgdjkasgdkjasgdkjasgdkagdkjasgdkjagdkjagdkagdkagdkjagdkagdkagdkagda
77

8+
- **foo**
9+
- bar
10+
- **baz**
11+
- qux
12+
- **qwe**
13+
1. he
14+
1. **be**
15+
1. wo
16+
1. **be** da
17+
- da
18+
- ba
19+
820
<Steps>
921
### One
1022
<Steps>

‎packages/nextra-theme-docs/src/components/flexsearch.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export function Flexsearch({
199199
prefix: isFirstItemOfPage && (
200200
<div
201201
className={cn(
202-
'_mx-2.5 _mb-2 _mt-6 _select-none _border-b _border-black/10 _px-2.5 _pb-1.5 _text-xs _font-semibold _uppercase _text-gray-500 first:_mt-0 dark:_border-white/20 dark:_text-gray-300',
202+
'_mx-2.5 _mb-2 [&:not(:first-child)]:_mt-6 _select-none _border-b _border-black/10 _px-2.5 _pb-1.5 _text-xs _font-semibold _uppercase _text-gray-500 dark:_border-white/20 dark:_text-gray-300',
203203
'contrast-more:_border-gray-600 contrast-more:_text-gray-900 contrast-more:dark:_border-gray-50 contrast-more:dark:_text-gray-50'
204204
)}
205205
>

‎packages/nextra-theme-docs/src/components/sidebar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function Separator({ title }: { title: string }): ReactElement {
201201
className={cn(
202202
'[word-break:break-word]',
203203
title
204-
? '_mt-5 _mb-2 _px-2 _py-1.5 _text-sm _font-semibold _text-gray-900 first:_mt-0 dark:_text-gray-100'
204+
? '[&:not(:first-child)]:_mt-5 _mb-2 _px-2 _py-1.5 _text-sm _font-semibold _text-gray-900 dark:_text-gray-100'
205205
: '_my-4'
206206
)}
207207
>

‎packages/nextra-theme-docs/src/mdx-components.tsx

+12-7
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function Details({
134134

135135
return (
136136
<details
137-
className="_my-4 _rounded _border _border-gray-200 _bg-white _p-2 _shadow-sm first:_mt-0 dark:_border-neutral-800 dark:_bg-neutral-900"
137+
className="[&:not(:first-child)]:_mt-4 _rounded _border _border-gray-200 _bg-white _p-2 _shadow-sm dark:_border-neutral-800 dark:_bg-neutral-900"
138138
{...props}
139139
open={delayedOpenState}
140140
data-expanded={openState ? '' : undefined}
@@ -281,22 +281,22 @@ const DEFAULT_COMPONENTS: MDXComponents = {
281281
),
282282
ul: props => (
283283
<ul
284-
className="_mt-6 _list-disc first:_mt-0 ltr:_ml-6 rtl:_mr-6"
284+
className="[:is(ol,ul)_&]:_my-3 [&:not(:first-child)]:_mt-6 _list-disc ltr:_ml-6 rtl:_mr-6"
285285
{...props}
286286
/>
287287
),
288288
ol: props => (
289289
<ol
290-
className="_mt-6 _list-decimal first:_mt-0 ltr:_ml-6 rtl:_mr-6"
290+
className="[:is(ol,ul)_&]:_my-3 [&:not(:first-child)]:_mt-6 _list-decimal ltr:_ml-6 rtl:_mr-6"
291291
{...props}
292292
/>
293293
),
294294
li: props => <li className="_my-2" {...props} />,
295295
blockquote: props => (
296296
<blockquote
297297
className={cn(
298-
'_mt-6 _border-gray-300 _italic _text-gray-700 dark:_border-gray-700 dark:_text-gray-400',
299-
'first:_mt-0 ltr:_border-l-2 ltr:_pl-6 rtl:_border-r-2 rtl:_pr-6'
298+
'[&:not(:first-child)]:_mt-6 _border-gray-300 _italic _text-gray-700 dark:_border-gray-700 dark:_text-gray-400',
299+
'ltr:_border-l-2 ltr:_pl-6 rtl:_border-r-2 rtl:_pr-6'
300300
)}
301301
{...props}
302302
/>
@@ -309,9 +309,14 @@ const DEFAULT_COMPONENTS: MDXComponents = {
309309
),
310310
a: Link,
311311
table: props => (
312-
<Table className="nextra-scrollbar _mt-6 _p-0 first:_mt-0" {...props} />
312+
<Table
313+
className="nextra-scrollbar [&:not(:first-child)]:_mt-6 _p-0"
314+
{...props}
315+
/>
316+
),
317+
p: props => (
318+
<p className="[&:not(:first-child)]:_mt-6 _leading-7" {...props} />
313319
),
314-
p: props => <p className="_mt-6 _leading-7 first:_mt-0" {...props} />,
315320
tr: Tr,
316321
th: Th,
317322
td: Td,

‎packages/nextra/src/client/components/pre.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function Pre({
4141
)
4242

4343
return (
44-
<div className="nextra-code _relative _mt-6 first:_mt-0">
44+
<div className="nextra-code _relative [&:not(:first-child)]:_mt-6">
4545
{filename && (
4646
<div
4747
className={cn(

0 commit comments

Comments
 (0)
Please sign in to comment.