Tables

Create rich, structured tables in your documentation.

Tables organize structured data into rows and columns, making information easy to scan and compare. Mordoc inherits Markdoc's table syntax which supports rich content within cells.

Basic syntax

{% table %}
* Header 1
* Header 2
* Header 3
---
* Row 1, Cell 1
* Row 1, Cell 2
* Row 1, Cell 3
---
* Row 2, Cell 1
* Row 2, Cell 2
* Row 2, Cell 3
---
{% /table %}

Result:

Header 1Header 2Header 3
Row 1, Cell 1Row 1, Cell 2Row 1, Cell 3
Row 2, Cell 1Row 2, Cell 2Row 2, Cell 3

Rich content in tables

The Markdoc table syntax supports rich content within cells:

Syntax

Markdown
{% table %}
* Rich text example
* Description
---
* 
  **Code Block**
  ```javascript
  function destroyRing(fellowship) {
    if (!fellowship.includes("Frodo")) {
      throw new Error("The Ring cannot be destroyed without the Ring-bearer.");
    }
    return "The Ring is cast into Mount Doom. Middle-earth is saved.";
  }
  const fellowship = ["Frodo", "Sam", "Gandalf", "Aragorn"];
  console.log(destroyRing(fellowship));
  ```

* 
  * Checks whether the Fellowship includes Frodo.
  * Throws an error if he’s missing; otherwise returns a success message.
  * Demonstrates the function with a sample Fellowship list.
  {% callout type="note" title="Note" %}
  This is a fictional code.
  {% /callout %}
---
* 
  **Callout**
  {% callout type="danger" title="Danger" %}
  One does not simply walk into Mordor.
  {% /callout %}
* This is a danger callout
---
{% /table %}

Result

Rich text exampleDescription
Code Block
Javascript
function destroyRing(fellowship) {
  if (!fellowship.includes("Frodo")) {
    throw new Error("The Ring cannot be destroyed without the Ring-bearer.");
  }

  return "The Ring is cast into Mount Doom. Middle-earth is saved.";
}

const fellowship = ["Frodo", "Sam", "Gandalf", "Aragorn"];

console.log(destroyRing(fellowship));
  • Checks whether the Fellowship includes Frodo.
  • Throws an error if he’s missing; otherwise returns a success message.
  • Demonstrates the function with a sample Fellowship list.
note

This is a fictional code.

Callout
Danger

One does not simply walk into Mordor.

This is a danger callout

Next steps

  • Code Blocks - Add syntax-highlighted code examples
  • Callouts - Create styled alert and info boxes
  • Cards - Build card layouts and grids