Skip to content
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

Merged
merged 9 commits into from
Mar 9, 2021

Conversation

AakashGfude
Copy link
Member

This PR makes in-page TOC title configurable with the introduction of the following key:

html_theme_options = {
	"toc_title": "Some other title",
}

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

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"] }
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/configure.md Outdated Show resolved Hide resolved
AakashGfude and others added 2 commits March 8, 2021 22:12
Co-authored-by: Pradyun Gedam <3275593+pradyunsg@users.noreply.github.com>
@choldgraf choldgraf merged commit 3d9189d into executablebooks:master Mar 9, 2021
@choldgraf
Copy link
Member

thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the in-page TOC title configurable
3 participants