as_gridtable.character: Validate and Normalize a Simple Pandoc Grid Table

View source: R/gridtable.R

as_gridtable.characterR Documentation

Validate and Normalize a Simple Pandoc Grid Table

Description

Validate a character string containing a simple Pandoc grid table and rebuild it by parsing structural '+' and '|' delimiters, discarding the original spacing, and returning an aligned grid table.

Usage

## S3 method for class 'character'
as_gridtable(x, ...)

Arguments

x

Character scalar containing one simple Pandoc grid table.

...

Currently unused.

Details

The accepted grid-table form is intentionally restricted: every boundary row must contain the same number of '+' delimiters; every text row is split on every '|' and must therefore contain the same number of '|' delimiters; each boundary span must contain at least one '-' or '='; the first boundary row and all body boundary rows must use '-'; the second boundary row must be the only '=' boundary row; and exactly one header text row must appear between the first and second boundary rows; header cells must be non-empty and unique after trimming. Literal '|' characters inside cell text are interpreted as delimiters, not cell content.

Value

Character scalar with class gridtable containing a canonical Pandoc grid table.

See Also

Other gridtable: as.data.frame.gridtable(), as_calibrated(), as_calibrated.data.frame(), as_gridtable(), as_gridtable.data.frame(), kbl(), kbl.calibrated(), kbl.default(), kbl.gridtable(), print.gridtable()


tablet documentation built on July 19, 2026, 9:06 a.m.