diff --git a/docs/conf.py b/docs/conf.py index 0be3a06..b6f96de 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -45,3 +45,23 @@ html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] html_logo = './motis-logo.svg' +html_theme_options = { + 'style_external_links': True, +} + +from pathlib import Path +from docutils import nodes +from breathe.renderer.sphinxrenderer import SphinxRenderer + +URL_TEMPLATE = "https://github.com/motis-project/utl/blob/master/{file_path}#L{line}" +REPO_ROOT_DIR = Path(__file__).parent.parent + +def create_doxygen_target(self, node): + loc = node.location + file_path = loc.file[len(str(REPO_ROOT_DIR))+1:] + url = URL_TEMPLATE.format(file_path=file_path, line=loc.line) + title = f"{file_path} on line {loc.line}" + return [nodes.reference("", "", refuri=url, reftitle=title)] + +# Monkey patching this method: +SphinxRenderer.create_doxygen_target = create_doxygen_target diff --git a/docs/index.md b/docs/index.md index 79457d2..6d5885b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -46,15 +46,23 @@ utl::info("MyCtx", "Message").attrs({{"key1", "value1"}, {"key2", "value2"}}); ### API details :::{doxygenstruct} utl::log +:no-link: +:members: ::: :::{doxygenstruct} utl::debug +:no-link: +:members: ::: :::{doxygenstruct} utl::info +:no-link: +:members: ::: :::{doxygenstruct} utl::error +:no-link: +:members: ::: :::{note} diff --git a/include/utl/logging.h b/include/utl/logging.h index 214edeb..165a3d8 100644 --- a/include/utl/logging.h +++ b/include/utl/logging.h @@ -78,6 +78,7 @@ struct log { } } + /// Add key-values metadata void attrs( std::initializer_list >&& attrs) {