Skip to content

Commit

Permalink
[v3] support for h2 and h4 headings with steps component (#3237)
Browse files Browse the repository at this point in the history
* [v3] support h2 headings with steps component

* support for h2 and h4 headings with steps component

* polish

---------

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
  • Loading branch information
87xie and dimaMachina committed Sep 17, 2024
1 parent 34035ca commit 982862f
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-masks-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nextra': patch
---

Support for `h2` and `h4` Markdown headings with the Steps component.
26 changes: 26 additions & 0 deletions examples/blog/pages/posts/callout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,32 @@ Contents for step 2.

</Steps>

<Steps>
## Test
Run pnpm test

<Steps>
### nextra:test

### nextra-theme-docs:test

<Steps>
#### more

#### more more

#### more more more

</Steps>

### nextra-theme-blog:test

</Steps>

## Lint

</Steps>

## Tabs

{/* prettier-ignore */}
Expand Down
43 changes: 36 additions & 7 deletions examples/swr-site/pages/en/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,46 @@ https://google.com/da;djaldhksagfugsufgasuyfgyuasgfuasgdjasbdjasdjkasfuydfasyrdy
</details>

<Steps>
### One
## Step 1
<Steps>
### Two
### Three
### Step 1.1

### Step 1.2

</Steps>
## Step 2

<Steps>
### Step 2.1

### Step 2.2

</Steps>
### Four
</Steps>

## Development

<Steps>
### Install Dependencies

Run `pnpm install` in the project root directory.

### Lint

<Steps>
### Five
### Six
#### Lint ESLint

run `pnpm lint`

#### Lint Prettier

run `pnpm lint:prettier --write` to format the entire project.

</Steps>
### Seven

### Test

Run `pnpm test`

</Steps>

Expand Down
22 changes: 14 additions & 8 deletions packages/nextra/styles/steps.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
.nextra-steps h3 {
counter-increment: var(--counter-id);
.nextra-steps {
h2,
h3,
h4 {
counter-increment: var(--counter-id);
/* resets from nextra-theme-docs */
@apply _border-0 _pb-0 _font-semibold _tracking-tight _mt-8 _text-2xl;

&:before {
@apply _absolute _size-[33px];
@apply _border-4 _border-[rgb(var(--nextra-bg))] _bg-gray-100 dark:_bg-neutral-800;
@apply _rounded-full _text-neutral-400 _text-base _font-normal _text-center _-indent-px;
@apply _mt-[3px] _ml-[-41px];
content: counter(var(--counter-id));
&:before {
@apply _absolute _size-[33px];
@apply _border-4 _border-[rgb(var(--nextra-bg))] _bg-gray-100 dark:_bg-neutral-800;
@apply _rounded-full _text-neutral-400 _text-base _font-normal _text-center _-indent-px;
@apply _mt-[3px] _ml-[-41px];
content: counter(var(--counter-id));
}
}
}

0 comments on commit 982862f

Please sign in to comment.