mkdocs-alias-plugin 0.8.1__tar.gz → 0.8.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: mkdocs-alias-plugin
3
- Version: 0.8.1
3
+ Version: 0.8.2
4
4
  Summary: An MkDocs plugin allowing links to your pages using a custom alias
5
5
  Home-page: https://github.com/eddyluten/mkdocs-alias-plugin
6
6
  Author: Eddy Luten
@@ -20,10 +20,21 @@ Description-Content-Type: text/markdown
20
20
  License-File: LICENSE.md
21
21
  Requires-Dist: mkdocs
22
22
  Requires-Dist: markdown
23
+ Dynamic: author
24
+ Dynamic: author-email
25
+ Dynamic: classifier
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: home-page
29
+ Dynamic: keywords
30
+ Dynamic: license
31
+ Dynamic: requires-dist
32
+ Dynamic: requires-python
33
+ Dynamic: summary
23
34
 
24
35
  # mkdocs-alias-plugin
25
36
 
26
- [![PyPI version](https://badge.fury.io/py/mkdocs-alias-plugin.svg)](https://pypi.org/project/mkdocs-alias-plugin/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![example workflow](https://github.com/eddyluten/mkdocs-alias-plugin/actions/workflows/pylint.yml/badge.svg) [![Downloads](https://pepy.tech/badge/mkdocs-alias-plugin)](https://pepy.tech/project/mkdocs-alias-plugin) ![](https://github.com/eddyluten/mkdocs-alias-plugin/workflows/mkdocs-alias-plugin%20Tests/badge.svg)
37
+ [![PyPI version](https://badge.fury.io/py/mkdocs-alias-plugin.svg)](https://pypi.org/project/mkdocs-alias-plugin/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Downloads](https://pepy.tech/badge/mkdocs-alias-plugin)](https://pepy.tech/project/mkdocs-alias-plugin) [![CI](https://github.com/eddyluten/mkdocs-alias-plugin/workflows/mkdocs-alias-plugin%20CI/badge.svg)](https://github.com/EddyLuten/mkdocs-alias-plugin/actions/workflows/ci.yml)
27
38
 
28
39
  The `mkdocs-alias-plugin` MkDocs plugin allows links to your pages using a custom alias such as `[[my-alias]]` or `[[my-alias|My Title]]`.
29
40
 
@@ -100,6 +111,8 @@ The song references [[wuthering-heights#references|Wuthering Heights]].
100
111
 
101
112
  As of version 0.8.0, you can enable the plugin option `use_anchor_titles` to replace anchor links with the text of the page heading that defined it. This behavior is opt-in to preserve backward compatibility.
102
113
 
114
+ As of version 0.9.0, you may also use `aliases` in addition to (or in place of) the `alias` key in the meta section of your pages. This is to provide some similarity to other Markdown based software that supports aliases, such as Obsidian.
115
+
103
116
  Please refer to the [MkDocs documentation](https://www.mkdocs.org/user-guide/writing-your-docs/#yaml-style-meta-data) for more information on how the meta-data block is used.
104
117
 
105
118
  ### Multiple Aliases
@@ -134,16 +147,23 @@ plugins:
134
147
  - alias:
135
148
  verbose: true
136
149
  use_anchor_titles: true
150
+ use_page_icon: true
137
151
  ```
138
152
 
139
153
  ### `verbose`
140
154
 
141
- You may use the optional `verbose` option to print more information about which aliases were used and defined during the build process. The default value is `false`.
155
+ You may use the optional `verbose` option to print more information about which aliases were used and defined during the build process. A tab-delimited file named `aliases.log` will also be defined at the project root, containing a list of every alias defined by the wiki.
156
+
157
+ The default value is `false` and should only be enabled when debugging issue with the plugin.
142
158
 
143
159
  ### `use_anchor_titles`
144
160
 
145
161
  Setting this flag to true causes the plugin to replace an alias containing an anchor (`[[my-page#sub-heading]]`) with the text of the header that defined it. You can still override the title of the link as usual.
146
162
 
163
+ ### `use_page_icons`
164
+
165
+ Setting this flag to true will include the [page's icon](https://squidfunk.github.io/mkdocs-material/reference/?h=page+icon#setting-the-page-icon) in the alias substitution if it's set for a given page.
166
+
147
167
  ## Troubleshooting
148
168
 
149
169
  ### The link text looks like a path or URL
@@ -168,6 +188,13 @@ Aliases *must* be unique. Ensure that you're not redefining the same alias for a
168
188
 
169
189
  ## Local Development
170
190
 
191
+ Upgrade pip and install the dependencies:
192
+
193
+ ```zsh
194
+ python -m pip install --upgrade pip
195
+ pip install mkdocs pytest pylint markdown setuptools
196
+ ```
197
+
171
198
  Installing a local copy of the plugin:
172
199
 
173
200
  ```zsh
@@ -188,16 +215,33 @@ pylint $(git ls-files '*.py') && pytest -vv
188
215
 
189
216
  ## Changelog
190
217
 
218
+ ## 0.9.0
219
+
220
+ 2025-02-21
221
+
222
+ **Features and Bug Fixes:**
223
+
224
+ - Added the ability to use alias style links to anchors withing the current page, e.g.: `[[#my-anchor]]`.
225
+ - Added support for page icons in link aliases, thank you @joapuiib for your [contribution](https://github.com/EddyLuten/mkdocs-alias-plugin/pull/15)!
226
+ - Added support for using the key `alias` and/or `aliases` for defining page aliases in meta sections.
227
+ - Changed verbose mode to now also generates a tab-delimited log file containing each alias in the wiki.
228
+
191
229
  ## 0.8.1
192
230
 
231
+ 2024-04-08
232
+
193
233
  **Bug Fix:** fixes a bug where annotations would break older versions of Python 3. Bug report: [#9](https://github.com/EddyLuten/mkdocs-alias-plugin/issues/9).
194
234
 
195
235
  ## 0.8.0
196
236
 
237
+ 2024-04-06
238
+
197
239
  This release adds functionality to replace the titles of aliases containing anchors with the text of the heading that defines them. Enable this feature by setting the plugin option `use_anchor_titles` to true. Feature request: [#8](https://github.com/EddyLuten/mkdocs-alias-plugin/issues/8).
198
240
 
199
241
  ### 0.7.1
200
242
 
243
+ 2024-04-07
244
+
201
245
  **Bug Fix:** fixes a bug where any alias with the word "text" would break the plugin due to faulty logic. Bug report: [#7](https://github.com/EddyLuten/mkdocs-alias-plugin/issues/7).
202
246
 
203
247
  ### 0.7.0
@@ -1,29 +1,6 @@
1
- Metadata-Version: 2.1
2
- Name: mkdocs-alias-plugin
3
- Version: 0.8.1
4
- Summary: An MkDocs plugin allowing links to your pages using a custom alias
5
- Home-page: https://github.com/eddyluten/mkdocs-alias-plugin
6
- Author: Eddy Luten
7
- Author-email: eddyluten@gmail.com
8
- License: MIT
9
- Keywords: mkdocs python markdown alias link wiki
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python
12
- Classifier: Programming Language :: Python :: 3 :: Only
13
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
- Classifier: Topic :: Documentation
15
- Classifier: Topic :: Text Processing
16
- Classifier: Topic :: Text Processing :: Markup
17
- Classifier: Topic :: Text Processing :: Markup :: Markdown
18
- Requires-Python: >=3.0
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE.md
21
- Requires-Dist: mkdocs
22
- Requires-Dist: markdown
23
-
24
1
  # mkdocs-alias-plugin
25
2
 
26
- [![PyPI version](https://badge.fury.io/py/mkdocs-alias-plugin.svg)](https://pypi.org/project/mkdocs-alias-plugin/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![example workflow](https://github.com/eddyluten/mkdocs-alias-plugin/actions/workflows/pylint.yml/badge.svg) [![Downloads](https://pepy.tech/badge/mkdocs-alias-plugin)](https://pepy.tech/project/mkdocs-alias-plugin) ![](https://github.com/eddyluten/mkdocs-alias-plugin/workflows/mkdocs-alias-plugin%20Tests/badge.svg)
3
+ [![PyPI version](https://badge.fury.io/py/mkdocs-alias-plugin.svg)](https://pypi.org/project/mkdocs-alias-plugin/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Downloads](https://pepy.tech/badge/mkdocs-alias-plugin)](https://pepy.tech/project/mkdocs-alias-plugin) [![CI](https://github.com/eddyluten/mkdocs-alias-plugin/workflows/mkdocs-alias-plugin%20CI/badge.svg)](https://github.com/EddyLuten/mkdocs-alias-plugin/actions/workflows/ci.yml)
27
4
 
28
5
  The `mkdocs-alias-plugin` MkDocs plugin allows links to your pages using a custom alias such as `[[my-alias]]` or `[[my-alias|My Title]]`.
29
6
 
@@ -100,6 +77,8 @@ The song references [[wuthering-heights#references|Wuthering Heights]].
100
77
 
101
78
  As of version 0.8.0, you can enable the plugin option `use_anchor_titles` to replace anchor links with the text of the page heading that defined it. This behavior is opt-in to preserve backward compatibility.
102
79
 
80
+ As of version 0.9.0, you may also use `aliases` in addition to (or in place of) the `alias` key in the meta section of your pages. This is to provide some similarity to other Markdown based software that supports aliases, such as Obsidian.
81
+
103
82
  Please refer to the [MkDocs documentation](https://www.mkdocs.org/user-guide/writing-your-docs/#yaml-style-meta-data) for more information on how the meta-data block is used.
104
83
 
105
84
  ### Multiple Aliases
@@ -134,16 +113,23 @@ plugins:
134
113
  - alias:
135
114
  verbose: true
136
115
  use_anchor_titles: true
116
+ use_page_icon: true
137
117
  ```
138
118
 
139
119
  ### `verbose`
140
120
 
141
- You may use the optional `verbose` option to print more information about which aliases were used and defined during the build process. The default value is `false`.
121
+ You may use the optional `verbose` option to print more information about which aliases were used and defined during the build process. A tab-delimited file named `aliases.log` will also be defined at the project root, containing a list of every alias defined by the wiki.
122
+
123
+ The default value is `false` and should only be enabled when debugging issue with the plugin.
142
124
 
143
125
  ### `use_anchor_titles`
144
126
 
145
127
  Setting this flag to true causes the plugin to replace an alias containing an anchor (`[[my-page#sub-heading]]`) with the text of the header that defined it. You can still override the title of the link as usual.
146
128
 
129
+ ### `use_page_icons`
130
+
131
+ Setting this flag to true will include the [page's icon](https://squidfunk.github.io/mkdocs-material/reference/?h=page+icon#setting-the-page-icon) in the alias substitution if it's set for a given page.
132
+
147
133
  ## Troubleshooting
148
134
 
149
135
  ### The link text looks like a path or URL
@@ -168,6 +154,13 @@ Aliases *must* be unique. Ensure that you're not redefining the same alias for a
168
154
 
169
155
  ## Local Development
170
156
 
157
+ Upgrade pip and install the dependencies:
158
+
159
+ ```zsh
160
+ python -m pip install --upgrade pip
161
+ pip install mkdocs pytest pylint markdown setuptools
162
+ ```
163
+
171
164
  Installing a local copy of the plugin:
172
165
 
173
166
  ```zsh
@@ -188,16 +181,33 @@ pylint $(git ls-files '*.py') && pytest -vv
188
181
 
189
182
  ## Changelog
190
183
 
184
+ ## 0.9.0
185
+
186
+ 2025-02-21
187
+
188
+ **Features and Bug Fixes:**
189
+
190
+ - Added the ability to use alias style links to anchors withing the current page, e.g.: `[[#my-anchor]]`.
191
+ - Added support for page icons in link aliases, thank you @joapuiib for your [contribution](https://github.com/EddyLuten/mkdocs-alias-plugin/pull/15)!
192
+ - Added support for using the key `alias` and/or `aliases` for defining page aliases in meta sections.
193
+ - Changed verbose mode to now also generates a tab-delimited log file containing each alias in the wiki.
194
+
191
195
  ## 0.8.1
192
196
 
197
+ 2024-04-08
198
+
193
199
  **Bug Fix:** fixes a bug where annotations would break older versions of Python 3. Bug report: [#9](https://github.com/EddyLuten/mkdocs-alias-plugin/issues/9).
194
200
 
195
201
  ## 0.8.0
196
202
 
203
+ 2024-04-06
204
+
197
205
  This release adds functionality to replace the titles of aliases containing anchors with the text of the heading that defines them. Enable this feature by setting the plugin option `use_anchor_titles` to true. Feature request: [#8](https://github.com/EddyLuten/mkdocs-alias-plugin/issues/8).
198
206
 
199
207
  ### 0.7.1
200
208
 
209
+ 2024-04-07
210
+
201
211
  **Bug Fix:** fixes a bug where any alias with the word "text" would break the plugin due to faulty logic. Bug report: [#7](https://github.com/EddyLuten/mkdocs-alias-plugin/issues/7).
202
212
 
203
213
  ### 0.7.0
@@ -50,21 +50,24 @@ def find_anchor_by_id(anchors: list[MarkdownAnchor], anchor_id: str) -> Markdown
50
50
  return None
51
51
 
52
52
 
53
- def get_page_title(page_src: str, meta_data: dict):
53
+ def get_page_title(page_src: str, meta_data: dict, include_icon: bool = False):
54
54
  """Returns the title of the page. The title in the meta data section
55
55
  will take precedence over the H1 markdown title if both are provided."""
56
- return (
57
- meta_data['title']
58
- if 'title' in meta_data and isinstance(meta_data['title'], str)
59
- else get_markdown_title(page_src)
60
- )
56
+ if 'title' in meta_data and isinstance(meta_data['title'], str):
57
+ title = meta_data['title']
58
+ if include_icon and 'icon' in meta_data and isinstance(meta_data['icon'], str):
59
+ icon = ':' + meta_data['icon'].replace('/', '-') + ':'
60
+ title = f'{icon} {title}'
61
+ else:
62
+ title = get_markdown_title(page_src)
63
+ return title
61
64
 
62
65
 
63
- def get_alias_names(meta_data: dict):
66
+ def get_alias_names(meta_data: dict, meta_key: str = 'alias') -> list[str] | None:
64
67
  """Returns the list of configured alias names."""
65
- if len(meta_data) <= 0 or 'alias' not in meta_data:
68
+ if len(meta_data) <= 0 or meta_key not in meta_data:
66
69
  return None
67
- aliases = meta_data['alias']
70
+ aliases = meta_data[meta_key]
68
71
  if isinstance(aliases, list):
69
72
  # If the alias meta data is a list, ensure that they're strings
70
73
  return list(filter(lambda value: isinstance(value, str), aliases))
@@ -91,13 +94,27 @@ def replace_tag(
91
94
  if match.group(2) is not None:
92
95
  tag_bits = str(match.group(2)).split('#')
93
96
  alias = aliases.get(tag_bits[0])
97
+
98
+ # if the alias is not found, log a warning and return the input string
99
+ # unless the alias is an anchor tag, then try to find the anchor tag
100
+ # and replace it with the anchor's title
94
101
  if alias is None:
95
- log.warning(
96
- "Alias '%s' not found in '%s'",
97
- match.group(2),
98
- page_file.src_path
99
- )
100
- return match.group(0) # return the input string
102
+ if len(tag_bits) < 2:
103
+ log.warning(
104
+ "Alias '%s' not found in '%s'",
105
+ match.group(2),
106
+ page_file.src_path
107
+ )
108
+ return match.group(0) # return the input string
109
+ anchor = tag_bits[1]
110
+ matched = match.group(2)
111
+ # using the [[#anchor]] syntax to link within the current page:
112
+ if str(matched).startswith('#'):
113
+ anchors = get_markdown_toc(page_file.content_string)
114
+ anchor_tag = find_anchor_by_id(anchors, anchor)
115
+ if anchor_tag is not None:
116
+ log.info(f"treating {matched} like an anchor to {anchor_tag['name']}")
117
+ return f"[{anchor_tag['name']}](#{anchor})"
101
118
 
102
119
  text = None
103
120
  anchor = tag_bits[1] if len(tag_bits) > 1 else None
@@ -140,6 +157,7 @@ class AliasPlugin(BasePlugin):
140
157
  config_scheme = (
141
158
  ('verbose', config_options.Type(bool, default=False)),
142
159
  ('use_anchor_titles', config_options.Type(bool, default=False)),
160
+ ('use_page_icon', config_options.Type(bool, default=False)),
143
161
  )
144
162
  aliases = {}
145
163
  log = logging.getLogger(f'mkdocs.plugins.{__name__}')
@@ -158,7 +176,7 @@ class AliasPlugin(BasePlugin):
158
176
  self.log.info("Defined %s alias(es).", len(self.aliases))
159
177
  self.aliases.clear()
160
178
 
161
- def on_page_markdown(self, markdown: str, *, page: Page, **_):
179
+ def on_page_markdown(self, markdown: str, /, *, page: Page, **_):
162
180
  """Replaces any alias tags on the page with markdown links."""
163
181
  self.current_page = page
164
182
  return re.sub(
@@ -173,52 +191,68 @@ class AliasPlugin(BasePlugin):
173
191
  markdown
174
192
  )
175
193
 
176
- def on_files(self, files: Files, **_):
194
+ def on_files(self, files: Files, /, **_):
177
195
  """When MkDocs loads its files, extract aliases from any Markdown files
178
196
  that were found.
179
197
  """
180
198
  for file in filter(lambda f: f.is_documentation_page(), files):
181
199
  with open(file.abs_src_path, encoding='utf-8-sig', errors='strict') as handle:
182
- source, meta_data = meta.get_data(handle.read())
183
- alias_names = get_alias_names(meta_data)
184
- if alias_names is None or len(alias_names) < 1:
185
- continue
200
+ self.process_file(file, handle)
201
+ # write the aliases to the aliases log file if the verbose option is set
202
+ if self.config['verbose']:
203
+ with open('aliases.log', 'w', encoding='utf-8') as log_file:
204
+ log_file.write("alias\ttitle\turl\n")
205
+ for alias in self.aliases.values():
206
+ log_file.write(
207
+ f"{alias['alias']}\t{alias['text']}\t{alias['url']}\n"
208
+ )
186
209
 
187
- # If the use_anchor_titles config option is set, parse the markdown
188
- # and get the table of contents for the page
189
- anchors: list[MarkdownAnchor] = []
190
- if self.config['use_anchor_titles']:
191
- anchors = get_markdown_toc(source)
210
+ def process_file(self, file, handle):
211
+ """Extract aliases from the given file and add them to the aliases"""
212
+ source, meta_data = meta.get_data(handle.read())
213
+ for section in ['alias', 'aliases']:
214
+ alias_names = get_alias_names(meta_data, section)
215
+ if alias_names is None or len(alias_names) < 1:
216
+ continue
192
217
 
193
- if len(alias_names) > 1:
194
- self.log.info(
195
- '%s defines %d aliases:', file.url, len(alias_names)
196
- )
197
- for alias in alias_names:
198
- existing = self.aliases.get(alias)
199
- if existing is not None:
200
- self.log.warning(
201
- "%s: alias %s already defined in %s, skipping.",
202
- file.src_uri,
203
- alias,
204
- existing['url']
205
- )
206
- continue
207
-
208
- new_alias = {
209
- 'alias': alias,
210
- 'text': (
211
- meta_data['alias']['text']
212
- # if meta_data['alias'] is a dictionary and 'text' is a key
213
- if isinstance(meta_data['alias'], dict) and 'text' in meta_data['alias']
214
- else get_page_title(source, meta_data)
215
- ),
216
- 'url': file.src_uri,
217
- 'anchors': anchors,
218
- }
219
- self.log.info(
220
- "Alias %s to %s",
218
+ # If the use_anchor_titles config option is set, parse the markdown
219
+ # and get the table of contents for the page
220
+ anchors: list[MarkdownAnchor] = []
221
+ if self.config['use_anchor_titles']:
222
+ anchors = get_markdown_toc(source)
223
+
224
+ if len(alias_names) > 1:
225
+ self.log.info(
226
+ '%s defines %d aliases:', file.url, len(alias_names)
227
+ )
228
+ for alias in alias_names:
229
+ existing = self.aliases.get(alias)
230
+ if existing is not None:
231
+ self.log.warning(
232
+ "%s: alias %s already defined in %s, skipping.",
233
+ file.src_uri,
221
234
  alias,
222
- new_alias['url']
235
+ existing['url']
223
236
  )
224
- self.aliases[alias] = new_alias
237
+ continue
238
+
239
+ new_alias = {
240
+ 'alias': alias,
241
+ 'text': (
242
+ meta_data[section]['text']
243
+ # if meta_data['alias'] is a dictionary and 'text' is a key
244
+ if (
245
+ isinstance(meta_data[section], dict) and
246
+ 'text' in meta_data[section]
247
+ )
248
+ else get_page_title(source, meta_data, self.config['use_page_icon'])
249
+ ),
250
+ 'url': file.src_uri,
251
+ 'anchors': anchors,
252
+ }
253
+ self.log.info(
254
+ "Alias %s to %s",
255
+ alias,
256
+ new_alias['url']
257
+ )
258
+ self.aliases[alias] = new_alias
@@ -1,6 +1,40 @@
1
+ Metadata-Version: 2.2
2
+ Name: mkdocs-alias-plugin
3
+ Version: 0.8.2
4
+ Summary: An MkDocs plugin allowing links to your pages using a custom alias
5
+ Home-page: https://github.com/eddyluten/mkdocs-alias-plugin
6
+ Author: Eddy Luten
7
+ Author-email: eddyluten@gmail.com
8
+ License: MIT
9
+ Keywords: mkdocs python markdown alias link wiki
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Classifier: Topic :: Documentation
15
+ Classifier: Topic :: Text Processing
16
+ Classifier: Topic :: Text Processing :: Markup
17
+ Classifier: Topic :: Text Processing :: Markup :: Markdown
18
+ Requires-Python: >=3.0
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE.md
21
+ Requires-Dist: mkdocs
22
+ Requires-Dist: markdown
23
+ Dynamic: author
24
+ Dynamic: author-email
25
+ Dynamic: classifier
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: home-page
29
+ Dynamic: keywords
30
+ Dynamic: license
31
+ Dynamic: requires-dist
32
+ Dynamic: requires-python
33
+ Dynamic: summary
34
+
1
35
  # mkdocs-alias-plugin
2
36
 
3
- [![PyPI version](https://badge.fury.io/py/mkdocs-alias-plugin.svg)](https://pypi.org/project/mkdocs-alias-plugin/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![example workflow](https://github.com/eddyluten/mkdocs-alias-plugin/actions/workflows/pylint.yml/badge.svg) [![Downloads](https://pepy.tech/badge/mkdocs-alias-plugin)](https://pepy.tech/project/mkdocs-alias-plugin) ![](https://github.com/eddyluten/mkdocs-alias-plugin/workflows/mkdocs-alias-plugin%20Tests/badge.svg)
37
+ [![PyPI version](https://badge.fury.io/py/mkdocs-alias-plugin.svg)](https://pypi.org/project/mkdocs-alias-plugin/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Downloads](https://pepy.tech/badge/mkdocs-alias-plugin)](https://pepy.tech/project/mkdocs-alias-plugin) [![CI](https://github.com/eddyluten/mkdocs-alias-plugin/workflows/mkdocs-alias-plugin%20CI/badge.svg)](https://github.com/EddyLuten/mkdocs-alias-plugin/actions/workflows/ci.yml)
4
38
 
5
39
  The `mkdocs-alias-plugin` MkDocs plugin allows links to your pages using a custom alias such as `[[my-alias]]` or `[[my-alias|My Title]]`.
6
40
 
@@ -77,6 +111,8 @@ The song references [[wuthering-heights#references|Wuthering Heights]].
77
111
 
78
112
  As of version 0.8.0, you can enable the plugin option `use_anchor_titles` to replace anchor links with the text of the page heading that defined it. This behavior is opt-in to preserve backward compatibility.
79
113
 
114
+ As of version 0.9.0, you may also use `aliases` in addition to (or in place of) the `alias` key in the meta section of your pages. This is to provide some similarity to other Markdown based software that supports aliases, such as Obsidian.
115
+
80
116
  Please refer to the [MkDocs documentation](https://www.mkdocs.org/user-guide/writing-your-docs/#yaml-style-meta-data) for more information on how the meta-data block is used.
81
117
 
82
118
  ### Multiple Aliases
@@ -111,16 +147,23 @@ plugins:
111
147
  - alias:
112
148
  verbose: true
113
149
  use_anchor_titles: true
150
+ use_page_icon: true
114
151
  ```
115
152
 
116
153
  ### `verbose`
117
154
 
118
- You may use the optional `verbose` option to print more information about which aliases were used and defined during the build process. The default value is `false`.
155
+ You may use the optional `verbose` option to print more information about which aliases were used and defined during the build process. A tab-delimited file named `aliases.log` will also be defined at the project root, containing a list of every alias defined by the wiki.
156
+
157
+ The default value is `false` and should only be enabled when debugging issue with the plugin.
119
158
 
120
159
  ### `use_anchor_titles`
121
160
 
122
161
  Setting this flag to true causes the plugin to replace an alias containing an anchor (`[[my-page#sub-heading]]`) with the text of the header that defined it. You can still override the title of the link as usual.
123
162
 
163
+ ### `use_page_icons`
164
+
165
+ Setting this flag to true will include the [page's icon](https://squidfunk.github.io/mkdocs-material/reference/?h=page+icon#setting-the-page-icon) in the alias substitution if it's set for a given page.
166
+
124
167
  ## Troubleshooting
125
168
 
126
169
  ### The link text looks like a path or URL
@@ -145,6 +188,13 @@ Aliases *must* be unique. Ensure that you're not redefining the same alias for a
145
188
 
146
189
  ## Local Development
147
190
 
191
+ Upgrade pip and install the dependencies:
192
+
193
+ ```zsh
194
+ python -m pip install --upgrade pip
195
+ pip install mkdocs pytest pylint markdown setuptools
196
+ ```
197
+
148
198
  Installing a local copy of the plugin:
149
199
 
150
200
  ```zsh
@@ -165,16 +215,33 @@ pylint $(git ls-files '*.py') && pytest -vv
165
215
 
166
216
  ## Changelog
167
217
 
218
+ ## 0.9.0
219
+
220
+ 2025-02-21
221
+
222
+ **Features and Bug Fixes:**
223
+
224
+ - Added the ability to use alias style links to anchors withing the current page, e.g.: `[[#my-anchor]]`.
225
+ - Added support for page icons in link aliases, thank you @joapuiib for your [contribution](https://github.com/EddyLuten/mkdocs-alias-plugin/pull/15)!
226
+ - Added support for using the key `alias` and/or `aliases` for defining page aliases in meta sections.
227
+ - Changed verbose mode to now also generates a tab-delimited log file containing each alias in the wiki.
228
+
168
229
  ## 0.8.1
169
230
 
231
+ 2024-04-08
232
+
170
233
  **Bug Fix:** fixes a bug where annotations would break older versions of Python 3. Bug report: [#9](https://github.com/EddyLuten/mkdocs-alias-plugin/issues/9).
171
234
 
172
235
  ## 0.8.0
173
236
 
237
+ 2024-04-06
238
+
174
239
  This release adds functionality to replace the titles of aliases containing anchors with the text of the heading that defines them. Enable this feature by setting the plugin option `use_anchor_titles` to true. Feature request: [#8](https://github.com/EddyLuten/mkdocs-alias-plugin/issues/8).
175
240
 
176
241
  ### 0.7.1
177
242
 
243
+ 2024-04-07
244
+
178
245
  **Bug Fix:** fixes a bug where any alias with the word "text" would break the plugin due to faulty logic. Bug report: [#7](https://github.com/EddyLuten/mkdocs-alias-plugin/issues/7).
179
246
 
180
247
  ### 0.7.0
@@ -7,7 +7,7 @@ long_description = (this_directory / 'README.md').read_text()
7
7
 
8
8
  setup(
9
9
  name='mkdocs-alias-plugin',
10
- version='0.8.1',
10
+ version='0.8.2',
11
11
  description=
12
12
  'An MkDocs plugin allowing links to your pages using a custom alias',
13
13
  long_description=long_description,