Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add debugging capabilities #279

Closed
speedytwenty opened this issue Mar 27, 2022 · 0 comments · Fixed by #288
Closed

Feature: Add debugging capabilities #279

speedytwenty opened this issue Mar 27, 2022 · 0 comments · Fixed by #288
Labels
enhancement New feature or request

Comments

@speedytwenty
Copy link
Collaborator

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.

@speedytwenty speedytwenty added the enhancement New feature or request label Mar 27, 2022
@speedytwenty speedytwenty linked a pull request Apr 1, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant