Replies: 1 comment
-
Hello, I check out the source code and found there is an add_header_buttons() function which extends the def add_header_buttons(app, pagename, templatename, context, doctree):
"""Add basic and general header buttons, we'll add source/launch later."""
opts = get_theme_options_dict(app)
pathto = context["pathto"]
header_buttons = context["header_buttons"]
# If we have a suffix, then we have a source file
suff = context.get("page_source_suffix")
# Download buttons for various source content.
if as_bool(opts.get("use_download_button", True)) and suff:
download_buttons = []
# An ipynb file if it was created as part of the build (e.g. by MyST-NB)
if context.get("ipynb_source"):
download_buttons.append(
{
"type": "link",
"url": f'{pathto("_sources", 1)}/{context.get("ipynb_source")}',
"text": ".ipynb",
"icon": "fas fa-code",
"tooltip": translation("Download notebook file"),
"label": "download-notebook-button",
}
)
# Download the source file
download_buttons.append(
{
"type": "link",
"url": f'{pathto("_sources", 1)}/{context["sourcename"]}',
"text": suff,
"tooltip": translation("Download source file"),
"icon": "fas fa-file",
"label": "download-source-button",
}
)
download_buttons.append(
{
"type": "javascript",
"javascript": "window.print()",
"text": ".pdf",
"tooltip": translation("Print to PDF"),
"icon": "fas fa-file-pdf",
"label": "download-pdf-button",
}
)
# Add the group
header_buttons.append(
{
"type": "group",
"tooltip": translation("Download this page"),
"icon": "fas fa-download",
"buttons": download_buttons,
"label": "download-buttons",
}
)
# Full screen button
if as_bool(opts.get("use_fullscreen_button", True)):
header_buttons.append(
{
"type": "javascript",
"javascript": "toggleFullScreen()",
"tooltip": translation("Fullscreen mode"),
"icon": "fas fa-expand",
"label": "fullscreen-button",
}
) Maybe we could add an |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Glad to find this awesome theme 🚀
I noticed that I can set
use_xxx_button
to True or False in the html_theme_options the change the content button group:Can I add my link buttons into it?
Really appreciate!
Beta Was this translation helpful? Give feedback.
All reactions