diff --git a/sass/_valkey.scss b/sass/_valkey.scss index d0f2248c..337c9b37 100644 --- a/sass/_valkey.scss +++ b/sass/_valkey.scss @@ -584,6 +584,69 @@ p { } } } + + // The docs menu (templates/left-aside.html) goes above the page on narrow + // screens. On wide screens .docs-sidebar has the padding instead. + .docs-aside { + order: -1; + + @include respond-min(1024px) { + order: 0; + padding: 0; + } + } +} + +// Narrow screens: a toggle that opens the menu. Wide screens: the menu is +// always open. +.docs-sidebar { + > summary { + display: flex; + justify-content: space-between; + align-items: center; + padding: 1rem 1.6rem; + border-radius: 10px; + background-color: #fff; + font-weight: 700; + color: #000; + cursor: pointer; + list-style: none; + + &::-webkit-details-marker { + display: none; + } + + // Chevron, as in the menu's sections. + &::after { + content: ''; + width: 0.7rem; + height: 0.7rem; + border-right: 2px solid currentColor; + border-bottom: 2px solid currentColor; + transform: rotate(-45deg); + } + + &:focus-visible { + outline: 2px solid #2054B2; + outline-offset: 1px; + } + } + + &[open] > summary { + margin-bottom: 1rem; + + &::after { + transform: rotate(45deg); + } + } + + @include respond-min(1024px) { + padding: 2rem; + + > summary { + display: none; + } + } } .docs-menu { @@ -2140,6 +2203,24 @@ html.banner-hidden .banner { height: 1.6rem; } +// "#" after each docs heading (heading_links in templates/macros/docs.html). +// Shown while the heading is hovered or the link has focus, and always on +// touch screens, which can't hover. +.heading-link { + margin-left: 0.4em; + opacity: 0; + + h2:hover > &, + h3:hover > &, + &:focus { + opacity: 1; + } + + @media (hover: none) { + opacity: 1; + } +} + // Amber rather than red: a release candidate is not broken, it is just not // finished. #7A4A00 on #FFF6E5 is 7.4:1. .release-prerelease-notice { @@ -2410,6 +2491,60 @@ blockquote { margin: 1.5rem 0 2.5rem; } +// Previous and next topic links at the end of a topic (nav_pager in +// templates/macros/nav.html). The links look like the docs menu's. "Next" +// stays on the right when there's no "Previous". +.docs-pager { + display: flex; + justify-content: space-between; + gap: 1rem; + margin-top: 4rem; + padding-top: 1.5rem; + border-top: 1px solid #d5d9ec; + + a { + display: flex; + flex-direction: column; + max-width: 50%; + padding: 0.6rem 1rem; + border-radius: 4px; + line-height: 1.35; + + &:hover { + background-color: #d1d9ff; + } + + &:focus-visible { + outline: 2px solid #2054B2; + outline-offset: 1px; + } + } + + .docs-pager-next { + margin-left: auto; + align-items: flex-end; + text-align: right; + } + + .docs-pager-label { + font-size: 1.3rem; + color: #444; + } + + .docs-pager-title { + font-weight: 600; + } + + @media (max-width: 768px) { + flex-direction: column; + gap: 0.5rem; + + a { + max-width: none; + } + } +} + // Homepage blog cards: text-only cards stacked vertically, matching the release // cards in the other column. .homepage-blog-section { diff --git a/templates/command-page.html b/templates/command-page.html index f1da74f7..8b1ca83a 100644 --- a/templates/command-page.html +++ b/templates/command-page.html @@ -166,13 +166,14 @@

{{ command_title }} {% if deprecated %} {{ de {% if command_description %} {%- set command_description_with_fixed_links %}{{< fix_links_command content={command_description} />}}{% endset -%} +{%- set command_description_html %}{{ command_description_with_fixed_links | markdown | safe }}{% endset -%} -{{ command_description_with_fixed_links | markdown | safe }} +{{< heading_links content={command_description_html} />}} {% else %} ERROR. Command description not loaded
{% endif %} {% if command_data_obj.replaced_by %} -

Deprecation advice

+{{< heading_links content='

Deprecation advice

' />}} Instead of using {{ command_title }} use
{{ command_data_obj.replaced_by | markdown | safe }}
{% endif %} @@ -205,7 +206,7 @@

RESP3 Reply

{% endif -%} {% if command_data_obj and command_data_obj.history %} -

History

+{{< heading_links content='

History

' />}} @@ -225,6 +226,11 @@

History

{% endif %} +{# Every command page, module commands included, is built from a description in valkey-doc (see build/init-commands.sh). #} +
+ See an error? + Update this Page on GitHub! +
{% endblock main_content %} {% block related_content %} diff --git a/templates/docs-page.html b/templates/docs-page.html index 748c0c16..8cb1cc83 100644 --- a/templates/docs-page.html +++ b/templates/docs-page.html @@ -59,7 +59,13 @@

{{ frontmatter_title }}


{% endif %} {%- set content_with_fixed_links %}{{< fix_links_docs content={page_contents} />}}{% endset -%} -{{ content_with_fixed_links | markdown | safe }} +{%- set content_html %}{{ content_with_fixed_links | markdown | safe }}{% endset -%} +{{< heading_links content={content_html} />}} +
+ See an error? + Update this Page on GitHub! +
+{{< nav_pager nav={nav_data} slug={page.slug} extra={config.extra} />}} {% endblock main_content %} {% block related_content %} @@ -68,9 +74,4 @@

{{ frontmatter_title }}

{% set nav_map_json %}{{< nav_command_map nav={nav_data} index={nav_index} />}}{% endset %} {% set nav_command_map = load_data(literal=nav_map_json, format="json") %} {{< nav_menu nav={nav_data} extra={config.extra} current={page.slug} open={nav_location.section} command_map={nav_command_map} index={nav_index} />}} - -
- See an error? - Update this Page on GitHub! -
{% endblock related_content %} diff --git a/templates/left-aside.html b/templates/left-aside.html index 8ec70914..5ff2ccbb 100644 --- a/templates/left-aside.html +++ b/templates/left-aside.html @@ -10,8 +10,23 @@ {% block main_content %}{% endblock main_content %} -