Under the Hood: The Architecture of Markdown Table Maker
Online table-to-markdown generators that store “projects” keep spreadsheet cells in an account. This maker holds a string grid in React, emits GitHub-flavored pipe tables with alignment row, and copies/downloads locally. No upload of README data.
Memory Allocation & Browser Threading Mechanics
Grid is rows times cols strings. Resize copies overlapping cells into a new matrix. toMarkdown walks cells once per keystroke via useMemo. Small tables stay on the main thread easily.
Algorithmic Deep-Dive: Code Snippet & Logical Analysis
function toMarkdown(grid, aligns, pretty) {
const widths = grid[0].map((_, j) =>
Math.max(...grid.map((r) => (r[j] ?? "").length), 3));
const sep = aligns.map((a, j) => {
const w = pretty ? widths[j] : 3;
if (a === "center") return ":" + "-".repeat(w - 2) + ":";
if (a === "right") return "-".repeat(w - 1) + ":";
return "-".repeat(w);
});
const line = (cells) => "| " + cells.join(" | ") + " |";
return [line(grid[0]), line(sep), ...grid.slice(1).map(line)].join("\n");
}Header is row 0. Alignment cycles left/center/right. Pretty mode pads to column width. Cells that contain pipes should be edited carefully; this emitter does not HTML-escape.
The Local Storage Sandbox & Volatile Data Pipelines
Download is a text Blob of the markdown. Clipboard writeText for copy. No localStorage of grids.
Verifying True Privacy: How to Audit Your Browser's Network Tab
F12, Network, clear, type a unique header, copy markdown. The header must not appear in request bodies.