docs: fix highlighting of YAML front matter (#6206)

This commit is contained in:
Joshua Chen 2021-12-28 13:19:08 +08:00 committed by GitHub
parent 4f2330a824
commit c8fad02029
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View file

@ -181,7 +181,7 @@ Blog post authors can be declared directly inside the front matter:
<Tabs groupId="author-frontmatter"> <Tabs groupId="author-frontmatter">
<TabItem value="single" label="Single author"> <TabItem value="single" label="Single author">
```yml title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
authors: authors:
name: Joel Marcey name: Joel Marcey
@ -194,7 +194,7 @@ authors:
</TabItem> </TabItem>
<TabItem value="multiple" label="Multiple authors"> <TabItem value="multiple" label="Multiple authors">
```yml title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
authors: authors:
- name: Joel Marcey - name: Joel Marcey
@ -222,7 +222,7 @@ This option works best to get started, or for casual, irregular authors.
Prefer using the `authors` front matter, but the legacy `author_*` front matter remains supported: Prefer using the `authors` front matter, but the legacy `author_*` front matter remains supported:
```yml title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
author: Joel Marcey author: Joel Marcey
author_title: Co-creator of Docusaurus 1 author_title: Co-creator of Docusaurus 1
@ -265,7 +265,7 @@ In blog posts front matter, you can reference the authors declared in the global
<Tabs groupId="author-frontmatter"> <Tabs groupId="author-frontmatter">
<TabItem value="single" label="Single author"> <TabItem value="single" label="Single author">
```yml title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
authors: jmarcey authors: jmarcey
--- ---
@ -274,7 +274,7 @@ authors: jmarcey
</TabItem> </TabItem>
<TabItem value="multiple" label="Multiple authors"> <TabItem value="multiple" label="Multiple authors">
```yml title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
authors: [jmarcey, slorber] authors: [jmarcey, slorber]
--- ---
@ -293,7 +293,7 @@ The `authors` system is very flexible and can suit more advanced use-case:
You can use global authors most of the time, and still use inline authors: You can use global authors most of the time, and still use inline authors:
```yml title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
authors: authors:
- jmarcey - jmarcey
@ -312,7 +312,7 @@ authors:
You can customize the global author's data on per-blog-post basis: You can customize the global author's data on per-blog-post basis:
```yml title="my-blog-post.md" ```md title="my-blog-post.md"
--- ---
authors: authors:
- key: jmarcey - key: jmarcey

View file

@ -58,7 +58,7 @@ export default function page() {
Docusaurus automatically adds `description`, `title`, canonical URL links, and other useful metadata to each Markdown page. They are configurable through front matter: Docusaurus automatically adds `description`, `title`, canonical URL links, and other useful metadata to each Markdown page. They are configurable through front matter:
```yml ```md
--- ---
title: Title for search engines; can be different from the actual heading title: Title for search engines; can be different from the actual heading
description: A short description of this page description: A short description of this page

View file

@ -336,7 +336,11 @@ const config = {
prism: { prism: {
theme: lightTheme, theme: lightTheme,
darkTheme, darkTheme,
additionalLanguages: ['java'], // We need to load markdown again so that YAML is loaded before MD
// and the YAML front matter is highlighted correctly.
// TODO after we have forked prism-react-renderer, we should tweak the
// import order and fix it there
additionalLanguages: ['java', 'markdown'],
}, },
image: 'img/docusaurus-soc.png', image: 'img/docusaurus-soc.png',
// metadata: [{name: 'twitter:card', content: 'summary'}], // metadata: [{name: 'twitter:card', content: 'summary'}],