Using three hyphens in md files on github to create a table [closed]

断了今生、忘了曾经 提交于 2019-12-08 11:59:16

问题


So I am working with an Rmd file which I later convert into and md file using the knitr package. The md file(not mine, just an example) starts with

I am interested in how the text between the hyphens at the top is parsed. I want it to look like a table below,

but instead when I wrap the text with three hyphens in my repos I get what is highlighted in green

I have no idea why or what is different in my repo. What I did notice is that if use the three hyphens wrap without using any code chunks in my md file, then I get the desired table. So, somehow the code chunks like that

\```css

code chunk

\```

mess up the three hyphens wrap being parsed as a table. Any ideas of how to resolve this issue? Thanks.


回答1:


It's not that github is parsing --- as a table delimiter, it is specifically parsing a yaml metadata block located at the top of the file (which uses --- as it's delimiters) as a table.

See here for the announcement.




回答2:


If you want a table, make a table

First Header  | Second Header
------------- | -------------
Content Cell  | Content Cell
Content Cell  | Content Cell

Try not to make table with YAML Front Matter, that will end in tears.



来源:https://stackoverflow.com/questions/23774544/using-three-hyphens-in-md-files-on-github-to-create-a-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!