The CSV Codeblock plugin is a game-changer for Obsidian users who work with data-heavy notes. With this plugin, you can effortlessly convert CSV codeblocks into tables within your notes, making it easier to analyze and visualize your data. Simply wrap your CSV data in a codeblock and identify it as csv
, and the plugin will take care of rendering it as a table. This feature is particularly useful for those who work with spreadsheets, financial data, or any other type of data that requires tabular representation. With the CSV Codeblock plugin, you can easily turn complex CSV data into an intuitive and easy-to-understand format within Obsidian.
Now supports tsv
in codeblocks. Thanks mklepaczewski for the request.
This is a plugin for Obsidian (https://obsidian.md). This plugin renders codeblocks with csv format as tables.
Just put the csv
identifyer in a codeblock:
```csv
Pos, Date, Name, Price
1, 2023-09-28, Spices, 150$
2, 2023-02-29, Shovel, 1.25$
```
I stole the code from https://docs.obsidian.md/Plugins/Editor/Markdown+post+processing#Post-process+Markdown+code+blocks
import { Plugin } from "obsidian";
export default class ExamplePlugin extends Plugin {
async onload() {
this.registerMarkdownCodeBlockProcessor("csv", (source, el, ctx) => {
const rows = source.split("\n").filter((row) => row.length > 0);
const table = el.createEl("table");
const body = table.createEl("tbody");
for (let i = 0; i < rows.length; i++) {
const cols = rows[i].split(",");
const row = body.createEl("tr");
for (let j = 0; j < cols.length; j++) {
row.createEl("td", { text: cols[j] });
}
}
});
}
}
on Jul 18, 2024
Now supports tsv
in codeblocks. Thanks mklepaczewski for the request.
on Sep 28, 2023