markdown - 可折叠部分的内容(<details><summary>...)在 GitHub 存储库中呈现 Markdown ,但在 GitHub 页面上不呈现

标签 markdown jekyll github-pages kramdown

在 GitHub 存储库的 README 中,可折叠部分内的 markdown 会根据需要呈现。

enter image description here

但是在 GitHub Pages 上,markdown 没有呈现,只是字面意思。

enter image description here

_config.yml本质上是空的。

问题中提到了Markdown inside and not being processed ,建议的修复方法是:

markdown: kramdown
kramdown:
  parse_block_html: true

这确实修复了内容的呈现,我可以切换到 kramdown,但它会破坏 <details> 的呈现和 <summary>和旋转。 (所以我回滚了它。)

相关的 HTML 和 markdown 是:

<details><summary><strong>About transliteration</strong></summary>

About half of the billions of internet users speak languages written in non-Latin alphabets, like Russian, Arabic, Hebrew, Chinese, Greek, Armenian and Hindi.  Very often, they haphazardly use the Latin alphabet to write those languages.

`Привет`: `Privet`, `Privyet`, `Priwjet`, ...  
`كيف حالك`: `kayf halk`, `keyf 7alek`, ...  
`Բարև Ձեզ`: `Barev Dzez`, `Barew Dzez`, ...  

... ... ...

</details>

有没有办法在不使用 kramdown(并且不使用原始 HTML)的情况下强制渲染?或者有没有办法用 kramdown 制作一个可折叠的部分?

完整的 repo 当然在 github.com/deepchar/deepchar.github.io 上.

最佳答案

正如 Waylan 在评论中指出的那样,GitHub 存储库中的 markdown(如 README.md)是使用 Commonmark 呈现的。

repo github.com/github/jekyll-commonmark-ghpages#installation提到对 GitHub Pages 的支持正在进行中,并提供了一些说明。

Installation

Add the following to your Gemfile:

group :jekyll_plugins do
  gem 'jekyll-commonmark-ghpages'
end

and modify your _config.yml to use CommonMarkGhPages as your Markdown converter:

markdown: CommonMarkGhPages

This processor is currently in testing for use in GitHub Pages.

To specify extensions and options for use in converting Markdown to HTML, supply options to the Markdown converter:

commonmark:
  options: ["SMART", "FOOTNOTES"]
  extensions: ["strikethrough", "autolink", "tables"]

为了让它工作(截至 2018 年 10 月),我所要做的就是 add markdown: CommonMarkGhPages to the _config.yml . ( repo 中没有 Gemfile。)

关于markdown - 可折叠部分的内容(<details><summary>...)在 GitHub 存储库中呈现 Markdown ,但在 GitHub 页面上不呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52944720/

相关文章:

Jekyll Github Action 停止工作,现在失败并显示错误消息 : "Cannot publish on branch master"

r - 错误: path for html_dependency not provided R Markdown selectInput

markdown - 如何在 Markdown 表格中添加换行符?

html - 使用 Kramdown/Jekyll 定义脚注位置

markdown - 如何使用 Markdown 在 Octopress 中的网格中排列图像

Jekyll 静态评论系统

yaml - 在杰基尔发布除节录之外的所有内容

php - 如何防止 img 拉伸(stretch)其父级

pdf - 将多个带有链接的 Markdown 文件转换为 PDF

image - 为什么在 jekyll 网站上添加图像的 Markdown 语法不起作用?