Skip to content

Commit

Permalink
Improve feature profile summary table styling
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
not-my-profile committed Jul 13, 2023
1 parent 7465249 commit 831eb3e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
21 changes: 21 additions & 0 deletions assets/scss/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
tr {
// Unset the .table-striped styling that docsy applies by default.
background-color: unset !important;
}
.required {
background-color: rgba($black, 0.07);
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
}
td {
position: relative;
padding: .3rem 0.75rem !important;
}
}
2 changes: 2 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
[markup.highlight]
# See a complete list of available styles at https://xyproto.github.io/splash/docs/all.html
# If the style is changed, remember to regenerate the CSS with:
Expand Down
2 changes: 2 additions & 0 deletions content/client-server-api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2565,6 +2565,7 @@ that profile.

#### Summary

{{<summary-table>}}
| Module / Profile | Web | Mobile | Desktop | CLI | Embedded |
|------------------------------------------------------------|-----------|----------|----------|----------|----------|
| [Instant Messaging](#instant-messaging) | Required | Required | Required | Required | Optional |
Expand Down Expand Up @@ -2603,6 +2604,7 @@ that profile.
| [Event Annotations and reactions](#event-annotations-and-reactions) | Optional | Optional | Optional | Optional | Optional |
| [Threading](#threading) | Optional | Optional | Optional | Optional | Optional |
| [Reference Relations](#reference-relations) | Optional | Optional | Optional | Optional | Optional |
{{</summary-table>}}

*Please see each module for more details on what clients need to
implement.*
Expand Down
6 changes: 6 additions & 0 deletions layouts/shortcodes/summary-table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{/*

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 }}

0 comments on commit 831eb3e

Please sign in to comment.