mkdocs_newsletter
¶
Automatically create newsletters from the changes in a mkdocs repository.
Change
¶
Bases: BaseModel
Represent a single semantic change in a git repository.
Attributes:
Name | Type | Description |
---|---|---|
date |
datetime
|
When the change was done. |
summary |
str
|
short description of the change. |
type_ |
Optional[str]
|
semantic type of change, such as feature or fix. |
message |
Optional[str]
|
long description of the change. |
breaking |
bool
|
if the change breaks previous functionality. |
category |
Optional[str]
|
name of the group of files that share meaning. |
category_order |
Optional[int]
|
order of the category against all categories. |
subcategory |
Optional[str]
|
name of the subgroup of files that share meaning. |
category_order |
Optional[int]
|
order of the subcategory against all subcategories. |
file_ |
Optional[str]
|
markdown file name. |
file_section |
Optional[str]
|
title of the file containing the change. |
file_section_order |
Optional[int]
|
order of the file in the subcategory or category that holds the file. |
file_subsection |
Optional[str]
|
title of the section of the file the change belongs to. |
Source code in mkdocs_newsletter/model.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
Newsletter
¶
Bases: BasePlugin
Define the MkDocs plugin to create newsletters.
Source code in mkdocs_newsletter/entrypoints/mkdocs_plugin.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
__init__()
¶
Initialize the basic attributes.
Attributes:
Name | Type | Description |
---|---|---|
repo |
Git repository to analyze. |
Source code in mkdocs_newsletter/entrypoints/mkdocs_plugin.py
27 28 29 30 31 32 33 34 |
|
on_config(config)
¶
Create the new newsletters and load them in the navigation.
Through the following steps:
- Detect which were the last changes for each of the feeds.
- Parse the changes from the git history that were done before the last changes.
- Create the newsletter articles.
- Update the navigation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
Optional[MkDocsConfig]
|
MkDocs global configuration object. |
required |
Returns:
Name | Type | Description |
---|---|---|
config |
MkDocsConfig
|
MkDocs config object with the new newsletters in the Newsletter section. |
Source code in mkdocs_newsletter/entrypoints/mkdocs_plugin.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
on_post_build(*, config)
¶
Create the RSS feeds.
Source code in mkdocs_newsletter/entrypoints/mkdocs_plugin.py
76 77 78 |
|
digital_garden_changes(changes, last_published=None)
¶
Extract the changes that need to be published for digital_garden repositories.
For a change to be published it needs to:
Be made before the first day of the year and after the last published change
in the year feed.
Be made before the first day of the month and after the last published change
in the month feed.
Be made before the last Monday and after the last published change in the
week feed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
changes |
List[Change]
|
The list of Change objects to publish. |
required |
last_published |
Optional[LastNewsletter]
|
last published date per feed type |
None
|
Returns:
Name | Type | Description |
---|---|---|
changes |
DigitalGardenChanges
|
Ordered changes to publish per feed. |
Source code in mkdocs_newsletter/services/newsletter.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|
last_newsletter_changes(newsletter_dir)
¶
Extract the date of the last change of the last newsletter for each feed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
newsletter_dir |
str
|
Directory containing the newsletter articles. |
required |
Returns:
Name | Type | Description |
---|---|---|
last_newsletter |
LastNewsletter
|
LastNewsletter object. |
Source code in mkdocs_newsletter/services/newsletter.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
semantic_changes(repo, min_date=None)
¶
Extract meaningful changes from a git repository.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo |
Repo
|
Git repository to analyze. |
required |
Returns:
Name | Type | Description |
---|---|---|
changes |
List[Change]
|
List of Change objects. |
Source code in mkdocs_newsletter/services/git.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|