Skip to content

mkdocs_nype.plugins.custom_auto_links.plugin

Synopsis

MkDocs plugin made to handle custom links in Markdown and render them.

This is made as a plugin instead of a Markdown Extension, because we need to access page.meta.tags from MkDocs. We could pass the page.meta object via mdx_configs to a Markdown Extension, however this would add complexity.

Currently the fal:// protocol is supported which points to https://fioriappslibrary.hana.ondemand.com

MIT License 2024 Kamil Krzyśków (HRY) for Nype (npe.cm)

PLUGIN_NAME

PLUGIN_NAME: str = 'custom_auto_links'

Name of this plugin. Used in logging.

LOG

LOG: PrefixedLogger = PrefixedLogger(PLUGIN_NAME, getLogger(f'mkdocs.plugins.{PLUGIN_NAME}'))

Logger instance for this plugin.

FAL_RELEASE_MAPPING

FAL_RELEASE_MAPPING = {'1709': 'S9OP', '1709_FPS01': 'S10OP', '1709_FPS02': 'S11OP', '1809': 'S12OP', '1809_FPS01': 'S13OP', '1809_FPS02': 'S14OP', '1909': 'S15OP', '1909_FPS01': 'S16OP', '1909_FPS02': 'S17OP', '2020': 'S18OP', '2020_FPS01': 'S19OP', '2020_FPS02': 'S20OP', '2021': 'S21OP', '2021_FPS01': 'S22OP', '2021_FPS02': 'S23OP', '2022': 'S24OP', '2022_FPS01': 'S25OP', '2022_FPS02': 'S26OP', '2023': 'S27OP', '2023_FPS01': 'S28OP', '2023_FPS02': 'S29OP'}

Short release_id to actual URL release_id

CustomAutoLinksPlugin

CustomAutoLinksPlugin()

Bases: BasePlugin[CustomAutoLinksConfig]

pattern

pattern = compile(pattern='(?P<prefix>\\s|\\]\\(|")(?P<proto>fal)://(?P<mode>\\w!)?(?P<url>.*?)(?=\\s|\\)|")', flags=IGNORECASE | MULTILINE)

fal_releases

fal_releases = {}

on_config

on_config(config: MkDocsConfig) -> MkDocsConfig | None

on_page_markdown

on_page_markdown(markdown: str, /, *, page: Page, config: MkDocsConfig, files: Files) -> str | None

_process_fal

_process_fal(match: Match, page: Page) -> etree.Element