Skip to content

Commit fe583c5

Browse files
authored
📚 Make octicon list a table (#188)
1 parent 5749864 commit fe583c5

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

pyproject.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Homepage = "https://github.com/executablebooks/sphinx-design"
3434
Documentation = "https://sphinx-design.readthedocs.io"
3535

3636
[project.optional-dependencies]
37-
code_style = ["pre-commit>=3,<4"]
37+
code-style = ["pre-commit>=3,<4"]
3838
rtd = ["myst-parser>=1,<3"]
3939
testing = [
4040
"myst-parser>=1,<3",
@@ -43,10 +43,10 @@ testing = [
4343
"pytest-regressions",
4444
"defusedxml",
4545
]
46-
theme_furo = ["furo~=2023.7.0"]
47-
theme_pydata = ["pydata-sphinx-theme~=0.13.0"]
48-
theme_rtd = ["sphinx-rtd-theme~=1.0"]
49-
theme_sbt = ["sphinx-book-theme~=1.0"]
46+
theme-furo = ["furo~=2023.7.0"]
47+
theme-pydata = ["pydata-sphinx-theme~=0.13.0"]
48+
theme-rtd = ["sphinx-rtd-theme~=1.0"]
49+
theme-sbt = ["sphinx-book-theme~=1.0"]
5050

5151
[tool.flit.sdist]
5252
exclude = [

sphinx_design/icons.py

+23-14
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,31 @@ class AllOcticons(SphinxDirective):
155155
def run(self) -> list[nodes.Node]:
156156
"""Run the directive."""
157157
classes = self.options.get("class", [])
158-
list_node = nodes.bullet_list()
158+
table = nodes.table()
159+
group = nodes.tgroup(cols=2)
160+
table += group
161+
group.extend(
162+
(
163+
nodes.colspec(colwidth=1),
164+
nodes.colspec(colwidth=1),
165+
)
166+
)
167+
body = nodes.tbody()
168+
group += body
159169
for icon in list_octicons():
160-
item_node = nodes.list_item()
161-
item_node.extend(
162-
(
163-
nodes.literal(icon, icon),
164-
nodes.Text(": "),
165-
nodes.raw(
166-
"",
167-
nodes.Text(get_octicon(icon, classes=classes)),
168-
format="html",
169-
),
170-
)
170+
row = nodes.row()
171+
body += row
172+
cell = nodes.entry()
173+
row += cell
174+
cell += nodes.literal(icon, icon)
175+
cell = nodes.entry()
176+
row += cell
177+
cell += nodes.raw(
178+
"",
179+
get_octicon(icon, classes=classes),
180+
format="html",
171181
)
172-
list_node += item_node
173-
return [list_node]
182+
return [table]
174183

175184

176185
class fontawesome(nodes.Element, nodes.General): # noqa: N801

0 commit comments

Comments
 (0)