Markdown Tables for Flarum 2.0



Adds proper markdown table support to Flarum 2.0, both in rendered posts and inside the FriendsOfFlarum Rich Text WYSIWYG editor.
This is a Flarum 2.0 port of askvortsov/flarum-markdown-tables — the original Flarum 1.x extension was built on askvortsov-rich-text (ProseMirror-based), which has been replaced in 2.0 by fof-rich-text (Tiptap v3-based). The port was made with Claude Code.
Screenshots
| Light | Dark |
 |  |
Tables size to their natural content, so a typical post table fits comfortably on mobile. Tables wider than the post column get a horizontal-scroll wrapper instead of forcing every cell to crush.
What you get
Type a standard pipe table in the composer:
| Name | Role | Notes |
|-------|:------:|----------------:|
| Alice | Admin | Founding member |
| Bob | Editor | Joined 2024 |
| Carol | Reader | Lurker mode |
…and your post renders it as a proper, styled HTML table — with header row, column alignment from the :---: markers, alternating row backgrounds, and horizontal scrolling when the table is wider than the post column.
Features
- Pipe-table parsing — standard GitHub-flavoured Markdown syntax. Handles left/center/right column alignment via
:---, :---:, and ---: separators.
- Rich-text editor integration — when
fof/rich-text is enabled, an "Insert table" button appears in the composer toolbar. Set columns and rows, click insert, type into cells.
- Markdown round-trip — tables created in the WYSIWYG editor serialize back to clean pipe-table markdown, so the post stays human-readable in the database and editable in plain mode.
- Responsive overflow — wide tables get wrapped in a horizontally-scrolling container so they never blow out narrow viewports.
- Theme-aware — borders, header background, and zebra striping use Flarum's CSS custom properties, so tables follow your light/dark scheme automatically.
- No configuration — install, enable, done.
- Works without
fof/rich-text too — if you don't use the WYSIWYG editor, posts still parse and render markdown tables correctly.
Requirements
- Flarum 2.0 (tested against 2.0.0-rc.1)
- PHP 8.2+
- Optional:
fof/rich-text 2.0+ for the WYSIWYG insert button. Markdown rendering works without it.
Installation
composer require ekumanov/flarum-ext-markdown-tables
rm -rf storage/formatter/*
php flarum cache:clear
Then enable the extension in the admin panel under Extensions → Markdown Tables.
Why the rm -rf storage/formatter/*? Flarum compiles the s9e/text-formatter renderer into a PHP class under storage/formatter/Renderer_*.php. php flarum cache:clear does not touch that file. If a renderer was compiled before this extension was active, it has no template branches for <TABLE> / <TR> / <TD> etc., and existing posts that contain table XML will silently render as empty space. Removing the file forces a regenerate that includes the table templates.
Upgrading from Flarum 1.x with askvortsov/flarum-markdown-tables
If you're coming from Flarum 1.x and previously had askvortsov/flarum-markdown-tables installed, your existing post XML is already compatible — both extensions enable the same s9e/text-formatter PipeTables plugin and the stored XML uses the same <TABLE> tag names. No re-parse of old posts is needed.
But you almost certainly do need to reset the formatter cache, because during the gap between the 1.x→2.0 migration and the install of this extension the renderer was recompiled without table templates. Run:
composer require ekumanov/flarum-ext-markdown-tables
rm -rf storage/formatter/*
php flarum cache:clear
php flarum assets:publish
After that, every existing post that already had a markdown table will render as a real <table> again — no edits required.
Limitations
- Single-column tables don't render. This is a PipeTables limitation, not ours — GitHub-flavoured Markdown's pipe-table grammar requires at least two columns.
- Cells contain inline content only. No nested block elements (lists, quotes, code blocks) inside cells. This matches the standard pipe-table specification.
Links