Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more incorrect markdown langs #41939

Merged
merged 1 commit into from Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/advanced-features/react-18/switchable-runtime.md
Expand Up @@ -12,12 +12,13 @@ By default, Next.js uses the Node.js runtime. [Middleware](https://nextjs.org/do

To configure the runtime for your whole application, you can set the experimental option `runtime` in your `next.config.js` file:

```js:next.config.js
```js
// next.config.js
module.exports = {
experimental: {
runtime: 'experimental-edge', // 'node.js' (default) | experimental-edge
},
};
}
```

You can detect which runtime you're using by looking at the `process.env.NEXT_RUNTIME` Environment Variable during runtime, and examining the `options.nextRuntime` variable during compilation.
Expand Down
27 changes: 17 additions & 10 deletions docs/api-reference/next/font.md
Expand Up @@ -194,26 +194,29 @@ If you would like to set your styles in an external style sheet and specify addi

In addition to importing the font, also import the CSS file where the CSS variable is defined and set the variable option of the font loader object as follows:

```tsx:app/page.tsx
import { Inter } from '@next/font/google';
import styles from '../styles/component.module.css';
```tsx
// app/page.tsx
import { Inter } from '@next/font/google'
import styles from '../styles/component.module.css'

const inter = Inter({
variable: '--inter-font',
});
})
```

To use the font, set the `className` of the parent container of the text you would like to style to the font loader's `variable` value and the `className` of the text to the `styles` property from the external CSS file.

```tsx:app/page.tsx
```tsx
// app/page.tsx
<main className={inter.variable}>
<p className={styles.text}>Hello World</p>
</main>
```

Define the `text` selector class in the `component.module.css` CSS file as follows:

```css:styles/component.module.css
```css
/* styles/component.module.css */
.text {
font-family: var(--inter-font);
font-weight: 200;
Expand All @@ -231,7 +234,8 @@ For example, create a `fonts.ts` file in a `styles` folder at the root of your a

Then, specify your font definitions as follows:

```ts:styles/fonts.ts
```ts
// styles/fonts.ts
import { Inter, Lora, Source_Sans_Pro } from '@next/font/google';
import localFont from '@next/font/local';

Expand All @@ -249,7 +253,8 @@ export { inter, lora, sourceCodePro400, sourceCodePro700, greatVibes };

You can now use these definitions in your code as follows:

```tsx:app/page.tsx
```tsx
// app/page.tsx
import { inter, lora, sourceCodePro700, greatVibes } from '../styles/fonts';

export default function Page() {
Expand All @@ -268,7 +273,8 @@ export default function Page() {

To make it easier to access the font definitions in your code, you can define a path alias in your `tsconfig.json` or `jsconfig.json` files as follows:

```json:tsconfig.json
```json
// tsconfig.json
{
"compilerOptions": {
"paths": {
Expand All @@ -280,7 +286,8 @@ To make it easier to access the font definitions in your code, you can define a

You can now import any font definition as follows:

```tsx:app/about/page.tsx
```tsx
// app/about/page.tsx
import { greatVibes, sourceCodePro400 } from '@/fonts';
``` -->

Expand Down
10 changes: 6 additions & 4 deletions docs/basic-features/font-optimization.md
Expand Up @@ -77,20 +77,22 @@ This can be done in 2 ways:

- On a font per font basis by adding it to the function call

```tsx:app/layout.tsx
const inter = Inter({ subsets: ["latin"] });
```tsx
// app/layout.tsx
const inter = Inter({ subsets: ['latin'] })
```

- Globally for all your fonts in your `next.config.js`

```js:next.config.js
```js
// next.config.js
module.exports = {
experimental: {
fontLoaders: [
{ loader: '@next/font/google', options: { subsets: ['latin'] } },
],
},
};
}
```

- If both are configured, the subset in the function call is used.
Expand Down