Skip to content

Commit 04def8c

Browse files
committed
Add deploy_docs command and standardize version markers
- Add `just deploy_docs` command to build and deploy documentation to GitHub Pages independently of the full release process - Convert all "New in development version" markers to use MkDocs !!! info admonition format for better visual consistency - Update CLAUDE.md with documentation guidance showing when to use indented vs non-indented descriptions in version callouts - Ensure version markers only contain what's specifically new, not all feature documentation The deployment script will continue to work as it replaces the "New in development version" text regardless of surrounding markdown format.
1 parent a3eaa92 commit 04def8c

File tree

6 files changed

+63
-28
lines changed

6 files changed

+63
-28
lines changed

CLAUDE.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,38 @@ Coverage is automatically generated when running `just test`. View the HTML repo
5858

5959
### Documentation
6060
```bash
61-
just docs # Serve documentation locally at http://127.0.0.1:8080
61+
just docs # Serve documentation locally at http://127.0.0.1:8080
62+
just deploy_docs # Build and deploy documentation to GitHub Pages
6263
```
6364

64-
Documentation is built with MkDocs and automatically deployed to GitHub Pages during `just deploy`.
65+
Documentation is built with MkDocs. Use `just deploy_docs` to manually deploy to GitHub Pages, or it will be automatically deployed during `just deploy`.
6566

66-
**When adding new features to documentation**, mark them with version callouts:
67+
**When adding new features to documentation**, mark them with version callouts using the `!!! info` admonition format:
6768

6869
```markdown
69-
**New in development version**
70+
!!! info "New in development version"
7071

71-
Description of the new feature...
72+
Full description of the feature continues here...
73+
```
74+
75+
For subsection-level features (like specific setting options), use an indented brief description inside the admonition, then continue with full documentation outside:
76+
77+
```markdown
78+
!!! info "New in development version"
79+
80+
Brief description of what's specifically new about this option.
81+
82+
Full documentation of the option continues here with examples, code blocks, etc.
83+
```
84+
85+
Example:
86+
```markdown
87+
!!! info "flag_url: New in development version"
88+
89+
Per-country `flag_url` overrides allow custom country codes to reuse existing flag image assets.
90+
91+
A custom flag image URL for this country. Usage examples:
92+
...
7293
```
7394

7495
During release, the deployment script automatically replaces all "New in development version" markers with "New in version X.Y.Z" based on the release version. This ensures users know which version introduced each feature.

docs/advanced/customization.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ When creating a custom `Countries` subclass, you can override these settings (wi
156156

157157
## Temporary Context-Based Customization
158158

159-
**New in development version**
159+
!!! info "New in development version"
160160

161161
For per-request or temporary overrides (such as in views or middleware), use the `countries_context()` context manager. This allows you to temporarily override any country option without modifying global settings or creating custom subclasses.
162162

@@ -367,7 +367,9 @@ COUNTRIES_OVERRIDE = {
367367

368368
### flag_url (optional)
369369

370-
**New in development version**
370+
!!! info "New in development version"
371+
372+
Per-country `flag_url` overrides allow custom country codes to reuse existing flag image assets or point to bespoke flags.
371373

372374
A custom flag image URL for this country. This is particularly useful when using custom country codes that need to reference existing flag images:
373375

docs/advanced/dynamic-ordering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Dynamic Country Ordering
22

3-
**New in development version**
3+
!!! info "New in development version"
44

55
Django-countries supports dynamic country ordering based on user language, preferences, or other contextual factors. This allows you to automatically show relevant countries first in dropdowns and forms.
66

docs/advanced/multiple.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ Note that `__contains` performs a substring match on the stored comma-separated
127127

128128
### Django Admin Filtering
129129

130-
**New in development version**
130+
!!! info "New in development version"
131131

132-
The `CountryFilter` in Django admin automatically works with `multiple=True` fields:
132+
The `CountryFilter` in Django admin automatically works with `multiple=True` fields.
133+
134+
The `CountryFilter` in Django admin can be used with `multiple=True` fields:
133135

134136
```python
135137
from django.contrib import admin

docs/usage/settings.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ You can override the following metadata for each country:
7979
- **ioc_code**: Custom IOC (International Olympic Committee) code
8080
- **flag_url**: Custom flag image URL (useful for custom country codes that need to reference existing flags)
8181

82-
**New in development version**
82+
!!! info "flag_url: New in development version"
8383

84-
Per-country `flag_url` overrides allow custom country codes to reuse existing flag image assets or point to bespoke flags without affecting the global `COUNTRIES_FLAG_URL`.
84+
Per-country `flag_url` overrides allow custom country codes to reuse existing flag image assets or point to bespoke flags without affecting the global `COUNTRIES_FLAG_URL`.
8585

8686
!!! tip
8787
When specifying only metadata fields (like `flag_url`, `ioc_code`) without providing `name` or `names`, the original country name is preserved. This allows you to customize flags or codes without losing the standard country name.
@@ -146,7 +146,7 @@ COUNTRIES_FIRST_BREAK = "───────────" # Adds visual separ
146146
**Type:** `dict`
147147
**Default:** `{}`
148148

149-
**New in development version**
149+
!!! info "New in development version"
150150

151151
Map language codes to lists of countries to show first. Enables dynamic country ordering based on the user's current language. **Overrides** `COUNTRIES_FIRST` when a language matches.
152152

@@ -176,7 +176,7 @@ COUNTRIES_FIRST_BY_LANGUAGE = {
176176
**Type:** `bool`
177177
**Default:** `False`
178178

179-
**New in development version**
179+
!!! info "New in development version"
180180

181181
Enable automatic country detection from the user's locale. Auto-detected countries are **prepended** to `COUNTRIES_FIRST`.
182182

@@ -277,22 +277,22 @@ class Product(models.Model):
277277
country = CountryField(countries=EUCountries)
278278
```
279279

280-
**New in development version**
280+
!!! info "New in development version"
281281

282-
**Language-based ordering per field:**
282+
**Language-based ordering per field:**
283283

284-
```python
285-
class RegionalCountries(Countries):
286-
first_by_language = {
287-
'en': ['US', 'GB', 'CA', 'AU'],
288-
'de': ['DE', 'AT', 'CH'],
289-
'fr': ['FR', 'BE', 'CH', 'CA'],
290-
}
291-
292-
class Customer(models.Model):
293-
name = models.CharField(max_length=100)
294-
country = CountryField(countries=RegionalCountries)
295-
```
284+
```python
285+
class RegionalCountries(Countries):
286+
first_by_language = {
287+
'en': ['US', 'GB', 'CA', 'AU'],
288+
'de': ['DE', 'AT', 'CH'],
289+
'fr': ['FR', 'BE', 'CH', 'CA'],
290+
}
291+
292+
class Customer(models.Model):
293+
name = models.CharField(max_length=100)
294+
country = CountryField(countries=RegionalCountries)
295+
```
296296

297297
See [Single Field Customization](../advanced/customization.md#single-field-customization) for more details.
298298

justfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ check:
156156
docs:
157157
uv run --group docs mkdocs serve --livereload --dev-addr 127.0.0.1:8080
158158

159+
# Build and deploy documentation to GitHub Pages
160+
deploy_docs:
161+
@echo "Building documentation..."
162+
uv run --group docs mkdocs build --strict
163+
@echo "✓ Documentation builds successfully"
164+
@echo ""
165+
@echo "Deploying to GitHub Pages..."
166+
uv run --group docs mkdocs gh-deploy --force
167+
@echo "✓ Documentation deployed"
168+
159169
# Update English translation source file with new translatable strings
160170
tx-makemessages:
161171
@echo "Updating English translation source file..."

0 commit comments

Comments
 (0)