Skip to content

philipparndt/vscode-markdown-tables

Repository files navigation

Text Tables

license

Text tables

VSCode Marketplace

VSCode extension that helps you format Markdown tables in GitHub style.

Sample

Features

  • Tables reformat
  • Easy table cells navigation
  • Alignments Alignments

Activation

  • Open a markdown or a Cucumber document
  • Activate Table mode using the bottom toolbar or by using the Command Palette Markdown Tables: Enter table mode

Commands

The extension provides several commands that are available in the Command Palette:

  • Markdown Tables: Enable - enable the extension (available when disabled).
  • Markdown Tables: Disable - exit table mode and hide status item (available when enabled).
  • Markdown Tables: Create table - create a new table at the cursor position.
  • Markdown Tables: Format under cursor - reformat the table under the cursor.
  • Markdown Tables: Enter table mode - enter table mode.
  • Markdown Tables: Exit table mode - exit table mode.
  • Markdown Tables: Go to next cell - switch to the next cell in the current table.
  • Markdown Tables: Go to the previous cell - switch to the previous cell in the current table.
  • Markdown Tables: Clear cell - clear cell under the cursor.
  • Markdown Tables: Create column left to - create a new column left to the current column.

You can access all of the above commands from the command palette (Ctrl+Shift+p or Cmd+Shift+p)

Table mode

The Table mode is the mode where some of the default keybindings have another action assigned.

To enter table mode, you may execute the command Text Tables: Enter table mode from the command palette or press Ctrl+q Ctrl+q shortcut to toggle mode. To control whether you're in table mode or not, see the icon in the status bar of Visual Studio Code:

Table mode status

When in table mode, Tab and Shift+Tab keybindings will navigate next/previous cell accordingly.

Keybindings

  • Ctrl+q f - format table under cursor.
  • Ctrl+q space - clear cell under cursor.
  • Ctrl+q Ctrl+q - toggle table mode.

In table mode

  • Tab - navigate to the next cell in table.
  • Shift+Tab - navigate to the previous cell in table.
  • Alt+Numpad + - create a new column left to the current position.
  • Alt+Numpad - - delete current column.

Custom keybindings

The extension introduces an additional tableMode when-clause that you may use to define your own keybindings when in table mode.

Sample keybinding:

{
 "key": "tab",
 "command": "text-tables.gotoNextCell",
 "when": "tableMode"
}

Settings

This extension introduces some settings that you may set up in your user settings or workspace settings.

Available settings:

  • text-tables.showStatus - controls whether to show or not status item for table mode.

Fork information

This extension was originally created by Roman Peshkov and named vscode-text-tables. As there was no progress on the project and I had some issues that needed to be fixed, I created and used this version privately for a long time. When the original project comes back to life, I'm happy to create PRs for the new features.

New features/fixes compared to the original version

  • Use EOL character form vscode.TextEditor
  • Keep the current indentation of the table when formatting
  • Avoid flickering during navigation without change
  • Support insert a column left to the current position
  • Toggle the table mode using the status item
  • Gherkin feature file support
  • Column deletion command
  • Implemented an EBNF parser to support special characters

Contribution

All contributions are welcome.

If you find a bug or propose a new feature for the extension, please create an issue.