Skip to content
/ tablr Public

A simple utility for converting back and forth between markup and pretty ASCII tables.

License

Notifications You must be signed in to change notification settings

fimad/tablr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tablr

Tablr is a simple command line utility for converting back and forth between a simple table markup language and pretty ASCII tables. It reads markup on standard in and writes the corresponding ASCII table to standard out.

The -r flag may be given to convert from an ASCII table to markup also reading and writing on standard in and out.

Markup

The tables generated by Tablr are currently very simple. A table is composed of a list of rows, each row may either by a divider or a list of cells. All rows in a table have the same number of cells.

A row of cells is specified on a single line with a | character between each cell.

A divider row is specified by a single line containing one or more - characters and nothing else.

Example

For example, the given markup:

Header 1 | Header 2 | Header 3
-
foo | bar | baz
just the first
||just the last

Will produce the following table when piped through tablr:

+----------------+----------+---------------+
| Header 1       | Header 2 | Header 3      |
+----------------+----------+---------------+
| foo            | bar      | baz           |
| just the first |          |               |
|                |          | just the last |
+----------------+----------+---------------+

VIM Integration

Tablr was originally created with VIM integration in mind. You can add the following to your ~/.vimrc file to automatically convert the paragraph under your cursor back and forth between tables and markup.

nnoremap <leader>at vip:!tablr<cr>
nnoremap <leader>ut vip:!tablr -r<cr>

About

A simple utility for converting back and forth between markup and pretty ASCII tables.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published