DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Subject: [PATCH 2/4] doc: add table styles for guides
Date: Fri, 18 Jul 2025 00:05:42 +0200	[thread overview]
Message-ID: <20250717220912.376503-3-thomas@monjalon.net> (raw)
In-Reply-To: <20250717220912.376503-1-thomas@monjalon.net>

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


  parent reply	other threads:[~2025-07-17 22:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 22:05 [PATCH 0/4] rework mlx5 guide Thomas Monjalon
2025-07-17 22:05 ` [PATCH 1/4] doc: simplify mlx5 devices lists Thomas Monjalon
2025-07-17 22:05 ` Thomas Monjalon [this message]
2025-07-17 22:05 ` [PATCH 3/4] doc: rework mlx5 guide per features Thomas Monjalon
2025-07-17 22:05 ` [PATCH 4/4] doc: add testpmd command examples in mlx5 guide Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250717220912.376503-3-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).