Skip to main content
Tabulate provides powerful exporters that allow you to convert your formatted tables into popular documentation and typesetting formats. This enables you to use Tabulate for terminal display while also generating content for documentation, websites, and academic papers.

Available Exporters

Tabulate includes three exporters:
  • MarkdownExporter: Export to GitHub-flavored Markdown
  • AsciiDocExporter: Export to AsciiDoc format
  • LatexExporter: Export to LaTeX tabular environment

Markdown Export

The MarkdownExporter converts tables to GitHub-flavored Markdown format, preserving column alignment.

Basic Usage

#include <tabulate/markdown_exporter.hpp>
using namespace tabulate;

int main() {
  Table movies;
  movies.add_row({"S/N", "Movie Name", "Director", "Estimated Budget", "Release Date"});
  movies.add_row({"tt1979376", "Toy Story 4", "Josh Cooley", "$200,000,000", "21 June 2019"});
  movies.add_row({"tt3263904", "Sully", "Clint Eastwood", "$60,000,000", "9 September 2016"});
  movies.add_row({"tt1535109", "Captain Phillips", "Paul Greengrass", "$55,000,000", " 11 October 2013"});

  // center align 'Director' column
  movies.column(2).format().font_align(FontAlign::center);

  // right align 'Estimated Budget' column
  movies.column(3).format().font_align(FontAlign::right);

  // right align 'Release Date' column
  movies.column(4).format().font_align(FontAlign::right);

  // Color header cells
  for (size_t i = 0; i < 5; ++i) {
    movies[0][i].format().font_color(Color::yellow).font_style({FontStyle::bold});
  }

  // Export to Markdown
  MarkdownExporter exporter;
  auto markdown = exporter.dump(movies);

  std::cout << markdown << std::endl;
}
The source code for this example is available at samples/markdown_export.cpp in the repository.

Markdown Output

The exporter generates proper Markdown tables with alignment specifications:
| S/N       | Movie Name       |     Director    | Estimated Budget |     Release Date |
| :----     | :----            |      :---:      |            ----: |            ----: |
| tt1979376 | Toy Story 4      |   Josh Cooley   |     $200,000,000 |     21 June 2019 |
| tt3263904 | Sully            |  Clint Eastwood |      $60,000,000 | 9 September 2016 |
| tt1535109 | Captain Phillips | Paul Greengrass |      $55,000,000 |  11 October 2013 |

Markdown Alignment Rules

Unlike Tabulate, Markdown only supports per-column alignment, not per-cell alignment. The MarkdownExporter uses the formatting of header cells to determine column alignment. Columns are left-aligned by default if no alignment is specified.
The exporter translates alignment settings as follows:
  • FontAlign::left:---- (left-aligned)
  • FontAlign::center:---: (center-aligned)
  • FontAlign::right----: (right-aligned)

AsciiDoc Export

The AsciiDocExporter converts tables to AsciiDoc format, preserving alignment and basic font styles (bold and italic).

Basic Usage

#include <tabulate/asciidoc_exporter.hpp>
using namespace tabulate;

int main() {
  Table movies;
  movies.add_row({"S/N", "Movie Name", "Director", "Estimated Budget", "Release Date"});
  movies.add_row({"tt1979376", "Toy Story 4", "Josh Cooley", "$200,000,000", "21 June 2019"});
  movies.add_row({"tt3263904", "Sully", "Clint Eastwood", "$60,000,000", "9 September 2016"});
  movies.add_row({"tt1535109", "Captain Phillips", "Paul Greengrass", "$55,000,000", " 11 October 2013"});

  // center align 'Director' column
  movies.column(2).format().font_align(FontAlign::center);

  // right align 'Estimated Budget' column
  movies.column(3).format().font_align(FontAlign::right);

  // right align 'Release Date' column
  movies.column(4).format().font_align(FontAlign::right);

  movies[1][2].format().font_style({FontStyle::bold, FontStyle::italic});
  movies[2][1].format().font_style({FontStyle::italic});

  // Color header cells
  for (size_t i = 0; i < 5; ++i) {
    movies[0][i]
        .format()
        .font_color(Color::white)
        .font_style({FontStyle::bold})
        .background_color(Color::blue);
  }

  AsciiDocExporter exporter;
  auto asciidoc = exporter.dump(movies);

  std::cout << asciidoc << std::endl;
}
The source code for this example is available at samples/asciidoc_export.cpp in the repository.

AsciiDoc Output

[cols="<,<,^,>,>"]
|===
|*S/N*|*Movie Name*|*Director*|*Estimated Budget*|*Release Date*

|tt1979376|Toy Story 4|*_Josh Cooley_*|$200,000,000|21 June 2019
|tt3263904|_Sully_|Clint Eastwood|$60,000,000|9 September 2016
|tt1535109|Captain Phillips|Paul Greengrass|$55,000,000| 11 October 2013
|===

AsciiDoc Features

1

Column alignment

Uses [cols="<,<,^,>,>"] syntax where < = left, ^ = center, > = right
2

Font styles

Supports *bold*, _italic_, and *_bold italic_* formatting
3

Per-cell formatting

Unlike Markdown, AsciiDoc supports formatting individual cells

LaTeX Export

The LatexExporter generates LaTeX tabular environments suitable for academic papers and scientific documents.

Basic Usage

#include <tabulate/latex_exporter.hpp>
using namespace tabulate;

int main() {
  Table movies;
  movies.add_row({"S/N", "Movie Name", "Director", "Estimated Budget", "Release Date"});
  movies.add_row({"tt1979376", "Toy Story 4", "Josh Cooley", "$200,000,000", "21 June 2019"});
  movies.add_row({"tt3263904", "Sully", "Clint Eastwood", "$60,000,000", "9 September 2016"});
  movies.add_row({"tt1535109", "Captain Phillips", "Paul Greengrass", "$55,000,000", " 11 October 2013"});

  // center align 'Director' column
  movies.column(2).format().font_align(FontAlign::center);

  // right align 'Estimated Budget' column
  movies.column(3).format().font_align(FontAlign::right);

  // right align 'Release Date' column
  movies.column(4).format().font_align(FontAlign::right);

  LatexExporter exporter;
  exporter.configure().indentation(8);
  auto latex = exporter.dump(movies);

  std::cout << latex << std::endl;
}
The source code for this example is available at samples/latex_export.cpp in the repository.

LaTeX Output

\begin{tabular}
{lclrr}
        S/N & Movie Name & Director & Estimated Budget & Release Date \\
        tt1979376 & Toy Story 4 & Josh Cooley & $200,000,000 & 21 June 2019 \\
        tt3263904 & Sully & Clint Eastwood & $60,000,000 & 9 September 2016 \\
        tt1535109 & Captain Phillips & Paul Greengrass & $55,000,000 &  11 October 2013 \\
\end{tabular}

LaTeX Configuration

The LatexExporter supports configuration through the ExportOptions class:
LatexExporter exporter;
exporter.configure().indentation(4);  // Set row indentation

LaTeX Alignment

The exporter translates alignment settings to LaTeX column specifications:
  • FontAlign::leftl (left-aligned column)
  • FontAlign::centerc (center-aligned column)
  • FontAlign::rightr (right-aligned column)

Comparison Table

FeatureMarkdownAsciiDocLaTeX
Column AlignmentYesYesYes
Per-cell AlignmentNoNoNo
Bold/ItalicNoYesNo
Color SupportNoNoNo
ConfigurationNoneNoneIndentation
Use CaseDocumentationTechnical docsAcademic papers

Common Workflow

1

Design your table

Create and format your table using Tabulate’s full feature set
2

Display in terminal

Use std::cout << table for terminal output with colors and styles
3

Export to documentation

Use an exporter to generate Markdown/AsciiDoc/LaTeX for documentation
4

Include in documents

Copy the exported output into your documentation or LaTeX source files

Best Practices

  1. Test both outputs: Verify that your table looks good both in the terminal and in the exported format
  2. Use header formatting: Format header cells to ensure proper column alignment in exports
  3. Keep it simple for exports: Complex formatting like colors won’t translate to all formats
  4. Choose the right exporter: Use Markdown for GitHub/docs, AsciiDoc for technical documentation, LaTeX for papers
  5. Configure appropriately: Use indentation settings for cleaner LaTeX output
Colors, most font styles, and complex borders are not preserved in exports. Exporters focus on structure and basic formatting only.

Build docs developers (and LLMs) love