Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Latest commit

 

History

History
79 lines (48 loc) · 3.75 KB

README.md

File metadata and controls

79 lines (48 loc) · 3.75 KB

Obsidian Table Enhancer

A plugin for improving the experience of using table in Obsidian.

TOC

点击这里查看中文文档。

How to Install

Please Refer: How to install Obsidian Plugins

Key Features

  1. You can click a table cell to edit it directly, and the cell being edited will be highlighted. You can press Enter or Esc or click anywhere outside the table to exit the edit mode.

  2. When editing a table cell, content in the table cell will be converted to original Markdown code, and it will be rendered when you exit the edit mode.

  3. In the table cell, you can write anything except the format conflicting with Markdown, such as |. Try to add HTML\Tags\Img to it.

    ob-plugin

  4. Use up and down arrow keys to move between cells. And tab key can be used to move between cells, while shift + tab can be used to move between cells in the opposite direction.

  5. Use left and right arrow keys to move between characters in the cell. And when your cursor is on the front of the table cell or the end of the table cell, you can use left and right arrow keys to move between cells.

  6. In any table cell, you can double-click [ to call the autocomplete function for files.

    ob-plugin

  7. When mouse float on the table cell, a toolbar will be displayed on the top side of the cell. You can use the toolbar to insert a row or column before or after the current cell. And also center\left\right align the current cell.

    ob-plugin

  8. You can write JS function in table cell, and it will be executed when you exit the edit mode. The function will receive the table cell content as a parameter, and the return value will be used as the new content of the table cell.

    ob-plugin

About running JS function in table cells

Builtin Variables

You can access the content of table using following variables easily:

  • c: Get the current column (excluding the header and the cell itself), return a character array
  • nc: Get the current column (excluding the header and the cell itself), return a number array
  • t: Get the current table (see console.log for specific content)

Builtin Functions

  • sum: Sum of a number array
  • avg: Average of a number array
  • min: Minimum of a number array
  • max: Maximum of a number array

Samples

Code Description
>>> sum(nc) Sum of all numbers in the current column
>>> sum(nc.filter(e=>e>0)) Sum of all positive numbers in the current column
>>> avg(nc) Average of the current column
>>> min(nc) Minimum of the current column
>>> c.filter(e=>e.contains('TODO')).length Sum of all cells in the current column contains TODO task