Skip to content

Commit baefece

Browse files
authored
ensure h1 # ... is a first heading on pages, fix 100vh height for 404 page on mobiles (graphql#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

17 files changed

+96
-36
lines changed

.eslintrc.cjs

+13
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

+6
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

+2
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

+29-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/not-found.tsx

+1-1
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

-2
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

+5-2
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

+4
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

+4
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

+4
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

src/pages/graphql-js/graphql.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: graphql
33
---
44

5+
{/* title can be removed in Nextra 4, since sidebar title will take from first h1 */}
6+
7+
# `graphql`
8+
59
The `graphql` module exports a core subset of GraphQL functionality for creation
610
of GraphQL type systems and servers.
711

src/pages/graphql-js/index.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ title: Getting Started With GraphQL.js
33
sidebarTitle: Getting Started
44
---
55

6+
{/* title can be removed in Nextra 4, since sidebar title will take from first h1 */}
7+
8+
# Getting Started With GraphQL.js
9+
610
## Prerequisites
711

812
Before getting started, you should have Node v6 installed, although the examples should mostly work in previous versions of Node as well. For this guide, we won't use any language features that require transpilation, but we will use some ES6 features like [Promises](http://www.html5rocks.com/en/tutorials/es6/promises/), [classes](http://javascriptplayground.com/blog/2014/07/introduction-to-es6-classes-tutorial/), and [fat arrow functions](https://strongloop.com/strongblog/an-introduction-to-javascript-es6-arrow-functions/), so if you aren't familiar with them you might want to read up on them first.

src/pages/graphql-js/language.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: graphql/language
33
---
44

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

711
```js

src/pages/graphql-js/type.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: graphql/type
33
---
44

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

711
```js

src/pages/graphql-js/utilities.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: graphql/utilities
33
---
44

5+
{/* title can be removed in Nextra 4, since sidebar title will take from first h1 */}
6+
7+
# `graphql/utilities`
8+
59
The `graphql/utilities` module contains common useful computations to use with
610
the GraphQL language and type objects. You can import either from the `graphql/utilities` module, or from the root `graphql` module. For example:
711

src/pages/graphql-js/validation.mdx

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: graphql/validation
33
---
44

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

@@ -12,17 +16,15 @@ var { validate } = require("graphql/validation") // CommonJS
1216

1317
## Overview
1418

15-
<ul class="apiIndex">
19+
<ul className="apiIndex">
1620
<li>
1721
<a href="#validate">
18-
<pre>function validate</pre>
19-
Validates an AST against a provided Schema.
22+
`function validate` Validates an AST against a provided Schema.
2023
</a>
2124
</li>
2225
<li>
2326
<a href="#specifiedrules">
24-
<pre>var specifiedRules</pre>
25-
A list of standard validation rules described in the GraphQL specification.
27+
`var specifiedRules` A list of standard validation rules described in the GraphQL specification.
2628
</a>
2729
</li>
2830
</ul>

0 commit comments

Comments
 (0)