markdown tables on GitHub via Pandoc

。_饼干妹妹 提交于 2019-12-08 03:07:55

问题


When I combine several .md files with tables into a single .pdf and a single .md file using Pandoc, only the .pdf maintains formatting. I created a simple repository that has four .md files showing each table example on the Pandoc website.

I compiled with the following commands:

pandoc -o README.md *.md

pandoc -o README.pdf *.md

As you can see from the repository, the (pdf) looks fine, but the markdown file showing on GitHub as the readme does not.

Also, of the four individual .md files, only the pipe table shows correctly on GitHub.

Questions:

  1. What type of markdown tables are supported by GitHub? Tables are not addressed in this spec sheet.

  2. Pandoc seems to be the best way to combine multiple .md files into one doc, but the formatting does not hold when outputting to .md. Looks fine for .pdf. Why? And is there a fix?


回答1:


  1. You're correct that the GitHub documentation doesn't say what kind of tables GFM supports. I think your test shows that it supports pipe tables. Since Pandoc can natively output GFM (see below), that's likely your best bet.

  2. You can specify the precise output format using the -t option. In this case:

    pandoc -o whole-thing.md -t markdown_github *.md
    

    The supported output formats are listed in the Pandoc README.



来源:https://stackoverflow.com/questions/21204915/markdown-tables-on-github-via-pandoc

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