This issue is a result of a Codex global code scan of deepmodeling/deepmodeling_sphinx at commit 156679f.
Problem
insert_sidebar() injects the fully rendered banner immediately before </head>, but banner.html contains visible body markup such as <div class="container-fluid header-holder ..."> and the mobile menu. This produces invalid HTML where body content is placed inside the document head.
Code references:
|
begin_body = content.lower().find("</head>") |
|
banner = render_banner(current_site=app.config.deepmodeling_current_site) |
|
if begin_body != -1: |
|
content = ( |
|
content[:begin_body] |
|
+ comment_begin |
|
+ banner |
|
+ comment_end |
|
+ content[begin_body:] |
|
<link rel="preconnect" href="https://unpkg.com/" /> |
|
<link |
|
rel="icon" |
|
href="https://unpkg.com/@njzjz/icons@0.0.5/logos/deepmodeling.svg" |
|
type="image/png" |
|
/> |
|
<div class="container-fluid header-holder tutorials-header" id="header-holder"> |
|
<div class="container"> |
|
<div class="header-container"> |
|
<a |
|
class="header-logo" |
|
href="https://deepmodeling.com" |
|
aria-label="deepmodeling" |
|
></a> |
|
|
|
<div class="main-menu"> |
|
<ul> |
|
{% for item in items %} |
|
<li class="{{ item.class }}"> |
|
{% if item.subitem %} |
|
<div |
|
id="resourcesDropdownButton" |
|
data-toggle="resources-dropdown" |
|
class="resources-dropdown" |
|
> |
|
<a |
|
href="{{ item.url }}" |
|
class="resource-option with-down-orange-arrow" |
|
> |
|
{{ item.title }} |
|
</a> |
|
<div class="resources-dropdown-menu"> |
|
{% for subitem in item.subitem %} |
|
<a |
|
class="doc-dropdown-option nav-dropdown-item" |
|
href="{{ subitem.url }}" |
|
> |
|
<span class="dropdown-title">{{ subitem.title }}</span> |
|
<p></p> |
|
</a> |
|
{% endfor %} |
|
</div> |
|
</div> |
|
{% else %} |
|
<a href="{{ item.url }}">{{ item.title }}</a> |
|
{% endif %} |
|
</li> |
|
{% endfor %} |
|
</ul> |
|
</div> |
|
|
|
<a |
|
class="main-menu-open-button" |
|
href="#" |
|
data-behavior="open-mobile-menu" |
|
></a> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="mobile-main-menu"> |
|
<div class="container-fluid"> |
|
<div class="container"> |
|
<div class="mobile-main-menu-header-container"> |
|
<a |
|
class="header-logo" |
|
href="https://deepmodeling.com" |
|
aria-label="deepmodeling" |
|
></a> |
|
<a |
|
class="main-menu-close-button" |
|
href="#" |
|
data-behavior="close-mobile-menu" |
|
></a> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="mobile-main-menu-links-container"> |
|
<div class="main-menu"> |
|
<ul> |
|
{% for item in items %} |
|
<li> |
|
<a href="{{ item.url }}">{{ item.title }}</a> |
|
</li> |
|
{% endfor %} |
|
</ul> |
|
</div> |
|
</div> |
|
</div> |
Impact
Browsers may recover by implicitly closing <head>, but the output is invalid and can interact poorly with themes, crawlers, validators, and scripts that assume a normal head/body structure. In a minimal Sphinx HTML build, the generated page contains the banner <div> before </head><body>.
Suggested fix
Split head-only tags from visible banner markup, or inject the visible banner immediately after the opening <body> tag while keeping preconnect/favicon tags in <head>. While touching the head tags, the SVG favicon should also use type="image/svg+xml" instead of type="image/png".
This issue is a result of a Codex global code scan of deepmodeling/deepmodeling_sphinx at commit 156679f.
Problem
insert_sidebar()injects the fully rendered banner immediately before</head>, butbanner.htmlcontains visible body markup such as<div class="container-fluid header-holder ...">and the mobile menu. This produces invalid HTML where body content is placed inside the document head.Code references:
deepmodeling_sphinx/deepmodeling_sphinx/inject.py
Lines 68 to 76 in 156679f
deepmodeling_sphinx/deepmodeling_sphinx/banner.html
Lines 1 to 6 in 156679f
deepmodeling_sphinx/deepmodeling_sphinx/banner.html
Lines 11 to 94 in 156679f
Impact
Browsers may recover by implicitly closing
<head>, but the output is invalid and can interact poorly with themes, crawlers, validators, and scripts that assume a normal head/body structure. In a minimal Sphinx HTML build, the generated page contains the banner<div>before</head><body>.Suggested fix
Split head-only tags from visible banner markup, or inject the visible banner immediately after the opening
<body>tag while keeping preconnect/favicon tags in<head>. While touching the head tags, the SVG favicon should also usetype="image/svg+xml"instead oftype="image/png".