Fix finding-detail badge regex broken by the toc extension

badge_findings_table matched literal <h4> with no attributes; once
the toc extension started stamping id="..." on every heading (needed
for the sidebar nav), the h4 severity badges silently stopped
rendering. Match <h4[^>]*> instead.
This commit is contained in:
2026-08-21 17:02:29 -04:00
parent 9ff0389640
commit 8f57ea650c
+2 -2
View File
@@ -347,14 +347,14 @@ def badge_findings_table(html_text):
cell_html,
)
cell_html = re.sub(
rf"(<h4>)\[{severity}\]",
rf"(<h4[^>]*>)\[{severity}\]",
rf'\1<span class="badge {css_class}">{severity}</span> ',
cell_html,
)
return cell_html
html_text = re.sub(r"<td>\w+</td>", replace_cell, html_text)
html_text = re.sub(r"<h4>\[\w+\][^<]*", replace_cell, html_text)
html_text = re.sub(r"<h4[^>]*>\[\w+\][^<]*", replace_cell, html_text)
return html_text