React 文档 --> GitHub 使用特殊 table 语法的降价文件

React docs --> GitHub markdown files that use special table syntax

如果您查看 React docs markdown file (which are used to generate the docs html pages),您会在最顶部看到 table 个值(在 .md,而不是 .html)。如果您查看用于创建 table 的实际降价语法,您会看到 非标准 table 语法 :

---
id: hello-world
title: Hello World
permalink: docs/hello-world.html
prev: installation.html
next: introducing-jsx.html
redirect_from:
  - "docs/index.html"
  - "docs/getting-started.html"
  - "docs/getting-started-ko-KR.html"
  - "docs/getting-started-zh-CN.html"
---

我能找到的所有 GitHub/markdown 资源表明 table 是这样创建的:

From https://guides.github.com/features/mastering-markdown/

Tables

You can create tables by assembling a list of words and dividing them with hyphens - (for the first row), and then separating each column with a pipe |:

First Header | Second Header
------------ | -------------
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column

我已经用尽了我的谷歌搜索技巧,想知道是否有人知道这是否是一个已记录的功能,以及该文档可能在哪里?

那是 YAML front matter,许多静态站点生成器* 允许将其作为向文档添加元数据的一种方式。它实际上并不是 Markdown 本身的一部分 - GitHub 只是为它提供了漂亮的样式,因为它是如此常用。

正如 Waylan 评论的那样,值得注意的是,在 Markdown 实际被解析之前,静态站点生成器通常会删除前面的内容——这就是为什么它没有出现在 React 文档页面中的原因。

* 包括 Jekyll, which is what React's docs and GitHub Pages 使用