-
Notifications
You must be signed in to change notification settings - Fork 1
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
Settle on one canonical TOC Tree implementation #40
Comments
Love this! Two things: 🗒 One of the contribution challenges with Docsmobile is the fact that the slug is independent of the file name. This means there's no obvious mapping between the source file structure and the URL path. This adds complexity to both finding source files, and to linking between pages. Have you thought about how this navigation structure will influence the HTML path for the built docs? 🗒 There's an additional request for V3 that is important to writers and relates to TOC tree implementation: The ability to add optional TOC section headings. These section headings should not be selectable. They would be only used to group related content together. For example, consider the following example config file:
The config file above might generate a TOC that looks like this: |
Will using a single myst.yml for ToC management pose challenges in flexibility for our large, multi-repo Docs sets? Modular documentationA single ToC might limit writers when contributing to the sub-ToCs of their Docs areas. We could consider implementing a strategy where the single myst.yml references other ToC fragments, creating a modular approach while maintaining a single entry point. However, this is how we work today, and it gets confusing. We could explore removing the manual effort by using scripts or tools that automatically generate or update the main myst.yml based on changes made in our repos. Version-specific ToC modificationsWith only one ToC, handling version-specific documentation changes could become complex. This is all dependent on what comes out of the version consolidation project, but my main concerns are Cloud, Logstash plugins, and APM agents. If different versions of the documentation need slightly different navigation, we’d need to manage those variations within the single myst.yml, which could be prone to errors or difficult to maintain. However, we do a good job of maintaining this today. |
Notes from meeting:
|
@KOTungseth @bmorelli25 I am nearly done implementing this. See https://github.com/elastic/docs-builder/blob/main/docs/source/docset.yml for a "real world" example. One outstanding question: Right now the navigation node is powered by the markdown's title: The Currently all pages under Is this a feature I need to add to |
Awesome! And good question. Yes, this feature is very important for SEO purposes. We want to be able to set keyword-rich titles in documents, and be able to override those titles with custom nav/toc names. I think setting this override in the docset.yml file makes the most sense. |
The more I think about it, I'm indifferent to how this is solved (frontmatter or |
I have a preference for yaml front matter too. Since it can also define the title all presentational properties will be in one place. I fear the toc in the docset.yml will become too noisy if it'd be defined there. Will finish this ticket in the morning! |
Sounds good! |
Relates: #32
The
{toctree}
directive is not a Myst native directive it comes from Sphinx.Currently this repository includes the sample documentation from https://github.com/elastic/markitpy-samples/tree/main/docs/source which were heavily geared to Sphinx.
Pending discussion #38 we'll most likely don't want to support
{toctree}
but instead use the Myst native way throughmyst.yml
See: https://mystmd.org/guide/table-of-contents
This has several advantages:
{toctree}
{toctree}
is always provided at the beginning/end of anindex.md
myst.yml
allows grouping of related files in the same folder throughchildren
without them needing to be in a folderDisadvantages
myst.yml
file so it's aone way door
in the sense either everything needs to be in the TOC or nothing.Proposal
Since myst.toc is very much geared towards smaller documentation sites or single Jupiter notebook html export I propose we follow its TOC in spirt:
toc
definition control any nested childrentoc
definitions to isolate if neededfolder
's without having to explicitly specify all its childrentoc
configurationtoc
defines its content explicitly this will result in a build error.Example configuration
Going over the bits in isolation:
Globally ignores any files matching the configured glob patterns.
Ordered list so
index.md
andconfig.md
appear first.Creates a collapsable section in the navigation with
search.md
being the root andsearch-part2.md
and the contents of thesearch
folder as its children.Auto include
my-folder1
if that folder contains atoc
it will use that otherwise use the default rules for folder inclusion.An inline
toc
declaration formy-folder2
. If thatmy-folder2
holds its owntoc
file too it will result in a build error.The inline declaration automatically prefixes
my-folder2
to children so that it can be renamed with ease.future expansions ideas
We can expand this later with more options e.g:
To emit the folder as
new-feature/*
andfeatureA/* and
featureB/*` as a means to safely rename a folder while links and rewrite rules get updated.The text was updated successfully, but these errors were encountered: