diff --git a/docs/source/conf.py b/docs/source/conf.py index 2367474..1755e7c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -17,6 +17,8 @@ os.system("git clone --depth 1 https://github.com/Freenove/Freenove_ESP32_WROVER project = "fnk0060-docs" # +from docutils import nodes + copyright = '2016-2025, Freenove' author = 'Freenove' release = 'v1.0.0' @@ -134,9 +136,27 @@ intersphinx_mapping = { } intersphinx_disabled_reftypes = ["*"] +def combined_class_role(name, rawtext, text, lineno, inliner, options={}, content=[]): + try: + # + class_names, content_text = text.split(':', 1) + # remove extra spaces and create a list of class + classes = class_names.strip().split() + + # create a span node with these class + node = nodes.inline(text=content_text.strip(), classes=classes) + + return [node], [] + except ValueError: + # error handle + msg = inliner.reporter.error( + 'The "combo" role requires a "class_names:text" format.', + line=lineno) + prb = inliner.problematic(rawtext, rawtext, msg) + return [prb], [msg] def setup(app): - pass + app.add_role("combo", combined_class_role) # app.add_css_file("") # app.add_css_file('https://cdn.jsdelivr.net/gh/Freenove/freenove-docs/docs/source/_static/css/custom.css')