markdown-table-editor

May 20, 2018 ยท View on GitHub

Markdown table editor/formatter

demo

Quick guide

  1. Set editor's grammar to GitHub Markdown or Markdown.
  2. Input a pipe | and some content (the cursor position is indicated by _).
    | foo_
    
    (If you are using language-markdown, don't forget a space after a pipe.)
  3. Hit tab to move to the next cell.
    | foo | _
    | --- |
    
  4. Continue typing.
    | foo | bar | _
    | --- | --- |
    
  5. Hit enter to move to the next row.
    | foo | bar |
    | --- | --- |
    | _   |     |
    
  6. Continue typing...
    | foo | bar |
    | --- | --- |
    | baz | _   |
    
  7. Hit esc to finish editing the table.
    | foo | bar |
    | --- | --- |
    | baz |     |
    _
    

Features

  • Format tables
  • Move the cursor from cell to cell
  • Alter column's alignment
  • Insert and delete rows and columns

Commands

NameDescriptionKeybinding
Next CellMove to the next celltab
Previous CellMove to the previous cellshift + tab
Next RowMove to the next rowenter
EscapeEscape from the tableescape
FormatJust format the table
Format AllFormat all the tables in the text editor
Align LeftLeft-align the column
Align RightRight-align the column
Align CenterCenter-align the column
Align NoneUnset alignment of the column
Select CellSelect the cell content
Move LeftMove to the left cell
Move RightMove to the right cell
Move UpMove to the upper cell
Move DownMove to the lower cell
Insert RowInsert an empty row
Delete RowDelete the row
Move Row UpMove the row up
Move Row DownMove the row down
Insert ColumnInsert an empty column
Delete ColumnDelete the column
Move Column LeftMove the column left
Move Column RightMove the column right
Toggle Format On SaveToggle "Format On Save" config
Switch Format TypeSwitch "Format Type" config
Set Format Type NormalSet "Format Type" config to "Normal"
Set Format Type WeakSet "Format Type" config to "Weak"

(To input a newline in a table, press shift + enter (or some equivalent) instead.)

You can execute commands from the command palette (Windows, Linux: ctrl + shift + p / macOS: cmd + shift + p) or from the Packages menu.

It will be more convenient if you add some keybindings to your keymap.cson. Here are the ones which I use:

'atom-text-editor:not(.mini):not(.autocomplete-active).markdown-table-editor-active':
  'cmd-left'           : 'markdown-table-editor:move-left'
  'cmd-right'          : 'markdown-table-editor:move-right'
  'cmd-up'             : 'markdown-table-editor:move-up'
  'cmd-down'           : 'markdown-table-editor:move-down'
  'shift-cmd-left'     : 'markdown-table-editor:align-left'
  'shift-cmd-right'    : 'markdown-table-editor:align-right'
  'shift-cmd-up'       : 'markdown-table-editor:align-center'
  'shift-cmd-down'     : 'markdown-table-editor:align-none'
  'alt-shift-cmd-left' : 'markdown-table-editor:move-column-left'
  'alt-shift-cmd-right': 'markdown-table-editor:move-column-right'
  'alt-shift-cmd-up'   : 'markdown-table-editor:move-row-up'
  'alt-shift-cmd-down' : 'markdown-table-editor:move-row-down'
  'cmd-k cmd-i'        : 'markdown-table-editor:insert-row'
  'cmd-k alt-cmd-i'    : 'markdown-table-editor:delete-row'
  'cmd-k cmd-j'        : 'markdown-table-editor:insert-column'
  'cmd-k alt-cmd-j'    : 'markdown-table-editor:delete-column'

FAQ

Q. My table does not align well when dealing with Chinese characters

A. Use a monospaced font that includes glyphs for Chinese characters, such as Noto Sans Mono CJK. markdown-table-editor supports East Asian characters including Chinese characters :)

For developers

This package is based on markdown-table-editor kernel, which provides a text editor independent implementation of the functionality of the package. You can create a markdown-table-editor plugin for your favorite text editor with ease!