[PATCH 2/4] doc: add table styles for guides

Thomas Monjalon thomas at monjalon.net
Fri Jul 18 00:05:42 CEST 2025


Add 2 style classes for tables:
	- numbered-table: numbering table rows
	- punchcard: colouring filled cells

They can be used by inserting the class comment before the table:

.. rst-class:: numbered-table
.. rst-class:: punchcard

Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
---
 doc/guides/custom.css | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/doc/guides/custom.css b/doc/guides/custom.css
index 7db37ffc68..9c19a28cc8 100644
--- a/doc/guides/custom.css
+++ b/doc/guides/custom.css
@@ -27,3 +27,45 @@
 th.head {
 	background-color: #ccc;
 }
+
+/* Class numbering table rows in the first column.
+ * Usage: insert the following line before the table without indent.
+ *        .. rst-class:: numbered-table
+ */
+.numbered-table {
+	counter-reset: row-number;
+}
+.numbered-table tbody tr {
+	counter-increment: row-number;
+}
+.numbered-table tr td:first-child::before {
+	content: counter(row-number) " - ";
+	display: inline-block;
+	min-width: 2.5em;
+}
+.numbered-table tr td:first-child p {
+	display: inline-block;
+}
+
+/* Class highlighting non-empty table cells in green color.
+ * Usage: insert the following line before the table without indent.
+ *        .. rst-class:: punchcard
+ */
+.punchcard {
+	vertical-align: middle;
+}
+.punchcard th,
+.punchcard td:not(:first-child) {
+	text-align: center;
+}
+.punchcard tbody td {
+	padding: 4px 12px !important;
+}
+.punchcard tbody .row-odd td:not(:first-child):not(:empty) {
+	background-color: #cf9 !important;
+	color: #0c0 !important;
+}
+.punchcard tbody .row-even td:not(:first-child):not(:empty) {
+	background-color: #ce9 !important;
+	color: #0b0 !important;
+}
-- 
2.47.1



More information about the dev mailing list