Skip to content

Commit baefece

Browse files
authored
ensure h1 # ... is a first heading on pages, fix 100vh height for 404 page on mobiles (#1669)
* more * more * more * more * fix height for 404 page * remove * remove some spaces to keep height for all examples less for 2 lines
1 parent fd766cd commit baefece

File tree

17 files changed

+96
-36
lines changed

17 files changed

+96
-36
lines changed

.eslintrc.cjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ module.exports = {
5959
settings: {
6060
"mdx/code-blocks": true,
6161
},
62+
rules: {
63+
"mdx/remark": "error",
64+
},
6265
},
6366
{
6467
files: [`**/*.{${MARKDOWN_EXT}}/*.{${CODE_EXT}}`],
@@ -70,5 +73,15 @@ module.exports = {
7073
"no-prototype-builtins": "off",
7174
},
7275
},
76+
{
77+
files: [
78+
`src/pages/blog/**/*.{${MARKDOWN_EXT}}`,
79+
`src/code/**/*.{${MARKDOWN_EXT}}`,
80+
],
81+
rules: {
82+
// Disable `remark-lint-first-heading-level` since in blogs we don't want to enforce the first heading to be an `h1`
83+
"mdx/remark": "off",
84+
},
85+
},
7386
],
7487
}

.remarkrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
plugins: [
3+
"frontmatter", // Required to parse frontmatter for linting
4+
"remark-lint-first-heading-level",
5+
],
6+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
"eslint-plugin-mdx": "^3.1.5",
7373
"eslint-plugin-tailwindcss": "3.15.1",
7474
"prettier": "3.2.5",
75+
"remark-frontmatter": "5.0.0",
76+
"remark-lint-first-heading-level": "3.1.2",
7577
"typescript": "^5.4.3"
7678
},
7779
"pnpm": {

pnpm-lock.yaml

Lines changed: 29 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/not-found.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function Page() {
2121
}/issues/new?title=${encodeURIComponent(title)}&labels=${labels}`
2222

2323
return (
24-
<div className="flex h-screen items-center justify-center flex-col">
24+
<div className="flex h-dvh items-center justify-center flex-col">
2525
<h1 className="text-white text-4xl">404: Page Not Found</h1>
2626
<a
2727
href={url}

src/components/code-blocks/code2.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ class Character {
55
getName() {
66
return this._name
77
}
8-
98
// homeWorld: Planet
109
getHomeWorld() {
1110
return fetchHomeworld(this._homeworldID)
1211
}
13-
1412
// friends: [Character]
1513
getFriends() {
1614
return this._friendIDs.map(fetchCharacter)

src/pages/community/events.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
---
22
title: Events & Meetups
3-
description:
43
---
54

5+
{/* title can be removed in Nextra 4, since sidebar title will take from first h1 */}
6+
7+
# Events & Meetups
8+
69
import { LocationIcon, ClockIcon } from "../../icons"
710
import { clsx } from "clsx"
811
import { useEffect } from "react"
@@ -90,7 +93,7 @@ export function Events({ events }) {
9093
)
9194
}
9295

93-
## Upcoming Events
96+
## Events
9497

9598
<Events events={upcomingEvents} />
9699

src/pages/graphql-js/error.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: graphql/error
33
---
44

5+
{/* title can be removed in Nextra 4, since sidebar title will take from first h1 */}
6+
7+
# `graphql/error`
8+
59
The `graphql/error` module is responsible for creating and formatting
610
GraphQL errors. You can import either from the `graphql/error` module, or from the root `graphql` module. For example:
711

src/pages/graphql-js/execution.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: graphql/execution
33
---
44

5+
{/* title can be removed in Nextra 4, since sidebar title will take from first h1 */}
6+
7+
# `graphql/execution`
8+
59
The `graphql/execution` module is responsible for the execution phase of
610
fulfilling a GraphQL request. You can import either from the `graphql/execution` module, or from the root `graphql` module. For example:
711

src/pages/graphql-js/graphql-http.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: graphql-http
33
---
44

5+
{/* title can be removed in Nextra 4, since sidebar title will take from first h1 */}
6+
7+
# `graphql-http`
8+
59
The [official `graphql-http` package](https://github.com/graphql/graphql-http) provides a simple way to create a fully compliant GraphQL server. It has a handler for Node.js native [`http`](https://nodejs.org/api/http.html), together with handlers for well-known frameworks like [Express](https://expressjs.com/), [Fastify](https://www.fastify.io/) and [Koa](https://koajs.com/); as well as handlers for different runtimes like [Deno](https://deno.land/) and [Bun](https://bun.sh/).
610

711
## Express

0 commit comments

Comments
 (0)