From 8dead24a3c4b5731468b93cd805c6e0faba51722 Mon Sep 17 00:00:00 2001
From: Timo Koch <timokoch@math.uio.no>
Date: Thu, 23 Mar 2023 18:40:58 +0100
Subject: [PATCH] [doxygen] Add filter for lines that should only be displayed
 in Doxygen

---
 doc/doxygen/markdown-filter.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/doxygen/markdown-filter.py b/doc/doxygen/markdown-filter.py
index 803d5a0b6d..3173793f82 100644
--- a/doc/doxygen/markdown-filter.py
+++ b/doc/doxygen/markdown-filter.py
@@ -34,6 +34,12 @@ def _is_main_readme_file(path) -> bool:
     return path == MAIN_README
 
 
+def _enable_doxygen_only_content(line: str) -> str:
+    if line.startswith("<!--DOXYGEN_ONLY "):
+        return line.replace("<!--DOXYGEN_ONLY ", "").replace("-->", "")
+    return line
+
+
 assert len(sys.argv[1]) > 1
 filePath = abspath(sys.argv[1])
 
@@ -49,7 +55,7 @@ if _is_main_readme_file(filePath):
 # correctly (may be fixed in the most recent Doxygen version)
 result_lines = []
 for line in result.split("\n"):
-    result_lines.append(_add_header_label(line))
+    result_lines.append(_enable_doxygen_only_content(_add_header_label(line)))
 
 # Print the final result for Doxygen to pick it up
 print("\n".join(result_lines))
-- 
GitLab