@@ -84,9 +84,7 @@ def handleMatch(self, m, data) -> Union[Element, EvalIDType]: # type: ignore[ov
84
84
85
85
return self .makeTag (identifier , text ), m .start (0 ), end
86
86
87
- def evalId (
88
- self , data : str , index : int , text : str
89
- ) -> EvalIDType : # noqa: N802 (parent's casing)
87
+ def evalId (self , data : str , index : int , text : str ) -> EvalIDType : # noqa: N802 (parent's casing)
90
88
"""Evaluate the id portion of `[ref][id]`.
91
89
92
90
If `[ref][]` use `[ref]`.
@@ -157,9 +155,7 @@ def relative_url(url_a: str, url_b: str) -> str:
157
155
return f"{ relative } #{ anchor } "
158
156
159
157
160
- def fix_ref (
161
- url_mapper : Callable [[str ], str ], unmapped : List [str ]
162
- ) -> Callable : # noqa: WPS212,WPS231
158
+ def fix_ref (url_mapper : Callable [[str ], str ], unmapped : List [str ]) -> Callable : # noqa: WPS212,WPS231
163
159
"""Return a `repl` function for [`re.sub`](https://docs.python.org/3/library/re.html#re.sub).
164
160
165
161
In our context, we match Markdown references and replace them with HTML links.
@@ -225,9 +221,7 @@ def fix_refs(html: str, url_mapper: Callable[[str], str]) -> Tuple[str, List[str
225
221
class AutorefsExtension (Extension ):
226
222
"""Extension that inserts auto-references in Markdown."""
227
223
228
- def extendMarkdown (
229
- self , md : Markdown
230
- ) -> None : # noqa: N802 (casing: parent method's name)
224
+ def extendMarkdown (self , md : Markdown ) -> None : # noqa: N802 (casing: parent method's name)
231
225
"""Register the extension.
232
226
233
227
Add an instance of our [`AutoRefInlineProcessor`][mkdocs_autorefs.references.AutoRefInlineProcessor] to the Markdown parser.
@@ -268,9 +262,7 @@ def __init__(self) -> None:
268
262
super ().__init__ ()
269
263
self ._url_map : Dict [str , str ] = {}
270
264
self ._abs_url_map : Dict [str , str ] = {}
271
- self .get_fallback_anchor : Optional [
272
- Callable [[str ], Optional [str ]]
273
- ] = None # noqa: WPS234
265
+ self .get_fallback_anchor : Optional [Callable [[str ], Optional [str ]]] = None # noqa: WPS234
274
266
self ._priority_patterns = None
275
267
276
268
@property
@@ -355,9 +347,7 @@ def get_item_url( # noqa: WPS234
355
347
"""
356
348
return self ._get_item_url (identifier , fallback )
357
349
358
- def on_config (
359
- self , config : Config , ** kwargs
360
- ) -> Config : # noqa: W0613,R0201 (unused arguments, cannot be static)
350
+ def on_config (self , config : Config , ** kwargs ) -> Config : # noqa: W0613,R0201 (unused arguments, cannot be static)
361
351
"""Instantiate our Markdown extension.
362
352
363
353
Hook for the [`on_config` event](https://www.mkdocs.org/user-guide/plugins/#on_config).
@@ -375,9 +365,7 @@ def on_config(
375
365
config ["markdown_extensions" ].append (AutorefsExtension ())
376
366
return config
377
367
378
- def on_page_markdown (
379
- self , markdown : str , page : Page , ** kwargs
380
- ) -> str : # noqa: W0613 (unused arguments)
368
+ def on_page_markdown (self , markdown : str , page : Page , ** kwargs ) -> str : # noqa: W0613 (unused arguments)
381
369
"""Remember which page is the current one.
382
370
383
371
Arguments:
@@ -391,9 +379,7 @@ def on_page_markdown(
391
379
self .current_page = page .url # noqa: WPS601
392
380
return markdown
393
381
394
- def on_page_content (
395
- self , html : str , page : Page , ** kwargs
396
- ) -> str : # noqa: W0613 (unused arguments)
382
+ def on_page_content (self , html : str , page : Page , ** kwargs ) -> str : # noqa: W0613 (unused arguments)
397
383
"""Map anchors to URLs.
398
384
399
385
Hook for the [`on_page_content` event](https://www.mkdocs.org/user-guide/plugins/#on_page_content).
@@ -431,9 +417,7 @@ def map_urls(self, page: Page, anchor: AnchorLink) -> None:
431
417
for child in anchor .children :
432
418
self .map_urls (page , child )
433
419
434
- def on_post_page (
435
- self , output : str , page : Page , ** kwargs
436
- ) -> str : # noqa: W0613 (unused arguments)
420
+ def on_post_page (self , output : str , page : Page , ** kwargs ) -> str : # noqa: W0613 (unused arguments)
437
421
"""Fix cross-references.
438
422
439
423
Hook for the [`on_post_page` event](https://www.mkdocs.org/user-guide/plugins/#on_post_page).
0 commit comments