Skip to content

Commit

Permalink
revert metadata keys' name changes
Browse files Browse the repository at this point in the history
approved workaround to sphinx-doc/sphinx#10932 is to
use a blank line at start of doc before metadata
  • Loading branch information
2bndy5 committed Oct 24, 2022
1 parent 244ff9a commit 85b5a9c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
26 changes: 13 additions & 13 deletions docs/customization.rst
Expand Up @@ -130,17 +130,17 @@ Each metadata is evaluated as a :rst:`:key: value` pair.
:hero: Configuration options to personalize your site.
.. themeconf:: hide_navigation
.. themeconf:: hide-navigation

If specified, hides the global navigation sidebar shown on the left side of the page.
By default, the navigation menu is shown if the browser viewport is sufficiently wide.

.. code-block:: rst
:caption: Hide the navigation menu like so:
:hide_navigation:
:hide-navigation:
.. themeconf:: hide_toc
.. themeconf:: hide-toc

If specified, hides the local table of contents shown on the right side of the page.
By default the local table of contents is shown if the page contains sub-sections and the
Expand All @@ -150,17 +150,17 @@ Each metadata is evaluated as a :rst:`:key: value` pair.
.. code-block:: rst
:caption: Hide the Table of Contents like so:
:hide_toc:
:hide-toc:
Instead of using :rst:`:hide_toc:`, this theme can also use the :rst:`:tocdepth:` metadata to hide the
Instead of using :rst:`:hide-toc:`, this theme can also use the :rst:`:tocdepth:` metadata to hide the
page's Table of Contents.

.. code-block:: rst
:caption: Set the depth for the Table of Contents to ``0``:
:tocdepth: 0
.. themeconf:: hide_edit_link
.. themeconf:: hide-edit-link

If specified, hides the "Edit this page" link at the top of the page. By
default, an edit link is shown if :themeconf:`edit_uri` is specified. This
Expand All @@ -169,29 +169,29 @@ Each metadata is evaluated as a :rst:`:key: value` pair.
.. code-block:: rst
:caption: Hide the "Edit this page" link:
:hide_edit_link:
:hide-edit-link:
A common use case for this option is to specify it on automatically-generated
pages, as for those pages there is no source document to edit.

.. themeconf:: hide_footer
.. themeconf:: hide-footer

If specified, hides the current page's footer (specifically the part containing the
"Previous" and "Next" links).

.. code-block:: rst
:caption: Hide the "Previous" and "Next" links at the bottom of the page:
:hide_footer:
:hide-footer:
.. themeconf:: hide_feedback
.. themeconf:: hide-feedback

If specified, hides the user :themeconf:`feedback` buttons at the bottom of the current page.

.. code-block:: rst
:caption: Hide the feedback buttons at the bottom of the page:
:hide_feedback:
:hide-feedback:
Configuration Options
=====================
Expand Down Expand Up @@ -270,7 +270,7 @@ Configuration Options

The icon used for the generated "edit this page" button at the top of the document.
This is only used if :themeconf:`edit_uri` is configured and when not explicitly hidden
using :themeconf:`hide_edit_link`.
using :themeconf:`hide-edit-link`.

As usual, `any of the icons bundled with this theme`_ can be used here. While the default is
``material/pencil``, this documentation uses ``material/file-edit-outline``
Expand Down Expand Up @@ -538,7 +538,7 @@ Configuration Options
}
.. seealso::
User feedback can be hidden for a certain page by using the :themeconf:`hide_feedback`
User feedback can be hidden for a certain page by using the :themeconf:`hide-feedback`
metadata tag in the document's source.
.. themeconf:: globaltoc_collapse
Expand Down
2 changes: 1 addition & 1 deletion sphinx_immaterial/apidoc/apigen_utils.py
Expand Up @@ -116,7 +116,7 @@ def write_file(self, docname: str, object_name: str, entity_content: str):

content = self.initial_comment
# Suppress "Edit this page" link since the page is generated.
content += "\n\n:hide_edit_link:\n\n"
content += "\n\n:hide-edit-link:\n\n"
content += entity_content
rst_path = os.path.join(self.app.srcdir, docname + ".rst")
if os.path.exists(rst_path):
Expand Down
10 changes: 5 additions & 5 deletions sphinx_immaterial/nav_adapt.py
Expand Up @@ -793,13 +793,13 @@ def _html_page_context(
meta={"hide": [], "revision_date": context.get("last_updated")},
content=context.get("body"),
)
if meta.get("tocdepth") == 0 or "hide_toc" in meta:
if meta.get("tocdepth") == 0 or "hide-toc" in meta:
page["meta"]["hide"].append("toc")
if "hide_navigation" in meta:
if "hide-navigation" in meta:
page["meta"]["hide"].append("navigation")
if "hide_footer" in meta:
if "hide-footer" in meta:
page["meta"]["hide"].append("footer")
if "hide_feedback" in meta:
if "hide-feedback" in meta:
page["meta"]["hide"].append("feedback")
if context.get("next"):
page["next_page"] = {
Expand All @@ -817,7 +817,7 @@ def _html_page_context(
}
repo_url: Optional[str] = theme_options.get("repo_url")
edit_uri: Optional[str] = theme_options.get("edit_uri")
if repo_url and edit_uri and not READTHEDOCS and "hide_edit_link" not in meta:
if repo_url and edit_uri and not READTHEDOCS and "hide-edit-link" not in meta:
page["edit_url"] = "/".join(
[
repo_url.rstrip("/"),
Expand Down

0 comments on commit 85b5a9c

Please sign in to comment.