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

feat(table): support align option #37

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

StrivingRabbit
Copy link
Contributor

Create md table.

Columns and rows may need to be the same length?Or is this what you expected?

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@75bb878). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #37   +/-   ##
=======================================
  Coverage        ?   97.10%           
=======================================
  Files           ?       11           
  Lines           ?      484           
  Branches        ?      139           
=======================================
  Hits            ?      470           
  Misses          ?       12           
  Partials        ?        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/render.ts Outdated
@@ -140,6 +140,12 @@ export function codeBlock(
* @group render_utils
*/
export function table(table: { rows: string[][]; columns: string[] }): string {
const columnLength = table.columns.length;
if (table.rows.some((row) => row.length !== columnLength)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some rows might have empty leading values in their cells so this can happen

Copy link
Contributor Author

@StrivingRabbit StrivingRabbit Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, you are right. But if this may cause mistakes that developers are not easy to detect.

@StrivingRabbit
Copy link
Contributor Author

I made some new changes.

@StrivingRabbit StrivingRabbit changed the title fix(table): Columns and row should be the same length feat(table): table options add align parameter Nov 28, 2024
@pi0 pi0 changed the title feat(table): table options add align parameter feat(table): support align option Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants