如何在 GitHub README 中使用 Markdown 呈现多个列



为了在三列中渲染项目,我尝试将以下 CSS3 指令添加到项目的README.md文件中,但样式被剥离了:

<div style="-webkit-column-count: 3; -moz-column-count: 3; column-count: 3; -webkit-column-rule: 1px dotted #e0e0e0; -moz-column-rule: 1px dotted #e0e0e0; column-rule: 1px dotted #e0e0e0;">
    <div style="display: inline-block;">
        <!-- first column's content -->
    </div>
    <div style="display: inline-block;">
        <!-- second column's content -->
    </div>
    <div style="display: inline-block;">
        <!-- third column's content -->
    </div>
</div>

此样式在 GitHub 处理 Markdown 之外正常工作。如何将数据放入 Markdown 文档中的多个列中?请注意,我不关心对IE浏览器的支持,也不关心IE是否呈现单个列(无论如何,我的软件项目在Windows客户端上不起作用)。

GitHub-Flavored Markdown 只允许在内联 HTML 中使用某些允许列出的标签和属性:

.HTML

您可以在自述文件、议题和拉取请求中使用 HTML 的子集。

我们支持的标签和属性的完整列表可以在 github/标记的自述文件中找到。

关于<div>标签,自述文件指出,除了常规属性允许列表外,只有itemscopeitemtype属性被列入允许列表:

abbracceptaccept-charsetaccesskeyactionalignaltaxisbordercellpaddingcellspacingcharcharoffcharsetcheckedciteclearcolscolspancolorcompactcoordsdatetimedirdisabledenctypeforframeheadersheighthreflanghspaceismaplabellanglongdescmaxlengthmediamethodmultiplenamenohrefnoshadenowrappromptreadonlyrelrevrowsrowspanrulesscopeselectedshapesizespanstartsummarytabindextargettitletypeusemapvalignvaluevspacewidthitemprop

没有标签支持 style 属性。

除非你能将一些东西与自述文件中列出的标签和属性一起破解,否则我想你会发现你不走运。

另一种选择是将GitHub Pages网站放在一起,该网站似乎更加灵活。

如果你不介意边框,你可以使用表格 https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables

最新更新