在 GitHub 存储库的 README 中,可折叠部分内的 markdown 会根据需要呈现。
但是在 GitHub Pages 上,markdown 没有呈现,只是字面意思。
_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/