Skip to content

Add table spanning support #420

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

Conversation

dobromir-hristov
Copy link
Contributor

@dobromir-hristov dobromir-hristov commented Aug 23, 2022

Bug/issue #, if applicable: 98017748

Summary

Adds support for Table col and row spanning, based on the initial DocC draft proposal.

image

Note:
This is still experimental and needs to be synced with actual DocC RenderJSON. For now think of this as a POC.

Dependencies

Testing

Use the provided JSON.

example_tablespan.json.zip

Steps:

  1. Paste it in your doccarchive of choice
  2. Visit the page
  3. Assert a table is rendered with row and col spans.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

Copy link
Contributor

@mportiz08 mportiz08 left a comment

Choose a reason for hiding this comment

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

The JS code for creating the markup looks good, and I like that it's pretty minimal in terms of what actually changed. The empty cells for older versions of DocC without extended data look how I'd expect to as well—nice job!

I do have some concerns about the change in the visual style that is now happening only for tables that have cells that span. It wasn't obvious why there needs to be a difference between normal tables without any. It seems like the width and border of the table is changing, but it isn't obvious why.

@dobromir-hristov dobromir-hristov marked this pull request as ready for review September 16, 2022 11:32
@dobromir-hristov
Copy link
Contributor Author

@swift-ci test

Copy link
Member

@marinaaisa marinaaisa left a comment

Choose a reason for hiding this comment

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

Code looks good! Very cool

Is this how it's intended to be? It looks a bit strange example but I understand that it is

Screenshot 2022-09-16 at 16 57 28

@dobromir-hristov
Copy link
Contributor Author

@marinaaisa no, I have not updated the example since @QuietMisdreavus changed the spec

@dobromir-hristov
Copy link
Contributor Author

@swift-ci test

@dobromir-hristov
Copy link
Contributor Author

@marinaaisa test it again :)

@QuietMisdreavus
Copy link
Contributor

@marinaaisa @dobromir-hristov It should also be noted that the current implementation in Swift-Markdown and Swift-DocC uses ^ symbols as a row-span marker, not ". That's part of what's happening here.

@dobromir-hristov
Copy link
Contributor Author

@marinaaisa @dobromir-hristov It should also be noted that the current implementation in Swift-Markdown and Swift-DocC uses ^ symbols as a row-span marker, not ". That's part of what's happening here.

Tested it, works like a charm. Thanks. We just need to clear up some styling confusion and we are good to go.

@marinaaisa
Copy link
Member

Okay, now it looks as expected :) thanks @dobromir-hristov @QuietMisdreavus !

Screenshot 2022-09-20 at 17 54 06

renderTableChildren(node.rows, node.header)
return createElement(Table, {
props: {
spanned: !!node.extendedData,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still needed since the class isn't being used anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not, just thought it might help future devs, if they want to style these tables in some way with custom styling 🤔

@dobromir-hristov
Copy link
Contributor Author

@swift-ci test

@dobromir-hristov dobromir-hristov merged commit 9eb5bb4 into swiftlang:main Sep 22, 2022
@dobromir-hristov dobromir-hristov deleted the dhristov/r98017748-add-table-spanning branch September 22, 2022 06:18
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.

5 participants