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

Improve feature profile summary table styling #1599

Conversation

not-my-profile
Copy link
Contributor

@not-my-profile not-my-profile commented Jul 13, 2023

This PR improves the styling of the feature profile summary table in the Client-Server API specification:

Before After
image image

Preview: https://pr1599--matrix-spec-previews.netlify.app/client-server-api/#summary

@not-my-profile not-my-profile requested a review from a team as a code owner July 13, 2023 10:39
The 'Feature Profiles' section of the 'Client-Server API' specification
contains a table, showing whether a module is required or optional for
every profile. Previously the table was hard to read since "Required"
looks visually very similar to "Optional".

This commit improves the readability of the table by automatically
applying a darker background color to table cells containing "Required"
via a new Hugo shortcode.

Signed-off-by: Martin Fischer <martin@push-f.com>
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution.

It seems quite complicated, though. Could we achieve much the same effect rather more simply just by making the "Required" text bold ?

Please do make sure that your changes are well-commented to help future maintainers understand. I've made some suggestions.

@@ -0,0 +1,6 @@
{{/*

This template is used to visually emphasize table cells containing the text "Required".
Copy link
Member

Choose a reason for hiding this comment

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

Please could you add some more words about how it is intended to be used? Is it for all tables which summarise something, or for a specific summary table? What is the input (a markdown table, I think?), and how is the output returned (it outputs an HTML table ?)

Copy link
Member

Choose a reason for hiding this comment

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

I note it also adds a summary-table CSS class to the table, which should be mentioned.

This template is used to visually emphasize table cells containing the text "Required".

*/}}
{{ print (replace .Inner "Required" "<span class=required></span>Required") "{.summary-table}" | markdownify }}
Copy link
Member

Choose a reason for hiding this comment

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

why is the print necessary here? isn't the result of {{ }} written to the output anyway?

@@ -2565,6 +2565,7 @@ that profile.

#### Summary

{{<summary-table>}}
Copy link
Member

Choose a reason for hiding this comment

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

Could we use {{% summary-table %}} so that we don't have to call markdownify explicitly?

Comment on lines +524 to +528
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
Copy link
Member

Choose a reason for hiding this comment

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

Some comments would be nice.

Suggested change
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
// expand to fill the entire table cell
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;

bottom: 0;
left: 0;
right: 0;
z-index: -1;
Copy link
Member

Choose a reason for hiding this comment

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

why is this required?

z-index: -1;
}
td {
position: relative;
Copy link
Member

Choose a reason for hiding this comment

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

I think this is something to do with the span resizing? comment it, please

@@ -512,3 +512,24 @@ dd {
border-radius: 0.25rem; // was $border-radius, but that var isn't accessible here.
}
}

/* Styling for the summary-table shortcode */
.summary-table {
Copy link
Member

Choose a reason for hiding this comment

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

I think this makes the !important on the padding unnecessary:

Suggested change
.summary-table {
table.summary-table {

}
td {
position: relative;
padding: .3rem 0.75rem !important;
Copy link
Member

Choose a reason for hiding this comment

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

Comment, please:

Suggested change
padding: .3rem 0.75rem !important;
// use a more compact table layout than the default.
padding: .3rem 0.75rem !important;

@@ -28,6 +28,8 @@ weight = 1
[markup.goldmark.renderer]
# Enables us to render raw HTML
unsafe = true
[markup.goldmark.parser.attribute]
block = true # used by the summary-table shortcode
Copy link
Member

Choose a reason for hiding this comment

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

it would be nice to give a quick example of what it actually does. And/or link to the documentation

@richvdh
Copy link
Member

richvdh commented Jul 19, 2023

Please also take a look at the contributing guide, particularly with respect to changelog entries and sign-off.

Edit: I see you have signed this off, thank you! Please add a changelog entry though.

@richvdh
Copy link
Member

richvdh commented Oct 11, 2023

@not-my-profile are you still interested in working on this?

@not-my-profile
Copy link
Contributor Author

Sorry that I haven't replied. Thanks for the review ... your feedback is very reasonable and appreciated. I unfortunately am currently busy with other projects. I might circle back to this at some point in the future but can't tell you when.

@richvdh
Copy link
Member

richvdh commented Oct 12, 2023

@not-my-profile understood, and no need to apologise.

If it's unlikely you'll be working on this in the near future, then rather than keeping this PR open indefinitely, I'll go ahead and close it for now. That's not to say we're not interested in the work, and if you get a chance to pick it up again, do give us a ping and we'll be happy to reopen it!

Thanks for the contribution in any case.

@richvdh richvdh closed this Oct 12, 2023
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