/md-advanced-tables

A text editor independent library to enable formatting and Excel-style navigation to Markdown tables.

Primary LanguageTypeScriptMIT LicenseMIT

Markdown Advanced Tables

This library can be used by any text editor to enable formatting and Excel-style navigation to Markdown tables.

Note: This was originally created by @susisu. This fork is intended to convert the project to Typescript and start adding additional functionality such as table sorting, and possibly even basic spreadsheet capabilities.

demo

You can try it on your browser!

Installation

TBD

Usage

Implement an interface to the text editor.

interface ITextEditor {
  getCursorPosition(): Point;
  setCursorPosition(pos: Point): void;
  setSelectionRange(range: Range): void;
  getLastRow(): number;
  acceptsTableEdit(row: number): boolean;
  getLine(row: number): string;
  insertLine(row: number, line: string): void;
  deleteLine(row: number): void;
  replaceLines(startRow: number, endRow: number, lines: Array<string>): void;
  transact(func: Function): void;
}

And then you can execute commands through a TableEditor object.

import { TableEditor, options } from "@susisu/mte-kernel";
const textEditor = ...; // interface to the text editor
const tableEditor = new TableEditor(textEditor);
tableEditor.formatAll(options({}));

See the API reference for more information. It is also good to look into atom-markdown-table-editor as a reference implementation.

Pricing

This plugin library is provided to everyone for free, however if you would like to say thanks or help support continued development, feel free to send a little my way through one of the following methods:

GitHub Sponsors Paypal BuyMeACoffee

License

MIT License

Author

Current author: Tony Grosinger (Github)

Original author: Susisu (GitHub, Twitter)