Skip to content

Commit 2ae5270

Browse files
GeneAIGeneAI
authored andcommitted
fix: Convert MkDocs relative asset paths to absolute for CSS loading
- Add scripts/fix_mkdocs_paths.py to convert relative paths to absolute - Run script on all 206 HTML files in framework-docs - Paths like '../../assets/' now become '/framework-docs/assets/' - This fixes CSS loading regardless of trailing slash in URL
1 parent 4e9157c commit 2ae5270

File tree

207 files changed

+1525
-1443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+1525
-1443
lines changed

scripts/fix_mkdocs_paths.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Fix MkDocs relative asset paths to absolute paths.
4+
5+
MkDocs generates relative paths like "../../assets/" which only work correctly
6+
when URLs have trailing slashes. This script converts them to absolute paths
7+
that work regardless of trailing slashes.
8+
"""
9+
10+
import re
11+
from pathlib import Path
12+
13+
14+
def fix_html_file(file_path: Path, base_path: str = "/framework-docs") -> int:
15+
"""
16+
Fix relative asset paths in an HTML file to absolute paths.
17+
18+
Args:
19+
file_path: Path to the HTML file
20+
base_path: Base path for absolute URLs (e.g., "/framework-docs")
21+
22+
Returns:
23+
Number of replacements made
24+
"""
25+
content = file_path.read_text(encoding="utf-8")
26+
original = content
27+
28+
# Patterns to fix:
29+
# href="../../assets/" -> href="/framework-docs/assets/"
30+
# src="../../assets/" -> src="/framework-docs/assets/"
31+
# href="../assets/" -> href="/framework-docs/assets/"
32+
# etc.
33+
34+
# Replace relative paths to assets
35+
patterns = [
36+
# Multiple levels up to assets
37+
(r'(href|src)="(\.\./)+assets/', rf'\1="{base_path}/assets/'),
38+
# Relative stylesheets paths
39+
(r'(href)="(\.\./)+stylesheets/', rf'\1="{base_path}/stylesheets/'),
40+
# Relative javascripts paths
41+
(r'(src)="(\.\./)+javascripts/', rf'\1="{base_path}/javascripts/'),
42+
# Relative search paths
43+
(r'(src)="(\.\./)+search/', rf'\1="{base_path}/search/'),
44+
# css file references
45+
(r'href="(\.\./)+([^"]+\.css)"', rf'href="{base_path}/\2"'),
46+
# js file references
47+
(r'src="(\.\./)+([^"]+\.js)"', rf'src="{base_path}/\2"'),
48+
]
49+
50+
for pattern, replacement in patterns:
51+
content = re.sub(pattern, replacement, content)
52+
53+
if content != original:
54+
file_path.write_text(content, encoding="utf-8")
55+
return 1
56+
return 0
57+
58+
59+
def main():
60+
"""Process all HTML files in the website/public/framework-docs directory."""
61+
docs_dir = Path(__file__).parent.parent / "website" / "public" / "framework-docs"
62+
63+
if not docs_dir.exists():
64+
print(f"Error: Directory not found: {docs_dir}")
65+
return 1
66+
67+
html_files = list(docs_dir.rglob("*.html"))
68+
print(f"Found {len(html_files)} HTML files")
69+
70+
fixed_count = 0
71+
for html_file in html_files:
72+
count = fix_html_file(html_file)
73+
if count:
74+
fixed_count += 1
75+
print(f" Fixed: {html_file.relative_to(docs_dir)}")
76+
77+
print(f"\nFixed {fixed_count} files")
78+
return 0
79+
80+
81+
if __name__ == "__main__":
82+
exit(main())

website/public/framework-docs/FOREWORD_BY_CLAUDE/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222

23-
<link rel="icon" href="../assets/images/empathy-brain-logo.png">
23+
<link rel="icon" href="/framework-docs/assets/images/empathy-brain-logo.png">
2424
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.0">
2525

2626

@@ -29,10 +29,10 @@
2929

3030

3131

32-
<link rel="stylesheet" href="../assets/stylesheets/main.618322db.min.css">
32+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/main.618322db.min.css">
3333

3434

35-
<link rel="stylesheet" href="../assets/stylesheets/palette.ab4e12ef.min.css">
35+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/palette.ab4e12ef.min.css">
3636

3737

3838

@@ -51,7 +51,7 @@
5151

5252

5353

54-
<link rel="stylesheet" href="../assets/_mkdocstrings.css">
54+
<link rel="stylesheet" href="/framework-docs/assets/_mkdocstrings.css">
5555

5656
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
5757

@@ -97,7 +97,7 @@
9797
<nav class="md-header__inner md-grid" aria-label="Header">
9898
<a href=".." title="Empathy Framework" class="md-header__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
9999

100-
<img src="../assets/images/empathy-brain-logo.png" alt="logo">
100+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
101101

102102
</a>
103103
<label class="md-header__button md-icon" for="__drawer">
@@ -383,7 +383,7 @@
383383
<label class="md-nav__title" for="__drawer">
384384
<a href=".." title="Empathy Framework" class="md-nav__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
385385

386-
<img src="../assets/images/empathy-brain-logo.png" alt="logo">
386+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
387387

388388
</a>
389389
Empathy Framework
@@ -3300,7 +3300,7 @@ <h2 id="to-the-reader">To the Reader<a class="headerlink" href="#to-the-reader"
33003300
<script id="__config" type="application/json">{"annotate": null, "base": "..", "features": ["navigation.instant", "navigation.tracking", "navigation.tabs", "navigation.sections", "navigation.expand", "navigation.top", "search.suggest", "search.highlight", "content.code.copy"], "search": "../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
33013301

33023302

3303-
<script src="../assets/javascripts/bundle.e71a0d61.min.js"></script>
3303+
<script src="/framework-docs/assets/javascripts/bundle.e71a0d61.min.js"></script>
33043304

33053305

33063306
</body>

website/public/framework-docs/about-the-author/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222

23-
<link rel="icon" href="../assets/images/empathy-brain-logo.png">
23+
<link rel="icon" href="/framework-docs/assets/images/empathy-brain-logo.png">
2424
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.0">
2525

2626

@@ -29,10 +29,10 @@
2929

3030

3131

32-
<link rel="stylesheet" href="../assets/stylesheets/main.618322db.min.css">
32+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/main.618322db.min.css">
3333

3434

35-
<link rel="stylesheet" href="../assets/stylesheets/palette.ab4e12ef.min.css">
35+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/palette.ab4e12ef.min.css">
3636

3737

3838

@@ -51,7 +51,7 @@
5151

5252

5353

54-
<link rel="stylesheet" href="../assets/_mkdocstrings.css">
54+
<link rel="stylesheet" href="/framework-docs/assets/_mkdocstrings.css">
5555

5656
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
5757

@@ -97,7 +97,7 @@
9797
<nav class="md-header__inner md-grid" aria-label="Header">
9898
<a href=".." title="Empathy Framework" class="md-header__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
9999

100-
<img src="../assets/images/empathy-brain-logo.png" alt="logo">
100+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
101101

102102
</a>
103103
<label class="md-header__button md-icon" for="__drawer">
@@ -383,7 +383,7 @@
383383
<label class="md-nav__title" for="__drawer">
384384
<a href=".." title="Empathy Framework" class="md-nav__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
385385

386-
<img src="../assets/images/empathy-brain-logo.png" alt="logo">
386+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
387387

388388
</a>
389389
Empathy Framework
@@ -3262,7 +3262,7 @@ <h2 id="connect">Connect<a class="headerlink" href="#connect" title="Permanent l
32623262
<script id="__config" type="application/json">{"annotate": null, "base": "..", "features": ["navigation.instant", "navigation.tracking", "navigation.tabs", "navigation.sections", "navigation.expand", "navigation.top", "search.suggest", "search.highlight", "content.code.copy"], "search": "../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
32633263

32643264

3265-
<script src="../assets/javascripts/bundle.e71a0d61.min.js"></script>
3265+
<script src="/framework-docs/assets/javascripts/bundle.e71a0d61.min.js"></script>
32663266

32673267

32683268
</body>

website/public/framework-docs/api-reference/ai-wizards/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222

23-
<link rel="icon" href="../../assets/images/empathy-brain-logo.png">
23+
<link rel="icon" href="/framework-docs/assets/images/empathy-brain-logo.png">
2424
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.0">
2525

2626

@@ -29,10 +29,10 @@
2929

3030

3131

32-
<link rel="stylesheet" href="../../assets/stylesheets/main.618322db.min.css">
32+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/main.618322db.min.css">
3333

3434

35-
<link rel="stylesheet" href="../../assets/stylesheets/palette.ab4e12ef.min.css">
35+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/palette.ab4e12ef.min.css">
3636

3737

3838

@@ -51,7 +51,7 @@
5151

5252

5353

54-
<link rel="stylesheet" href="../../assets/_mkdocstrings.css">
54+
<link rel="stylesheet" href="/framework-docs/assets/_mkdocstrings.css">
5555

5656
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
5757

@@ -97,7 +97,7 @@
9797
<nav class="md-header__inner md-grid" aria-label="Header">
9898
<a href="../.." title="Empathy Framework" class="md-header__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
9999

100-
<img src="../../assets/images/empathy-brain-logo.png" alt="logo">
100+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
101101

102102
</a>
103103
<label class="md-header__button md-icon" for="__drawer">
@@ -383,7 +383,7 @@
383383
<label class="md-nav__title" for="__drawer">
384384
<a href="../.." title="Empathy Framework" class="md-nav__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
385385

386-
<img src="../../assets/images/empathy-brain-logo.png" alt="logo">
386+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
387387

388388
</a>
389389
Empathy Framework
@@ -4374,7 +4374,7 @@ <h2 id="see-also">See Also<a class="headerlink" href="#see-also" title="Permanen
43744374
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["navigation.instant", "navigation.tracking", "navigation.tabs", "navigation.sections", "navigation.expand", "navigation.top", "search.suggest", "search.highlight", "content.code.copy"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
43754375

43764376

4377-
<script src="../../assets/javascripts/bundle.e71a0d61.min.js"></script>
4377+
<script src="/framework-docs/assets/javascripts/bundle.e71a0d61.min.js"></script>
43784378

43794379

43804380
</body>

website/public/framework-docs/api-reference/config/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222

23-
<link rel="icon" href="../../assets/images/empathy-brain-logo.png">
23+
<link rel="icon" href="/framework-docs/assets/images/empathy-brain-logo.png">
2424
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.0">
2525

2626

@@ -29,10 +29,10 @@
2929

3030

3131

32-
<link rel="stylesheet" href="../../assets/stylesheets/main.618322db.min.css">
32+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/main.618322db.min.css">
3333

3434

35-
<link rel="stylesheet" href="../../assets/stylesheets/palette.ab4e12ef.min.css">
35+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/palette.ab4e12ef.min.css">
3636

3737

3838

@@ -51,7 +51,7 @@
5151

5252

5353

54-
<link rel="stylesheet" href="../../assets/_mkdocstrings.css">
54+
<link rel="stylesheet" href="/framework-docs/assets/_mkdocstrings.css">
5555

5656
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
5757

@@ -97,7 +97,7 @@
9797
<nav class="md-header__inner md-grid" aria-label="Header">
9898
<a href="../.." title="Empathy Framework" class="md-header__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
9999

100-
<img src="../../assets/images/empathy-brain-logo.png" alt="logo">
100+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
101101

102102
</a>
103103
<label class="md-header__button md-icon" for="__drawer">
@@ -383,7 +383,7 @@
383383
<label class="md-nav__title" for="__drawer">
384384
<a href="../.." title="Empathy Framework" class="md-nav__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
385385

386-
<img src="../../assets/images/empathy-brain-logo.png" alt="logo">
386+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
387387

388388
</a>
389389
Empathy Framework
@@ -4893,7 +4893,7 @@ <h2 id="see-also">See Also<a class="headerlink" href="#see-also" title="Permanen
48934893
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["navigation.instant", "navigation.tracking", "navigation.tabs", "navigation.sections", "navigation.expand", "navigation.top", "search.suggest", "search.highlight", "content.code.copy"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
48944894

48954895

4896-
<script src="../../assets/javascripts/bundle.e71a0d61.min.js"></script>
4896+
<script src="/framework-docs/assets/javascripts/bundle.e71a0d61.min.js"></script>
48974897

48984898

48994899
</body>

website/public/framework-docs/api-reference/core/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222

23-
<link rel="icon" href="../../assets/images/empathy-brain-logo.png">
23+
<link rel="icon" href="/framework-docs/assets/images/empathy-brain-logo.png">
2424
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.7.0">
2525

2626

@@ -29,10 +29,10 @@
2929

3030

3131

32-
<link rel="stylesheet" href="../../assets/stylesheets/main.618322db.min.css">
32+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/main.618322db.min.css">
3333

3434

35-
<link rel="stylesheet" href="../../assets/stylesheets/palette.ab4e12ef.min.css">
35+
<link rel="stylesheet" href="/framework-docs/assets/stylesheets/palette.ab4e12ef.min.css">
3636

3737

3838

@@ -51,7 +51,7 @@
5151

5252

5353

54-
<link rel="stylesheet" href="../../assets/_mkdocstrings.css">
54+
<link rel="stylesheet" href="/framework-docs/assets/_mkdocstrings.css">
5555

5656
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
5757

@@ -97,7 +97,7 @@
9797
<nav class="md-header__inner md-grid" aria-label="Header">
9898
<a href="../.." title="Empathy Framework" class="md-header__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
9999

100-
<img src="../../assets/images/empathy-brain-logo.png" alt="logo">
100+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
101101

102102
</a>
103103
<label class="md-header__button md-icon" for="__drawer">
@@ -383,7 +383,7 @@
383383
<label class="md-nav__title" for="__drawer">
384384
<a href="../.." title="Empathy Framework" class="md-nav__button md-logo" aria-label="Empathy Framework" data-md-component="logo">
385385

386-
<img src="../../assets/images/empathy-brain-logo.png" alt="logo">
386+
<img src="/framework-docs/assets/images/empathy-brain-logo.png" alt="logo">
387387

388388
</a>
389389
Empathy Framework
@@ -4394,7 +4394,7 @@ <h2 id="see-also">See Also<a class="headerlink" href="#see-also" title="Permanen
43944394
<script id="__config" type="application/json">{"annotate": null, "base": "../..", "features": ["navigation.instant", "navigation.tracking", "navigation.tabs", "navigation.sections", "navigation.expand", "navigation.top", "search.suggest", "search.highlight", "content.code.copy"], "search": "../../assets/javascripts/workers/search.7a47a382.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
43954395

43964396

4397-
<script src="../../assets/javascripts/bundle.e71a0d61.min.js"></script>
4397+
<script src="/framework-docs/assets/javascripts/bundle.e71a0d61.min.js"></script>
43984398

43994399

44004400
</body>

0 commit comments

Comments
 (0)