@@ -150,6 +150,35 @@ def reformat_signature(match):
150150 return signature_pattern .sub (reformat_signature , html_content )
151151
152152
153+ def strip_directives_from_html (html_content ):
154+ """
155+ Remove Great Docs @directive: lines from rendered HTML.
156+
157+ Directives like @family:, @order:, @seealso:, and @nodoc: are used for
158+ organizing documentation but should not appear in the final rendered output.
159+ This function removes them as a safety net after quartodoc rendering.
160+ """
161+ # Pattern matches directive lines that may appear in HTML
162+ # They could be plain text, inside <p> tags, or other HTML elements
163+ # Match: optional whitespace, @directive:, value, end of line
164+ directive_pattern = re .compile (
165+ r"^\s*@(?:family|order|seealso|nodoc):\s*.*$\n?" ,
166+ re .MULTILINE | re .IGNORECASE ,
167+ )
168+
169+ # Also match directives that got wrapped in <p> tags
170+ # e.g., <p>@family: Something</p>
171+ p_directive_pattern = re .compile (
172+ r"<p>\s*@(?:family|order|seealso|nodoc):\s*[^<]*</p>\s*\n?" ,
173+ re .IGNORECASE ,
174+ )
175+
176+ cleaned = directive_pattern .sub ("" , html_content )
177+ cleaned = p_directive_pattern .sub ("" , cleaned )
178+
179+ return cleaned
180+
181+
153182# Process all HTML files in the `_site/reference/` directory (except `index.html`)
154183# and apply the specified transformations
155184html_files = [f for f in glob .glob ("_site/reference/*.html" ) if not f .endswith ("index.html" )]
@@ -165,6 +194,9 @@ def reformat_signature(match):
165194 with open (html_file , "r" ) as file :
166195 content = file .read ()
167196
197+ # Strip @directive: lines from rendered HTML (safety net for docstring directives)
198+ content = strip_directives_from_html (content )
199+
168200 # Format signatures with multiple arguments onto separate lines
169201 content = format_signature_multiline (content )
170202
0 commit comments