Skip to content

Commit e2dc2fd

Browse files
committed
use pydata sphinx theme
AI Prompts: claude-sonnet-4-6: <ide_opened_file>The user opened the file ./docs/conf.py in the IDE. This may or may not be related to the current task.</ide_opened_file> I would like this in the left side of each page: - github stars - link to repository - link to pypi - link to edit the page
1 parent a0a6625 commit e2dc2fd

File tree

9 files changed

+121
-25
lines changed

9 files changed

+121
-25
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ venv: $(VENV)/bin/activate
2121

2222
# ── docs ───────────────────────────────────────────────────────────────────
2323

24-
.PHONY: html livehtml clean help clean-python clean-all test
24+
.PHONY: html livehtml clean help clean-python clean-all test init
2525

2626
html: venv
2727
$(SPHINXBUILD) -M html $(SOURCEDIR) $(BUILDDIR) $(SPHINXOPTS)
@@ -42,3 +42,5 @@ help: venv
4242

4343
test: venv
4444
$(PYTEST)
45+
46+
init: clean-python venv

docs/_static/js/custom-icons.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FontAwesome.library.add(
2+
/**
3+
* Custom icon definitions
4+
*
5+
* see https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/header-links.html#svg-image-icons
6+
*/
7+
{
8+
prefix: "fa-custom",
9+
iconName: "pypi",
10+
icon: [
11+
17.313,
12+
19.807,
13+
[],
14+
"e001",
15+
// https://simpleicons.org/icons/pypi.svg
16+
"m10.383 0.2-3.239 1.1769 3.1883 1.1614 3.239-1.1798zm-3.4152 1.2411-3.2362 1.1769 3.1855 1.1614 3.2369-1.1769zm6.7177 0.00281-3.2947 1.2009v3.8254l3.2947-1.1988zm-3.4145 1.2439-3.2926 1.1981v3.8254l0.17548-0.064132 3.1171-1.1347zm-6.6564 0.018325v3.8247l3.244 1.1805v-3.8254zm10.191 0.20931v2.3137l3.1777-1.1558zm3.2947 1.2425-3.2947 1.1988v3.8254l3.2947-1.1988zm-8.7058 0.45739c0.00929-1.931e-4 0.018327-2.977e-4 0.027485 0 0.25633 0.00851 0.4263 0.20713 0.42638 0.49826 1.953e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36226 0.13215-0.65608-0.073306-0.65613-0.4588-6.28e-5 -0.38556 0.2938-0.80504 0.65613-0.93662 0.068422-0.024919 0.13655-0.038114 0.20156-0.039466zm5.2913 0.78369-3.2947 1.1988v3.8247l3.2947-1.1981zm-10.132 1.239-3.2362 1.1769 3.1883 1.1614 3.2362-1.1769zm6.7177 0.00213-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2439-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.016195v3.8275l3.244 1.1805v-3.8254zm16.9 0.21143-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2432-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.019027v3.8247l3.244 1.1805v-3.8254zm13.485 1.4497-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm2.4018 0.38127c0.0093-1.83e-4 0.01833-3.16e-4 0.02749 0 0.25633 0.0085 0.4263 0.20713 0.42638 0.49826 1.97e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36188 0.1316-0.65525-0.07375-0.65542-0.4588-1.95e-4 -0.38532 0.29328-0.80469 0.65542-0.93662 0.06842-0.02494 0.13655-0.03819 0.20156-0.03947zm-5.8142 0.86403-3.244 1.1805v1.4201l3.244 1.1805z",
17+
],
18+
},
19+
);

docs/conf.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
release = sphinx_icalendar.__version__
66

77
extensions = [
8+
"sphinx.ext.viewcode",
9+
"sphinx_copybutton",
810
"sphinx_icalendar",
11+
"sphinx_issues",
912
]
1013

1114
html_theme = "alabaster"
@@ -15,3 +18,60 @@
1518
"github_user": "pycalendar",
1619
"github_repo": "sphinx-icalendar",
1720
}
21+
22+
html_context = {
23+
# "github_url": "https://github.com", # or your GitHub Enterprise site
24+
"github_user": html_theme_options["github_user"],
25+
"github_repo": html_theme_options["github_repo"],
26+
"github_version": "main",
27+
"doc_path": "docs",
28+
}
29+
30+
31+
source_suffix = {".rst": "restructuredtext"}
32+
33+
# -- sphinx_copybutton configuration ----------------------------------
34+
# https://sphinx-copybutton.readthedocs.io/en/latest/use.html
35+
# Exclude line numbers, prompts, and console output when copying code blocks.
36+
copybutton_exclude = ".linenos, .gp, .go"
37+
38+
39+
# -- sphinx_issues configuration ----------------------------------
40+
issues_github_path = "pycalendar/sphinx-icalendar"
41+
42+
html_theme_options = {
43+
"icon_links": [
44+
{
45+
"name": "GitHub",
46+
"url": "https://github.com/pycalendar/sphinx-icalendar",
47+
"icon": "fa-brands fa-square-github",
48+
"type": "fontawesome",
49+
"attributes": {
50+
"target": "_blank",
51+
"rel": "noopener me",
52+
"class": "nav-link custom-fancy-css",
53+
},
54+
},
55+
{
56+
"name": "PyPI",
57+
"url": "https://pypi.org/project/sphinx-icalendar",
58+
"icon": "fa-custom fa-pypi",
59+
"type": "fontawesome",
60+
"attributes": {
61+
"target": "_blank",
62+
"rel": "noopener me",
63+
"class": "nav-link custom-fancy-css",
64+
},
65+
},
66+
],
67+
"use_edit_page_button": True,
68+
}
69+
70+
html_theme = "pydata_sphinx_theme"
71+
html_static_path = [
72+
"_static",
73+
]
74+
html_js_files = [
75+
("js/custom-icons.js", {"defer": "defer"}),
76+
]
77+
pygments_style = "sphinx"

docs/contributing.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,23 @@ Remove the virtual environment as well:
8181
New release
8282
-----------
8383

84+
Before the release, check the documentation and that it renders properly.
85+
8486
To create a new release, run:
8587

8688
.. code-block:: bash
8789
8890
git checkout main
8991
git tag v0.1.1
9092
git push origin v0.1.1
93+
94+
Notes on documentation
95+
----------------------
96+
97+
- Use "iCalendar" when describing a file format that follows that standard.
98+
- Use "jCal" when describing a file format that follows that standard.
99+
- Use ".ics" or ".ifb" when describing a file's extension. See :rfc:`5545#section-8.1`.
100+
- Don't use "ICS" anywhere, including the tabbed interface. It's not used as an acronym in RFC 5545. Use "iCalendar" instead.
101+
102+
.. seealso::
103+
:issue:`3`

docs/usage/calendar.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ The extension detects the format automatically.
2222
END:VEVENT
2323
END:VCALENDAR
2424
25-
Below, we use a different ICS source to show a calendar with a name and description.
26-
The original ICS formatting is preserved.
25+
Below, we use a different iCalendar source to show a calendar with a name and description.
26+
The original iCalendar formatting is preserved.
2727

2828

2929
.. code-block:: calendar
@@ -111,11 +111,11 @@ Options
111111
A ``calendar`` directive support the following options:
112112

113113
- ``:emphasize-lines:`` - A comma-separated list of line numbers to emphasize.
114-
This only applies to the source code blocks with ``jcal`` or ``ics`` content.
115-
- ``:linenos:`` - If set, adds line numbers.
114+
This only applies to the source code blocks, not the converted ones.
115+
- ``:linenos:`` - If set, adds line numbers to all code blocks.
116116

117117

118-
Below, you can find an ``ics`` calendar that highlights a single event.
118+
Below, you can find an iCalendar that highlights a single event.
119119

120120
.. code-block:: rst
121121

docs/usage/ics.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
ICS syntax highlighting
2-
=======================
1+
iCalendar syntax highlighting
2+
=============================
33

4-
The extension also registers an ``ics`` (and ``icalendar``) language alias for Pygments so you can highlight raw ICS snippets in ordinary code blocks without triggering the calendar rendering:
4+
The extension also registers an ``ics`` (and ``icalendar``) language alias for Pygments so you can highlight raw iCalendar snippets in ordinary code blocks without triggering the calendar rendering:
55

66
.. code-block:: rst
77
@@ -30,7 +30,7 @@ The result is a static, highlighted code block:
3030
Options
3131
-------
3232

33-
``ics`` supports the ``linenos`` and ``emphasize-lines`` options, just like any
33+
iCalendar supports the ``linenos`` and ``emphasize-lines`` options, just like any
3434
other ``.. code-block::`` language:
3535

3636
.. code-block:: rst

docs/usage/jcal.rst

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
jCal syntax highlighting
2-
========================
1+
jCalendar syntax highlighting
2+
=============================
33

44
The extension also registers ``jcal`` (and ``jcalendar``) as language aliases that apply JSON highlighting to raw jCal snippets without triggering the calendar rendering:
55

@@ -47,17 +47,6 @@ other ``.. code-block::`` language:
4747
:linenos:
4848
:emphasize-lines: 5, 6
4949
50-
["vcalendar",
51-
[["version", {}, "text", "2.0"]],
52-
[["vevent",
53-
[
54-
["summary", {}, "text", "Quarterly review"],
55-
["dtstart", {}, "date-time", "2026-04-01T09:00:00Z"],
56-
["dtend", {}, "date-time", "2026-04-01T10:00:00Z"]
57-
], []
58-
]]
59-
]
60-
6150
.. code-block:: jcal
6251
:linenos:
6352
:emphasize-lines: 5, 6

pyproject.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,25 @@ Changelog = "https://sphinx-icalendar.readthedocs.io/en/latest/changelog.html"
4141
Funding = "https://github.com/sponsors/niccokunzmann"
4242

4343
[project.optional-dependencies]
44-
dev = ["pytest", "sphinx", "sphinx-autobuild"]
44+
dev = [
45+
"pytest",
46+
"pydata-sphinx-theme>=0.14.4",
47+
"sphinx>=7",
48+
"sphinx-copybutton>=0.5.2",
49+
"sphinx-design>=0.5.0",
50+
"sphinx-autobuild>=2021.3.14",
51+
"sphinx-issues>=5.0.1",
52+
"sphinx-llms-txt>=0.7.1",
53+
]
4554

4655
[project.entry-points."pygments.lexers"]
4756
ics = "sphinx_icalendar._lexer:ICalendarLexer"
4857
jcal = "sphinx_icalendar._lexer:JCalLexer"
4958

59+
[tool.hatch.version.raw-options]
60+
# see https://github.com/ofek/hatch-vcs/issues/43#issuecomment-1553065222
61+
local_scheme = "no-local-version"
62+
5063
[tool.hatch.version]
5164
source = "vcs"
5265

sphinx_icalendar/_visitors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def visit_calendar_html(self: HTML5Translator, node: calendar_block) -> None:
112112
f'<div class="sd-tab-content docutils">{table_html}</div>'
113113
# rendered ics
114114
f'<input id="cal-{tid}-input--2" name="cal-{tid}" type="radio">'
115-
f'<label for="cal-{tid}-input--2">ICS</label>'
115+
f'<label for="cal-{tid}-input--2">iCalendar</label>'
116116
f'<div class="sd-tab-content docutils">{ics_highlighted}</div>'
117117
# rendered jcal
118118
f'<input id="cal-{tid}-input--3" name="cal-{tid}" type="radio">'

0 commit comments

Comments
 (0)