Table Formatter
approvedby fangface-hub
Formats Markdown tables when files are saved. - This plugin has not been manually reviewed by Obsidian staff.
obsidian_table_formatter
An Obsidian plugin for formatting Markdown tables on save.
Features
- Formats Markdown tables whenever a Markdown file is saved.
- Runs auto-format while editing in Live Preview or Source mode (never in Reading view).
- Waits for a pause in typing (3 seconds by default, configurable) before auto-formatting, so it does not interfere with ongoing edits. Because the wait restarts on every change, the formatter also runs after edits Obsidian itself makes to the file, such as re-padding a table edited through the Live Preview table editor.
- Applies edits through the open editor, so the cursor stays in place and Obsidian does not report the file as externally modified.
- Leaves the table the cursor is in untouched during auto-format and reformats it once the cursor has moved out of it, so cell editing is never interrupted. The manual command always formats everything.
- Lets you format manually with the ribbon button (table icon) or the command palette.
- Can format every Markdown file in the vault at once with the command "Format tables in all files", which is handy when you first add the plugin to an existing vault. It asks for confirmation first and reports how many files were changed.
- Adds a ribbon toggle button (power icon) to force-enable/disable auto-format and focus control while editing.
- Shows an ON/OFF toggle in the main screen status bar for quick switching.
- Supports configurable table cell padding:
- Fixed number of spaces (
0or more) - Blank (auto mode: single-space minimal formatting)
- Fixed number of spaces (
- Supports configurable number of
-characters in the delimiter row. - Keeps column alignment: the
:markers in the delimiter row (:---,---:,:---:) are preserved.
Settings
Open: Settings -> Community plugins -> Table Formatter
Padding spaces- Blank:
| cell |style (single-space padding) - Integer (
>= 0): exactly that many spaces around each cell
- Blank:
Table border dash count- Blank: auto (based on content width, minimum
3) - Integer (
>= 1): fixed number of-in each delimiter cell. Alignment colons (:) are kept and placed around the dashes, so a left-aligned column with dash count3becomes:---.
- Blank: auto (based on content width, minimum
Auto-format delay- Seconds to wait after the last change before tables are auto-formatted (integer
>= 1, default3)
- Seconds to wait after the last change before tables are auto-formatted (integer
Enable auto-format and focus control while editing- ON: run modify-triggered formatting while editing in Live Preview or Source mode
- OFF: force-disable those editing features
Table indentation formattingPreserve table indentation: indented tables are excluded from formattingRemove table indentation: indented tables are formatted and indentation is removed
Images
- Editor screen
- Setting screen
Development
npm install
npm run dev
Run lint:
npm run lint
Auto-fix lint issues:
npm run lint:fix
Build production bundle:
npm run build
Note: npm run build runs lint first via esbuild.config.mjs.
Community Plugin Release
Use one of the following version bump scripts depending on the scope of changes:
npm run version:patch- For backward-compatible fixes only (
x.y.z->x.y.(z+1))
- For backward-compatible fixes only (
npm run version:minor- For backward-compatible feature additions (
x.y.z->x.(y+1).0)
- For backward-compatible feature additions (
npm run version:major- For breaking changes (
x.y.z->(x+1).0.0)
- For breaking changes (
Each script updates package.json, package-lock.json, manifest.json, and versions.json together.
- Commit and push to GitHub.
- Create a GitHub Release with tag exactly matching
manifest.jsonversion. - Attach release assets:
main.js,manifest.json,styles.css(optional). - Submit the repository URL from Obsidian Community Plugins.
Notes:
manifest.jsonin the default branch must be up to date before submission.versions.jsonshould stay in the repository root for Community Plugin compatibility mapping, but it does not need to be attached to the GitHub Release.- Plugin
idmust be unique and must not containobsidian.
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.