How to Force Copilot to Output a Markdown Table With Aligned Columns
🔍 WiseChecker

How to Force Copilot to Output a Markdown Table With Aligned Columns

When you ask Copilot to create a markdown table, the result often has ragged columns that look misaligned when viewed in a plain text editor or when pasted into a document. This happens because Copilot generates standard markdown table syntax without explicit column alignment directives. The default left alignment for all columns can make numeric data or centered headers appear untidy. This article explains how to force Copilot to output a markdown table with aligned columns by crafting a precise prompt that includes alignment markers.

Key Takeaways: Crafting the Prompt for Aligned Markdown Tables

  • Alignment markers in markdown separator row: Use :--- for left, :---: for center, and ---: for right alignment in the second row of the table definition.
  • Prompt instruction to Copilot: Add the phrase “Use explicit alignment markers in the separator row” to your request to override default behavior.
  • Post-generation check: Verify that the separator row contains colons in the correct positions before copying the table into your target application.

ADVERTISEMENT

How Markdown Table Alignment Works in Copilot

Copilot generates standard markdown tables using pipes and dashes. A typical table has a header row, a separator row, and data rows. The separator row determines column alignment. By default, Copilot uses |---| for each column, which renders as left-aligned in most markdown viewers. To change alignment, you must include colons in the separator row. A colon on the left side of the dashes produces left alignment, a colon on both sides produces center alignment, and a colon on the right side produces right alignment. Copilot will follow these markers if you explicitly instruct it to do so in your prompt.

The root cause of misaligned tables is that Copilot does not assume you want anything other than the default left alignment. The AI model generates the table structure based on common usage patterns, and left alignment is the most frequent pattern in training data. To force a different alignment, you must override this default by describing the exact alignment you need in your natural language request.

Steps to Force Copilot to Output an Aligned Markdown Table

Use the following steps to produce a markdown table with columns aligned exactly as you specify. These instructions work in Copilot in Microsoft 365, Copilot in Windows, and Copilot on the web.

  1. Open Copilot and start a new conversation
    Launch Copilot from the Microsoft 365 sidebar, the Windows Copilot pane, or go to copilot.microsoft.com. Clear any previous context by starting a fresh chat session.
  2. Write a detailed prompt that includes the table structure and alignment
    State the table purpose, the column names, and the alignment for each column. For example: “Create a markdown table with three columns: Product, Price, Quantity. Left-align the Product column, center-align the Price column, and right-align the Quantity column. Use explicit alignment markers in the separator row.”
  3. Add an example of the separator row if needed
    If Copilot still returns a left-aligned table, include a sample separator row in your prompt. Write: “The separator row should look like this: :---|:---:|---: for left, center, and right alignment respectively.”
  4. Request a verification step from Copilot
    Ask Copilot to confirm the alignment by writing: “After generating the table, show me the separator row so I can verify the alignment markers are correct.” This forces Copilot to output the raw markdown instead of a rendered table.
  5. Copy the output and check the separator row
    Copy the generated markdown table. Look at the second row. For left alignment, you should see :---. For center alignment, :---:. For right alignment, ---:. If the colons are missing, repeat the prompt with stronger emphasis on the alignment markers.
  6. Paste the table into your target application
    Paste the markdown into a document editor that supports markdown rendering, such as Microsoft Word with the Markdown add-in, Visual Studio Code, or a GitHub comment. The columns should align according to your specified markers.

ADVERTISEMENT

If Copilot Still Produces a Left-Aligned Table

Copilot ignores alignment markers in the prompt

If Copilot repeatedly outputs a left-aligned table despite your instructions, the prompt may be too vague. Rewrite your request to be more explicit. Instead of saying “align columns,” say “use colons in the separator row to indicate alignment.” You can also break the request into two steps: first ask Copilot to generate the separator row with alignment markers, then ask it to fill in the data rows.

Copilot generates a rendered table instead of raw markdown

When you ask Copilot for a table in a rich interface like Microsoft 365 Chat, it may render the table as an HTML entity rather than showing raw markdown. To see the raw markdown, request: “Show the table in raw markdown format, including the separator row with alignment markers.” This forces Copilot to output the plain text syntax.

Copilot uses hyphens instead of dashes in the separator row

Some markdown renderers treat three or more hyphens as a valid separator, but alignment requires colons. If Copilot outputs ---|---|--- without colons, paste that row back into your prompt and ask: “Add colons to this separator row to create left, center, and right alignment as specified.” Copilot will then correct the row.

Copilot Default Table vs Explicit Alignment Table: Key Differences

Item Default Copilot Table Explicit Alignment Table
Separator row example ---|---| :---|:---:|---:
Column alignment All columns left-aligned Each column can be left, center, or right
Prompt requirement Simple request like “make a table” Must include alignment markers in prompt
Rendering in plain text Columns may appear ragged Columns align neatly when viewed in monospace font
Copy-paste compatibility Works in most markdown renderers Works in all markdown renderers that support alignment

By forcing Copilot to use explicit alignment markers, you gain control over the visual presentation of your data. This is especially useful when you need to share tables in documentation, code comments, or reports where alignment matters for readability.

ADVERTISEMENT