-
Notifications
You must be signed in to change notification settings - Fork 16
Restrict docset.yml configs that define toc.yml sections to ONLY link to sub toc.yml files #767
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
Conversation
… to sub toc.yml files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR restricts docset.yml configurations so that toc.yml sections only link to sub toc.yml files, except when in development mode.
- Added a new "dev_docs" field in the docset configuration to denote development docs.
- Updated configuration parsing in ConfigurationFile.cs to enforce that, in non-development mode, TOC entries only reference toc sections.
- Introduced a new TocReference type (extending FolderReference) and modified TableOfContentsConfiguration.cs to return TocReference objects accordingly.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
docs/_docset.yml | Adds a "dev_docs: true" flag along with explanatory comments. |
src/Elastic.Markdown/IO/Configuration/ConfigurationFile.cs | Introduces the DevelopmentDocs property and enforces stricter TOC linking rules depending on mode. |
src/Elastic.Markdown/IO/Configuration/ITocItem.cs | Adds a new TocReference record to represent TOC-only references. |
src/Elastic.Markdown/IO/Configuration/TableOfContentsConfiguration.cs | Changes the returned reference from FolderReference to TocReference for TOC sections. |
Comments suppressed due to low confidence (2)
src/Elastic.Markdown/IO/Configuration/ConfigurationFile.cs:123
- [nitpick] Consider clarifying the error message emitted on line 124 for consistency and user clarity, e.g., by capitalizing 'TOC' to 'TOC'.
if (!DevelopmentDocs && tocEntries.Length > 0 && children.Count != tocEntries.Length)
src/Elastic.Markdown/IO/Configuration/TableOfContentsConfiguration.cs:115
- Ensure that changing the returned reference from FolderReference to TocReference does not break any downstream code assumptions, as this change alters the type contract for TOC referencing.
return [new TocReference(`${parentPath}`.TrimStart(Path.DirectorySeparatorChar), folderFound, inNav, toc.TableOfContents)];
… to sub toc.yml files (#767) * Restrict docset.yml configs that define toc.yml sections to ONLY link to sub toc.yml files * relax check for narrative docs too, plays by different rules * dotnet format * reference Project directly
* Add global navigation and improve diagnostic handling This commit introduces a GlobalNavigation feature, parsing the new `navigation.yml` file to handle global navigation references. It also replaces `BuildContext` with `DiagnosticsCollector` for diagnostics, ensuring clearer separation of concerns. Additionally, it includes new tests and updates project files for better testing and navigation handling. * Use navigation.yml to control url path prefixes for resolving * path_prefix is mandatory except for top level docs-content references * stage commit * stage commit * File copy now in a decent place * temporary home for in flux paths * fix failing test * remove not referenced test project * Restrict docset.yml configs that define toc.yml sections to ONLY link to sub toc.yml files (#767) * Restrict docset.yml configs that define toc.yml sections to ONLY link to sub toc.yml files * relax check for narrative docs too, plays by different rules * dotnet format * reference Project directly * Fix layout and horizontal scrollable tables (#772) * Fix layout and horizontal scrollable tables mend * Use spacing var * Add custom scrollbar * tweaks * Add table of contents scope management and refactor diagnostics (#774) * Add table of contents scope management and refactor diagnostics Introduced `ITableOfContentsScope` to manage scope boundaries, improving link validation and table of contents processing. Updated diagnostics to emit hints for images outside the ToC scope and refactored functions for better reusability. Adjusted related tests and internal structures accordingly. * Add TODO to make this an error * post merge build fixes * good enough state --------- Co-authored-by: Jan Calanog <[email protected]>
This introduces a restriction so that if a
docset.yml
file links to atoc.yml
file it may ONLY link totoc.yml
files.This to ensure all folders can be
homed
by the assemblernavigation.yml
.e.g elasticsearch's
docset.yml
defines:and the
navigation.yml
injects them in various places usingelasticsearch://reference
There is no valid home for any files that might be placed at the root e.g:
elasticsearch://
this PR prevents people from adding such
file
andfolder
references.This also introduces
dev_docs
configuration for documentation sets that never intend to publish through assembler like ourdocs-builder
docs.Enabling this relaxes this new
toc
only restriction.cc @colleenmcginnis