Skip to content

Feature: Add debugging capabilities #279

@speedytwenty

Description

@speedytwenty

With the introduction of #278, it will become possible to "easily" detect [layout] errors in the table data. Insofar I am not aware of any mechanism that could assist implementors in correcting their table layout. Yet I wonder if we could implement a simple debugging solution.

If we can now detect an invalid row count (rowSpan exceeds the total rows), perhaps we can detect an invalid column count—let the output be what it will be as is—but add a "debug" option which essentially creates an array of errors/warnings that implementors can use to debug. Eg.

const table = new Table({ debug: true });
console.log(table.toString());
console.log(table.debug); // Output row position and cell x/y positioning
console.log(table.errors); // Output any errors produced by the table (these are more like "warnings" than "errors")

To detect an invalid column count would require calculating the "max column" during the layout calculation and then re-traversing each row at the end to see that it satisfied the "max column". This traversal is presently unnecessary for rendering, but could be triggered with the debug flag in the table options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions