Skip to content

Commit 5c4f2c5

Browse files
authored
feat: Intro (#334)
1 parent 930c6e8 commit 5c4f2c5

File tree

7 files changed

+43
-3
lines changed

7 files changed

+43
-3
lines changed

docs/getting-started/authoring.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ sourcecode: docs/getting-started/authoring.mdx
55
nav: 1
66
---
77

8+
<Intro>
9+
This is a guide on how to write documentation. We support all [GitHub Flavored Markdown](https://github.github.com/gfm/) syntax, plus some custom components that are described here.
10+
</Intro>
11+
812
In your `MDX` folder, create any `path/to/my-document.mdx`:
913

1014
```md
@@ -37,6 +41,26 @@ You can use any [GitHub Flavored Markdown](https://github.github.com/gfm/) synta
3741

3842
Plus, all exported [`components/mdx/index.tsx`](components/mdx/index.tsx) MDX components.
3943

44+
### Intro
45+
46+
```md
47+
<Intro>
48+
This is an intro. Here you can write a short description of the article, longer than the `description`, eventually with [links](#void), lists, etc.
49+
50+
Multiple paragraphs are also possible, or anything.
51+
</Intro>
52+
```
53+
54+
<details>
55+
<summary>Result</summary>
56+
57+
<Intro>
58+
This is an intro. Here you can write a short description of the article, longer than the `description`, eventually with [links](#void), lists, etc.
59+
60+
Multiple paragraphs are also possible, or anything.
61+
</Intro>
62+
</details>
63+
4064
### `Img`
4165

4266
Relative images are supported. Eg, inside your [`MDX`](introduction#configuration:~:text=MDX) folder:

docs/getting-started/github-actions.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ description: Call from your CI
44
nav: 3
55
---
66

7-
`pmndrs/docs` provides a [`build.yml`](.github/workflows/build.yml) reusable workflow, any project can use:
7+
<Intro>
8+
This project provides a [`build.yml` reusable workflow](https://docs.github.com/en/actions/sharing-automations/reusing-workflows#calling-a-reusable-workflow) you can easily call from your own project workflow.
9+
</Intro>
10+
11+
In your `.github/workflows` folder, create a eg. `docs.yml` file:
812

913
```yml
1014
uses: pmndrs/docs/.github/workflows/build.yml@v2

docs/getting-started/introduction.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ description: Documentation generator for `pmndrs/*` projects.
44
nav: 0
55
---
66

7+
<Intro>
8+
A static MDX documentation generator, with a GitHub [reusable workflow](./github-actions.mdx). It is primarily used for some `pmndrs/*` projects, but will work for anyone.
9+
</Intro>
10+
711
![Gutenberg lithography](gutenberg.jpg)
812

913
[Those projects](https://github.com/search?q=%22uses%3A+pmndrs%2Fdocs%2F.github%2Fworkflows%2Fbuild.yml%22+language%3AYAML&type=code&l=YAML) are known to be using this generator.

src/app/[...slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default async function Page({ params }: Props) {
3737

3838
return (
3939
<>
40-
<div className={cn('my-8 border-b', 'border-outline-variant/50')}>
40+
<div className={cn('mb-6 mt-8 border-b', 'border-outline-variant/50')}>
4141
<h1 className="mb-2 text-5xl font-bold tracking-tighter">{doc.title}</h1>
4242
{!!doc?.description?.length && (
4343
<p className={cn('my-2 text-base leading-5', 'text-on-surface-variant/50')}>

src/components/mdx/Intro/Intro.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import cn from '@/lib/cn'
2+
import { ComponentProps } from 'react'
3+
4+
export function Intro({ className, ...props }: ComponentProps<'div'>) {
5+
return <div {...props} className={cn(className, 'my-6 text-xl leading-relaxed')} />
6+
}

src/components/mdx/Intro/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './Intro'

src/components/mdx/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export * from './Gha'
55
export * from './Grid'
66
export * from './Hint'
77
export * from './Img'
8+
export * from './Intro'
89
export * from './Summary'
910
export * from './Toc'
1011

@@ -54,7 +55,7 @@ export const ol = ({ className, ...props }: ComponentProps<'ol'>) => (
5455
)
5556
export const li = (props: ComponentProps<'li'>) => <li className="my-1" {...props} />
5657

57-
export const p = (props: ComponentProps<'p'>) => <p className="my-4 text-base" {...props} />
58+
export const p = (props: ComponentProps<'p'>) => <p className="my-4" {...props} />
5859

5960
export const hr = (props: ComponentProps<'hr'>) => (
6061
<hr className="my-4 mb-8 border-outline-variant/50" {...props} />

0 commit comments

Comments
 (0)