【问题标题】:React docs --> GitHub markdown files that use special table syntaxReact docs --> 使用特殊表格语法的 GitHub 降价文件
【发布时间】:2017-03-15 15:28:08
【问题描述】:

如果您查看React docs markdown file(用于生成docs html pages),您会在最顶部看到一个值的(在.md 中,而不是.html)。如果您查看用于创建表格的实际 Markdown 语法,您会看到 非标准表格语法

---
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 资源都建议表是这样创建的:

来自https://guides.github.com/features/mastering-markdown/

表格

您可以通过组合单词列表​​并划分它们来创建表格 用连字符-(第一行),然后分隔每一列 用管道|:

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

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

【问题讨论】:

    标签: reactjs github markdown github-flavored-markdown


    【解决方案1】:

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

    正如 Waylan 所评论的,值得注意的是,在 Markdown 实际被解析之前,静态站点生成器通常会删除前面的内容 - 因此它不会出现在 React 文档页面中。

    * 包括Jekyll,这是React's docsGitHub Pages 使用的

    【讨论】:

    • 补充一点可能会有所帮助:使用 frontmatter 的工具通常会在将 Markdown 文本传递给 Markdown 解析器之前删除元数据。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 2018-07-03
    • 1970-01-01
    • 2014-02-14
    • 1970-01-01
    相关资源
    最近更新 更多