通过Pandoc在GitHub上标记表格 [英] markdown tables on GitHub via Pandoc

查看:152
本文介绍了通过Pandoc在GitHub上标记表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将多个 .md 文件与表格合并为一个 .pdf 和一个 .md 使用Pandoc的文件,只有 .pdf 保持格式。我创建了一个简单的存储库,其中有四个 .md 显示每个表格示例的文件 Pandoc网站



使用以下命令编译:

pandoc -o README.md * .md



pandoc -o README.pdf * .md



正如您从存储库中看到的那样,( pdf )看起来不错,但降价文件在GitHub上显示为自述文件不会。



另外,在四个 .md 文件,只有管道表在GitHub上正确显示。



问题:


  1. GitHub支持哪些类型的降价表?此规格表中未列出表格。


  2. Pandoc似乎是将多个 .md 文件合并为一个文档的最佳方式,但格式不适用输出到 .md 时保持不变。对于 .pdf 看起来很好。为什么?有没有修复?



解决方案

    你说的没错,GitHub文档没有说明GFM支持哪种类型的表。我认为你的测试表明它支持管道表。由于Pandoc可以本地输出GFM(见下面),所以这可能是您最好的选择。 您可以使用指定精确的输出格式, -t 选项。在这种情况下:

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

    支持的输出格式列于在Pandoc自述文件中。



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. 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.

这篇关于通过Pandoc在GitHub上标记表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆