MCPcopy Index your code
hub / github.com/benjypng/logseq-tablerender-plugin

github.com/benjypng/logseq-tablerender-plugin @v2.9.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.9.0 ↗ · + Follow
34 symbols 99 edges 23 files 0 documented · 0% updated 22mo agov2.9.0 · 2024-09-01★ 443 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

:gift_heart: Sponsor this project on Github or :coffee: Get me a coffee if you like this plugin!

Overview

Render tables with basic math functions using data from your blocks. Just use the slash command /Render table to get started!

Instructions

In the examples below, the {{renderer ...}} is automatically generated when you type /Render table, so you just need to add the portion from rows onwards.

To add the mathematical formulas, add it to the same block as rows. Fr example, sum-2 sums up the values in column 2 of the table.

  • {{renderer :tables_656a0198-9b78-4d81-ae9a-09811cce3c8d}}
  • rows sum-2
    • hello
    • hello
    • stuff
    • stuff
    • [[John Tan]]
    • The quick brown fox jumps over the lazy dog

Basic table

basic table To draw a table above, you can use any one of the below approaches, with the flags data, rows or cols.

  1. data
- {{renderer :tables_656a0198-9b78-4d81-ae9a-09811cce3c8d}}
  - data
    - Category
      - Fruits
      - Vegetables
      - Fruits and Vegetables
    - Fresh Produce
      - Apples
      - Lettuce
      - Tomatoes
    - Price
      - 1
      - 3
      - 5
  1. rows
- {{renderer :tables_656a0198-9b78-4d81-ae9a-09811cce3c8d}}
  - rows
    - Category
      - Fresh Produce
        - Price
    - Fruits
      - Apples
        - 1
    - Vegetables
      - Lettuce
        - 3
    - Fruits and Vegetables
      - Tomatoes
        - 5
  1. cols
- {{renderer :tables_656a0198-9b78-4d81-ae9a-09811cce3c8d}}
  - cols
    - Category
      - Fresh Produce
      - Price
    - Fruits
      - Apples
      - 1
    - Vegetables
      - Lettuce
      - 3
    - Fruits and Vegetables
      - Tomatoes'
      - 5

Table with basic stats

The following basic statistical calculations are available:

  • Sum (sum)
  • Average (average)
  • Median (median)
  • Mode (mode)
  • Variance (variance)
  • Standard Deviation (sd)
  • Sample Standard Deviation (ssd)
  • Percentile (percentile)*

To use any of the above, use its shortcut (in brackets above) with the columns that you would like to compute (<shortcut>-<column>).

Example

  1. sum-3 average-3 median-3 mode-3 will render: stats-01

  2. *Percentile requires an additional flag to indicate the perecntile that you would like to compute. percentile-3-50 will compute the 50th percentile of the 3rd column. percentile

Installation

Look for logseq-tablerender-plugin in the marketplace and install from there.

Credits

stats-lite for providing the calculations.

Extension points exported contracts — how you extend this code

MathProps (Interface)
(no doc)
src/libs/types.ts
MathResults (Interface)
(no doc)
src/libs/types.ts

Core symbols most depended-on inside this repo

extractNumber
called by 8
src/helpers/math-helpers.ts
removeLsAttributes
called by 4
src/libs/process-content/remove-ls-attributes.ts
checkCell
called by 3
src/helpers/handle-cell-type.tsx
getFirstChildren
called by 2
src/helpers/child-blocks-as-columns.tsx
getFirstChildren
called by 1
src/helpers/blocks-as-columns.tsx
getData
called by 1
src/helpers/blocks-as-columns.tsx
blocksAsColumns
called by 1
src/helpers/blocks-as-columns.tsx
getSum
called by 1
src/helpers/math-helpers.ts

Shape

Function 32
Interface 2

Languages

TypeScript100%

Modules by API surface

src/helpers/math-helpers.ts9 symbols
src/helpers/blocks-as-columns.tsx3 symbols
src/libs/types.ts2 symbols
src/libs/do-math.ts2 symbols
src/helpers/child-blocks-as-columns.tsx2 symbols
src/helpers/blocks-as-rows.tsx2 symbols
src/libs/process-content/remove-ls-attributes.ts1 symbols
src/libs/process-content/handle-tag.tsx1 symbols
src/libs/process-content/handle-markdown-link.tsx1 symbols
src/libs/process-content/handle-link.tsx1 symbols
src/libs/process-content/handle-italics.tsx1 symbols
src/libs/process-content/handle-image.tsx1 symbols

For agents

$ claude mcp add logseq-tablerender-plugin \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page