🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

markdown-it-pivot-table

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it-pivot-table

A markdown-it plugin to add pivot table support

1.0.5
latest
npm
Version published
Weekly downloads
365
-27.44%
Maintainers
1
Weekly downloads
 
Created
Source

markdown-it-pivot-table

A markdown-it plugin to add pivot table support.

Operators

CNT(), MIN(), MAX(), SUM(), and AVG() work with numeric values.

ANY() works with strings.

Usage

const mdp = require('markdown-it-pivot-table');
const md = require('markdown-it')().use(mdp);

const source = `
|Group=Item|Cost=SUM()|
|---|---|
|Candies|1.00|
|Chips|3.00|
|Candies|1.00|
|Drinks|2.00|
`;

const result = md.render(source);
console.log(result);

Result:

ItemCost
Candies2.00
Chips3.00
Drinks2.00

Computed Cells

Reference column names with curly braces to compute numeric values on the fly:

|Group=Category|Group=Sub-category|Item|Unit Cost|Qty|Subtotal=SUM()|
|---|---|---|---|---|---|
|Electrical|Wires|14/2 (/m)|||150|
|Electrical|Wires|10/3 (/m)|||99.80|
|Electrical|Devices|Breakers|29.97|3|{Unit Cost}*{Qty}|

Result:

CategorySub-categorySubtotal
ElectricalWires249.80
ElectricalDevices89.91

In-header Equations

If all rows have the same value for a column, then specify the equation right in the header line and leave the cells blank:

|Group=Category|Group=Sub-category|Item|Unit Cost|Qty|Subtotal=SUM({Unit Cost}*{Qty})|
|---|---|---|---|---|---|
|Wall|Drywall|1/2" (/sheet)|17.35|25|
|Wall|Mud|Quickset|15|2|
|Wall|Mud|All Purpose|35|3|

Result:

CategorySub-categorySubtotal
WallDrywall433.75
WallMud135.00

Keywords

markdown-it

FAQs

Package last updated on 16 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts