Skip to content

Commit 16f6df8

Browse files
committed
fix: frontmatter prose do not work on mdx
1 parent 4f9b1e9 commit 16f6df8

15 files changed

Lines changed: 88 additions & 32 deletions

File tree

apps/site/pages/howto/add-a-layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function MinimalLayout(layoutProps: LayoutProps) {
2727
<Html {...layoutProps}>
2828
<Head {...layoutProps} />
2929
<Body {...layoutProps}>
30-
<main className={layoutProps.page.frontmatter?.prose && "prose"}>
30+
<main className={layoutProps.context.meta.isProsePage ? "prose" : ""}>
3131
{layoutProps.page.contentElement}
3232
</main>
3333
</Body>

apps/site/pages/reference/markdown-component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Markdown Component
33
---
44

5-
Markdown component are [components](component.md#type) that can be used:
5+
Markdown components are [components](component.md#type) that can be used:
66

77
* in [mdx pages](mdx.md)
88
* in [md pages](md-page.md) if the chosen format is `mdc` or `mdx`

apps/site/pages/reference/tailwind.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,41 @@ So you can:
99

1010
* apply any [Tailwind class](https://tailwindcss.com/docs/styling-with-utility-classes)
1111
* configure it and add [custom styles](https://tailwindcss.com/docs/adding-custom-styles) in
12-
the [global CSS file](#global-css-file)
12+
the [global CSS file](#configuration)
1313

14-
## Global CSS File
14+
## Configuration
1515

1616
The [global CSS file](styling.md#global-css-file) is the tailwind entry point.
1717

18-
### Default
18+
We follow the [shadcn convention with CSS Variable](https://ui.shadcn.com/docs/theming).
19+
1920

20-
The default global CSS file import:
21+
### Imports and plugins
2122

22-
* tailwind source (ie)
23+
The default global CSS file import
2324

2425
```css
2526
@import "tailwindcss";
2627
@import "tw-animate-css";
2728
@import "shadcn/tailwind.css";
29+
30+
@plugin "@tailwindcss/typography";
2831
```
2932

30-
* and our utilities classes:
31-
* for the [grid system](../components/grid.md)
32-
* `icon`
33-
* and default publishing style for headings, list, ...
33+
where `@tailwindcss/typography` is used for [Prose content](styling.md#prose-content)
34+
that sets the default publishing style for headings, list, ...
35+
36+
### Utilities class
37+
38+
* for the [grid system](../components/grid.md)
39+
* `icon`
3440

35-
We follow the [shadcn convention with CSS Variable](https://ui.shadcn.com/docs/theming).
3641

37-
### Custom
42+
## Custom Implementation
3843

3944
A custom default minimal implementation of the [global CSS file](styling.md#global-css-file) would
4045

41-
* import the [default interact configuration](#default)
46+
* import the [default interact configuration](#configuration)
4247
* and add
4348
* the custom `components` directory
4449
* and the [pages directory](directory-layout.md)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"@svgr/core": "8.1.0",
4949
"@svgr/plugin-jsx": "8.1.0",
5050
"@svgr/plugin-svgo": "8.1.0",
51+
"@tailwindcss/typography": "0.5.19",
5152
"@tailwindcss/vite": "4.2.2",
5253
"@vitejs/plugin-react": "5.1.4",
5354
"@vitejs/plugin-rsc": "0.5.21",

src/interact/componentsProvider/contextProps.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export type ContextProps = {
1919
isRscActionRequest: boolean // true if this is a server action call (POST request)
2020
rscActionId?: string // server action ID from x-rsc-action header
2121
isMarkdownRequest: boolean // true if this is a Markdown request
22-
lastModified?: string; // last time modified (iso string)
22+
lastModifiedPage?: string; // last modified time of the page (iso string)
23+
isProsePage?: boolean // treats the page has prose content and add a prose class
2324
} & Record<string, string | boolean | undefined>
2425
response: {
2526
status?: number

src/resources/components/interact/AnchorSkinnable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ export default function AnchorSkinnable({
5151
}
5252
{variant === 'link' && children}
5353
{variant === 'button' && (
54-
<div className={"flex flex-row items-center justify-between w-full"}>
54+
<div className={"flex flex-row items-center justify-between w-full text-primary"}>
5555
<span>{children}</span>
56-
<Arrow className={"text-primary align-bottom"} width="14"/>
56+
<Arrow className={"align-bottom"} width="14"/>
5757
</div>
5858
)}
5959
</Anchor>

src/resources/components/layouts/Hamburger.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function Hamburger(layoutProps: LayoutProps) {
2323
cn(
2424
interactConfig.template.container.containerClass,
2525
"position-relative",
26-
layoutProps.page.frontmatter?.prose && "prose"
26+
layoutProps.context.meta.isProsePage && "prose"
2727
)}>
2828
<main>
2929
{layoutProps.page.contentElement}

src/resources/components/layouts/Holy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function Holy(layoutProps: LayoutProps) {
3838
<Toc {...layoutProps} />
3939
</div>
4040
<div id="main-content"
41-
className={cn(styles['mainContent'], layoutProps.page.frontmatter?.prose && "prose" )}>
41+
className={cn(styles['mainContent'], layoutProps.context.meta.isProsePage && "prose" )}>
4242
{layoutProps.page.contentElement}
4343
</div>
4444
<div id="main-side" className={

src/resources/components/layouts/HolyProse.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function HolyProse(layoutProps: LayoutProps) {
2828
"position-relative mt-3"
2929
)}>
3030
<main id="page-main"
31-
className={cn(styles["pageMain"], layoutProps.page.frontmatter?.prose && "prose")}>
31+
className={cn(styles["pageMain"], layoutProps.context.meta.isProsePage && "prose")}>
3232
<div id="main-header" className={styles['mainHeader']}>
3333
{layoutProps.page?.frontmatter?.hero != "false" && <Hero {...layoutProps} />}
3434
</div>

src/resources/components/layouts/Landing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function Landing(layoutProps: LayoutProps) {
1616
<Head {...layoutProps}/>
1717
<Body {...layoutProps}>
1818
<Header {...layoutProps} />
19-
<main className={layoutProps.page.frontmatter?.prose ? "prose" : ""}>
19+
<main className={layoutProps.context.meta.isProsePage ? "prose" : ""}>
2020
{layoutProps.page.contentElement}
2121
</main>
2222
<Footer {...layoutProps} />

0 commit comments

Comments
 (0)