AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Markdown Table Generator Agent Guide

Agent guide for building GitHub-flavored Markdown tables from 2D row data.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Markdown Table Generator in the alexandrai-tools project.

Project overview

This guide covers src/tools/markdown-table-generator/index.ts. The tool treats row zero as the header, pads all rows to the maximum column count, escapes pipe characters and newlines inside cells, builds alignment separators, and returns an empty string for empty input.

Primary source files

  • src/tools/markdown-table-generator/index.ts defines meta, Align, escapeCell, and buildTable.
  • src/tools/markdown-table-generator/index.test.ts covers table output, pipe escaping, header-only tables, alignments, empty input, and row padding.
  • src/tools/markdown-table-generator/Body.astro owns row and column controls.
  • src/tools/markdown-table-generator/i18n.ts owns localized copy.
  • src/lib/tools.ts registers metadata.

Setup commands

npm install npm test npm run typecheck npm run build npm run dev

Change rules

  • Treat the first row as the header unless a new explicit header option is added.
  • Pad every row to the same column count before rendering.
  • Escape pipe characters inside cells.
  • Normalize cell newlines to spaces so output remains a valid table.
  • Keep alignment strings limited to none, left, center, and right.
  • Return an empty string for no rows or an empty header row.
  • If row or column limits are added in the UI, keep pure logic behavior documented.

Testing

Test basic tables, header-only tables, empty input, ragged rows, pipe escaping, newline normalization, left, center, right, and default alignment behavior.

PR checklist

  • npm test passes for markdown-table-generator.
  • Ragged rows render without losing cells.
  • Alignment separators match selected alignments.
  • Generated Markdown is copy-ready.