Conversation
… to sub toc.yml files
Contributor
There was a problem hiding this comment.
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)];
reakaleek
approved these changes
Mar 19, 2025
Mpdreamz
added a commit
that referenced
this pull request
Mar 19, 2025
… 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
Mpdreamz
added a commit
that referenced
this pull request
Mar 19, 2025
* 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 <jan.calanog@elastic.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This introduces a restriction so that if a
docset.ymlfile links to atoc.ymlfile it may ONLY link totoc.ymlfiles.This to ensure all folders can be
homedby the assemblernavigation.yml.e.g elasticsearch's
docset.ymldefines:and the
navigation.ymlinjects them in various places usingelasticsearch://referenceThere is no valid home for any files that might be placed at the root e.g:
elasticsearch://this PR prevents people from adding such
fileandfolderreferences.This also introduces
dev_docsconfiguration for documentation sets that never intend to publish through assembler like ourdocs-builderdocs.Enabling this relaxes this new
toconly restriction.cc @colleenmcginnis