Skip to content

Conversation

waylan
Copy link
Member

@waylan waylan commented Aug 16, 2018

This updates the readthedocs theme to more closely match the upstream Sphinx theme (at version 0.4.1). This should resolve #588 and #1374.

The following theme config settings were added:

  • include_homepage_in_sidebar: Lists the homepage in the sidebar menu. As
    MkDocs requires that the homepage be listed in the nav configuration
    option, this setting allows the homepage to be included or excluded from
    the sidebar. Note that the site name/logo always links to the homepage.
    Default: True.

  • prev_next_buttons_location: One of bottom, top, both , or none.
    Displays the “Next” and “Previous” buttons accordingly. Default: bottom.

  • navigation_depth: The maximum depth of the navigation tree in the
    sidebar. Default: 4.

  • titles_only: If True, removes headers within a page from the sidebar.
    Default: False.

@waylan waylan added the Theme-general Issues involving the theme related code within MkDocs label Aug 16, 2018
@waylan waylan added this to the 1.1 milestone Aug 16, 2018
@waylan waylan added Theme-readthedocs Issues specifically involving the readthedocs theme. and removed Theme-general Issues involving the theme related code within MkDocs labels Aug 22, 2018
@humitos
Copy link
Contributor

humitos commented Aug 29, 2018

@Blendify I'm taking the confidence to mention you here since you are one of the main maintainers of Read the Docs Sphinx Theme. It would be awesome if you could take a look at these changes when you have some time and give some feedback to mkdocs folks here.

I really appreciate your help.

You can just ignore this notification and that's fine. I'm sorry to bother you.

@Blendify
Copy link

There is no need to feel sorry, I am glad to help. I will take a look.

@Blendify
Copy link

Some toc options were not included these include:

  • includehidden = True
  • collapse_navigation = True
  • sticky_navigation = True

Is there a reason these are not supported?

@waylan
Copy link
Member Author

waylan commented Aug 31, 2018

Some toc options were not included these include:

  • includehidden = True

MkDocs' concept of hidden pages is very different from Sphinx and therefore this option makes no sense. As I understand it, Sphinx page objects include a hidden attribute. MkDocs page object have no such attribute. A hidden page is simply not included in the nav at all. Therefore, there is no way to include such pages.

Or am I misunderstanding the purpose of this setting?

  • collapse_navigation = True
  • sticky_navigation = True

I haven't worked on these. Basically, I need to determine what is different about the HTML with these options enable/disabled and add the same logic to our template. Personally they are not high priority items so I haven't got to them yet. And the assumption is they could always be added at any time.

@waylan
Copy link
Member Author

waylan commented Aug 31, 2018

stick_navigation has been added.

I'm struggling to see the difference between collapse_navigation and titles_only. The documentation seems clearly different, but in practice both setting simply exclude TOC items from the nav. As I already implemented that feature in titles_only, what value is there is also adding collapse_navigation ?

As an aside, the documentation for collapse_navigation states:

  • collapse_navigation Bool. With this enabled, you will lose the [+] drop downs next to each section in the sidebar.

But that is not strictly true. You still get [+] drop downs, just not as many levels of them (tested with the docs in rtfd/sphinx_rtd_theme). I find that very misleading and its not something I'm inclined to replicate... unless someone can explain to me the value of the setting and/or what it is supposed to be doing.

@Blendify
Copy link

Blendify commented Sep 1, 2018

Hmm, our docs are a bit miss leading. http://www.sphinx-doc.org/en/stable/templating.html#toctree explains these options better.

@waylan
Copy link
Member Author

waylan commented Sep 4, 2018

@Blendify thank you. Those docs are must more clear. I now have the following implemented:

  • include_homepage_in_sidebar: Lists the homepage in the sidebar menu. As
    MkDocs requires that the homepage be listed in the nav configuration
    option, this setting allows the homepage to be included or excluded from
    the sidebar. Note that the site name/logo always links to the homepage.
    Default: True.

  • prev_next_buttons_location: One of bottom, top, both , or none.
    Displays the “Next” and “Previous” buttons accordingly. Default: bottom.

  • navigation_depth: The maximum depth of the navigation tree in the
    sidebar. Default: 4.

  • collapse_navigation: Only include the page section headers in the
    sidebar for the current page. Default: True.

  • titles_only: Only include page titles in the sidebar, excluding all
    section headers for all pages. Default: False.

  • sticky_navigation: If True, causes the sidebar to scroll with the main
    page content as you scroll the page. Default: True.

@Blendify
Copy link

Blendify commented Sep 5, 2018

I will take another look again, but from my first look over, it looked pretty good.

Update support files and nav. Still not getting the expand option for 
nav though.
It is included above search box. This matches upstream. Note that the 
homepage still needs to be listed in the `nav` setting or there won't be 
any homepage.
In the upstream Sphinx theme, this is controled when defining the 
toctree. However, Sphinx has a seperate settign for identifying the 
"homepage". In MkDocs the homepage is identified at the first item in 
the `nav`. Therefore, without this setting you can't exclude the 
homepage from the sidebar like you can in Sphinx. With this setting we 
get feature parity.
This output is a little weird as the section title is a link that does 
nothign when you click it. You need to click the `+` to expand the 
submenu. But that is what the upstream theme requires to work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Theme-readthedocs Issues specifically involving the readthedocs theme.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Read The Docs theme with upstream
3 participants