-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
👌 IMPROVE: Making in-page TOC title configurable #299
👌 IMPROVE: Making in-page TOC title configurable #299
Conversation
sphinx_book_theme/__init__.py
Outdated
out = f""" | ||
<div class="tocsection onthispage pt-5 pb-3"> | ||
<i class="fas fa-list"></i> { context["translate"]('Contents') } | ||
<i class="fas fa-list"></i> { context["theme_toc_title"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we keep the translate
bit? I think that this would attempt to auto-translate the title for versions of the book that are in different languages. Is that right? Is there any downside to keeping the translate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, translate
is a function with signature <function get_translation.<locals>.gettext
. So, it should auto-translate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Pradyun Gedam <3275593+pradyunsg@users.noreply.github.com>
thanks very much! |
This PR makes in-page TOC title configurable with the introduction of the following key:
The default value of the title has been kept as
Contents
.It will throw an error if the title is set to empty (I reckon a title is always necessary?)
@choldgraf is there any exception handling format we need to follow for this repo. or the way I have handled it is ok?
fixes #297