2

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?

Community
  • 1
  • 1
Eric Green
  • 6,401
  • 11
  • 41
  • 82

1 Answers1

2
  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 gfm *.md
    

    The supported output formats are listed in the Pandoc README.

hoijui
  • 3,076
  • 1
  • 28
  • 34
Chris
  • 93,263
  • 50
  • 204
  • 189
  • The problem is that GitHub doesn't support the table format that Pandoc outputs as Markdown. I'll adjust my answer to use your new filenames. – Chris Jan 18 '14 at 13:56
  • Actually, Pandoc *can* output GFM-supported tables. Updated again. – Chris Jan 18 '14 at 14:12
  • 1
    that's it! `cat *.md > whole-thing.md` kept the correct pipe table formatting, `pandoc -o whole-thing-gfm.md -t markdown_github *.md` solved the problem. i ran both and committed to github as examples for anyone else looking for an answer. – Eric Green Jan 18 '14 at 14:15
  • 1
    when using `-t markdown_github`, [it looks like other input table types](https://github.com/ericpgreen/SO/blob/master/markdown-tables/whole-thing-gfm.md) are ok. not just pipe tables. pandoc does the conversion it seems. – Eric Green Jan 18 '14 at 14:20