Skip to content

Commit 5a6eed4

Browse files
committed
Update core.py
1 parent 72dda54 commit 5a6eed4

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

great_docs/core.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,6 +2974,28 @@ def show_progress(stop_event, message):
29742974

29752975
if config and "website" in config and "navbar" in config["website"]:
29762976
self._update_navbar_github_link(config, owner, repo, repo_url, github_style)
2977+
2978+
# Also ensure the GitHub widget script is included
2979+
if owner and repo and github_style == "widget":
2980+
if "format" not in config:
2981+
config["format"] = {"html": {}}
2982+
if "html" not in config["format"]:
2983+
config["format"]["html"] = {}
2984+
if "include-after-body" not in config["format"]["html"]:
2985+
config["format"]["html"]["include-after-body"] = []
2986+
elif isinstance(config["format"]["html"]["include-after-body"], str):
2987+
config["format"]["html"]["include-after-body"] = [
2988+
config["format"]["html"]["include-after-body"]
2989+
]
2990+
2991+
gh_script_entry = {"text": '<script src="github-widget.js"></script>'}
2992+
has_gh_widget = any(
2993+
"github-widget" in str(item)
2994+
for item in config["format"]["html"]["include-after-body"]
2995+
)
2996+
if not has_gh_widget:
2997+
config["format"]["html"]["include-after-body"].append(gh_script_entry)
2998+
29772999
with open(quarto_yml, "w") as f:
29783000
yaml.dump(config, f, default_flow_style=False, sort_keys=False)
29793001

0 commit comments

Comments
 (0)