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

[DOCFIX] Add Table of contents nav bar on right side of page #17749

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions docs/_includes/toc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{% capture tocWorkspace %}
{% comment %}
Copyright (c) 2017 Vladimir "allejo" Jimenez

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
{% endcomment %}
{% comment %}
Version 1.2.0
https://github.com/allejo/jekyll-toc

"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe

Usage:
{% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}

Parameters:
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll

Optional Parameters:
* sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
* class (string) : '' - a CSS class assigned to the TOC
* id (string) : '' - an ID to assigned to the TOC
* h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
* h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
* ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
* item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
* submenu_class (string) : '' - add custom class(es) for each child group of headings; has support for '%level%' placeholder which is the current "submenu" heading level
* base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
* anchor_class (string) : '' - add custom class(es) for each anchor element
* skip_no_ids (bool) : false - skip headers that do not have an `id` attribute

Output:
An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
generate the table of contents and will NOT output the markdown given to it
{% endcomment %}

{% capture newline %}
{% endcapture %}
{% assign newline = newline | rstrip %} <!-- Remove the extra spacing but preserve the newline -->

{% capture deprecation_warnings %}{% endcapture %}

{% if include.baseurl %}
{% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "baseurl" has been deprecated, use "base_url" instead -->{{ newline }}{% endcapture %}
{% endif %}

{% if include.skipNoIDs %}
{% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "skipNoIDs" has been deprecated, use "skip_no_ids" instead -->{{ newline }}{% endcapture %}
{% endif %}

{% capture jekyll_toc %}{% endcapture %}
{% assign orderedList = include.ordered | default: false %}
{% assign baseURL = include.base_url | default: include.baseurl | default: '' %}
{% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %}
{% assign minHeader = include.h_min | default: 1 %}
{% assign maxHeader = include.h_max | default: 6 %}
{% assign nodes = include.html | strip | split: '<h' %}

{% assign firstHeader = true %}
{% assign currLevel = 0 %}
{% assign lastLevel = 0 %}

{% capture listModifier %}{% if orderedList %}ol{% else %}ul{% endif %}{% endcapture %}

{% for node in nodes %}
{% if node == "" %}
{% continue %}
{% endif %}

{% assign currLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}

{% if currLevel < minHeader or currLevel > maxHeader %}
{% continue %}
{% endif %}

{% assign _workspace = node | split: '</h' %}

{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
{% assign htmlID = _idWorkspace[0] %}

{% assign _classWorkspace = _workspace[0] | split: 'class="' %}
{% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
{% assign htmlClass = _classWorkspace[0] %}

{% if htmlClass contains "no_toc" %}
{% continue %}
{% endif %}

{% if firstHeader %}
{% assign minHeader = currLevel %}
{% endif %}

{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}

{% if include.item_class and include.item_class != blank %}
{% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %}
{% endif %}

{% if include.submenu_class and include.submenu_class != blank %}
{% assign subMenuLevel = currLevel | minus: 1 %}
{% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %}
{% endif %}

{% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}

{% if htmlID %}
{% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %}

{% if include.anchor_class %}
{% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %}
{% endif %}

{% capture listItem %}<a{{ anchorAttributes }}>{{ anchorBody }}</a>{% endcapture %}
{% elsif skipNoIDs == true %}
{% continue %}
{% else %}
{% capture listItem %}{{ anchorBody }}{% endcapture %}
{% endif %}

{% if currLevel > lastLevel %}
{% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %}
{% elsif currLevel < lastLevel %}
{% assign repeatCount = lastLevel | minus: currLevel %}

{% for i in (1..repeatCount) %}
{% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
{% endfor %}

{% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
{% else %}
{% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
{% endif %}

{% capture jekyll_toc %}{{ jekyll_toc }}<li{{ listItemClass }}>{{ listItem }}{% endcapture %}

{% assign lastLevel = currLevel %}
{% assign firstHeader = false %}
{% endfor %}

{% assign repeatCount = minHeader | minus: 1 %}
{% assign repeatCount = lastLevel | minus: repeatCount %}
{% for i in (1..repeatCount) %}
{% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
{% endfor %}

{% if jekyll_toc != '' %}
{% assign rootAttributes = '' %}
{% if include.class and include.class != blank %}
{% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %}
{% endif %}

{% if include.id and include.id != blank %}
{% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %}
{% endif %}

{% if rootAttributes %}
{% assign nodes = jekyll_toc | split: '>' %}
{% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %}
{% endif %}
{% endif %}
{% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc -}}
7 changes: 6 additions & 1 deletion docs/_layouts/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@
</div>
</div>

<div class="col-9" id="content">
<div class="col-6" id="content">
Copy link
Contributor

Choose a reason for hiding this comment

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

shrinking this to 2/3 the original size seems to be a bit narrow. we can merge this for now but i think we should consider making the other sections more narrow too to make more space for the content. the font size and spacing may need to be reduced for the two side bars

<h1 class="title">{{ page.title }}</h1>
{{ content }}
</div>
<div class = "col-3" id="tableOfContent" >
<div class = "sticky-top">
{% include toc.html html=content %}
</div>
</div>

</div>
<div class="row">
Expand Down
2 changes: 0 additions & 2 deletions docs/en/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ group: Overview
priority: 1
---

* Table of Contents
{:toc}

## What is Alluxio

Expand Down
2 changes: 0 additions & 2 deletions docs/en/administration/Basic-Logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Administration
priority: 2
---

* Table of Contents
{:toc}

## Introduction

Expand Down
2 changes: 0 additions & 2 deletions docs/en/administration/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Administration
priority: 1
---

* Table of Contents
{:toc}

This page is a collection of high-level guides and tips regarding how to diagnose issues encountered in
Alluxio.
Expand Down
3 changes: 0 additions & 3 deletions docs/en/api/Java-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ By setting up an Alluxio Proxy, users can also interact with Alluxio through
This is mainly for admin actions not supported by S3 API. For example, mount and unmount operations.
The REST API is currently used for the Go and Python language bindings.

* Table of Contents
{:toc}

## Java Client

Alluxio provides access to data through a file system interface. Files in Alluxio offer write-once
Expand Down
2 changes: 0 additions & 2 deletions docs/en/api/REST-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ priority: 2
While users should use [S3 API]({{ '/en/api/S3-API.html' | relativize_url }}) for data I/O operations, admins can
interact with Alluxio through REST API for actions not supported by S3 API. For example, mount and unmount operations.

* Table of Contents
{:toc}

## REST API

Expand Down
2 changes: 0 additions & 2 deletions docs/en/api/S3-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Client APIs
priority: 1
---

* Table of Contents
{:toc}

Alluxio supports a [RESTful API](https://docs.alluxio.io/os/restdoc/{{site.ALLUXIO_MAJOR_VERSION}}/proxy/index.html)
that is compatible with the basic operations of the Amazon [S3 API](http://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html).
Expand Down
2 changes: 0 additions & 2 deletions docs/en/compute/Flink.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Compute Integrations
priority: 2
---

* Table of Contents
{:toc}

This guide describes how to get Alluxio running with [Apache Flink](http://flink.apache.org/), so
that you can easily work with files stored in Alluxio.
Expand Down
2 changes: 0 additions & 2 deletions docs/en/compute/Hadoop-MapReduce.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ priority: 1
This guide describes how to configure Alluxio with Apache Hadoop MapReduce, so that your
MapReduce programs can read+write data stored in Alluxio.

* Table of Contents
{:toc}

## Prerequisites

Expand Down
2 changes: 0 additions & 2 deletions docs/en/compute/Hive.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ priority: 2
This guide describes how to run [Apache Hive](http://hive.apache.org/) with Alluxio, so
that you can easily store Hive tables in Alluxio's tiered storage.

* Table of Contents
{:toc}

## Prerequisites

Expand Down
2 changes: 0 additions & 2 deletions docs/en/compute/Presto-Iceberg.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Presto has introduced support for [Iceberg tables](https://iceberg.apache.org/)
This document describes how to use Presto to query Iceberg tables through Alluxio.
This document is currently experimental, and the information provided here is subject to change.

* Table of Contents
{:toc}

In order to use Presto to query an Iceberg table, make sure you have a working setup of Presto,
Hive Metastore and Alluxio, and Presto can access data through Alluxio's filesystem interface.
Expand Down
2 changes: 0 additions & 2 deletions docs/en/compute/Presto.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ accessed data (e.g., tables commonly used) into Alluxio distributed storage.
Co-locating Alluxio workers with Presto workers improves data locality and reduces the I/O access
latency when other storage systems are remote or the network is slow or congested.

* Table of Contents
{:toc}

## Prerequisites

Expand Down
2 changes: 0 additions & 2 deletions docs/en/compute/Spark.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ priority: 0
This guide describes how to configure [Apache Spark](http://spark-project.org/)
to access Alluxio.

* Table of Contents
{:toc}

## Overview

Expand Down
3 changes: 1 addition & 2 deletions docs/en/compute/Trino.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ accessed data (e.g., tables commonly used) into Alluxio distributed storage.
Co-locating Alluxio workers with Trino workers improves data locality and reduces the I/O access
latency when other storage systems are remote or the network is slow or congested.

* Table of Contents
{:toc}


## Prerequisites

Expand Down
2 changes: 0 additions & 2 deletions docs/en/contributor/Building-Alluxio-From-Source.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ priority: 0

This guide describes how to clone the Alluxio repository, compile the source code, and run tests in your environment.

* Table of Contents
{:toc}

## Required Software

Expand Down
2 changes: 0 additions & 2 deletions docs/en/contributor/Code-Conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Contributor Resources
priority: 2
---

* Table of Contents
{:toc}

First off, we thank you for your interest in the Alluxio open source project!
We greatly appreciate any contribution; whether it be new features or bug fixes.
Expand Down
2 changes: 0 additions & 2 deletions docs/en/contributor/Contributor-Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ We warmly welcome you to the Alluxio community. We are excited for your contribu
engagement with our project! This guide aims to give you step by step instructions on how
to get started becoming a contributor to the Alluxio open source project.

* Table of Contents
{:toc}

## Prerequisites

Expand Down
2 changes: 0 additions & 2 deletions docs/en/contributor/Contributor-Tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Contributor Resources
priority: 3
---

* Table of Contents
{:toc}

## IDE

Expand Down
2 changes: 0 additions & 2 deletions docs/en/contributor/Documentation-Conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Contributor Resources
priority: 2
---

* Table of Contents
{:toc}

This documentation provides a writing style guide that portrays professionalism and efficiency in delivering technical content
in Alluxio documentation.
Expand Down
2 changes: 0 additions & 2 deletions docs/en/core-services/Caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Core Services
priority: 1
---

* Table of Contents
{:toc}

## Alluxio Storage Overview

Expand Down
2 changes: 0 additions & 2 deletions docs/en/core-services/Metadata-Caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Core Services
priority: 2
---

* Table of Contents
{:toc}

In Dora, Alluxio caches metadata and data on workers. This document explains how the metadata is cached and how the metadata is invalidated and refreshed. Along with the metadata invalidation, the data that is associated with the metadata is also invalidated.

Expand Down
2 changes: 0 additions & 2 deletions docs/en/deploy/Requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Install Alluxio
priority: 9
---

* Table of Contents
{:toc}

## General Requirements

Expand Down
2 changes: 0 additions & 2 deletions docs/en/deploy/Running-Alluxio-On-a-HA-Cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ group: Install Alluxio
priority: 3
---

* Table of Contents
{:toc}


## Overview
Expand Down
Loading
Loading