Skip to content

Conversation

Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Mar 19, 2025

This allows us to inject navigation using the assembler build (not yet implemented) without having to resolve all markdown files.

This still supports the PrimaryNav feature flag for local builds.

cursorful-video-1742410256917.mp4

This allows us to inject navigation using the assembler build (not yet implemented) without having to resolve all markdown files
@Copilot Copilot AI review requested due to automatic review settings March 19, 2025 18:21
@Mpdreamz Mpdreamz requested a review from a team as a code owner March 19, 2025 18:21
@Mpdreamz Mpdreamz self-assigned this Mar 19, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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 refactors the navigation rendering to a more anemic design by introducing an interface (INavigationHtmlWriter) and updating the related navigation and TOC processing components. Key changes include extracting navigation rendering to a dedicated interface and class, removing the in_nav flag from TOC configurations, and updating the HTMX attribute generation logic.

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Elastic.Markdown/Slices/HtmlWriter.cs Extracts navigation rendering into INavigationHtmlWriter and updates dependency injection
src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs Updates link data assignment for navigation information in diagnostic links
src/Elastic.Markdown/IO/Navigation/DocumentationGroup.cs Refactors DocumentationGroup to implement INavigation and use topLevelGroup for navigation consistency
src/Elastic.Markdown/Myst/Renderers/HtmxLinkInlineRenderer.cs Removes BuildContext dependency and simplifies HTMX attribute generation
src/Elastic.Markdown/IO/MarkdownFile.cs Implements INavigationScope and ITableOfContentsScope and initializes RootNavigation
src/Elastic.Markdown/Helpers/Htmx.cs Simplifies HTMX helper methods by removing feature flag parameters from attribute construction
Other cshtml files Adapt HTMX attribute calls to the new API and remove unused navigation properties
Comments suppressed due to low confidence (2)

src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs:197

  • [nitpick] Consider using 'nameof(MarkdownFile.RootNavigation)' as the key instead of 'nameof(currentMarkdown.RootNavigation)' to ensure consistency across the codebase.
link.SetData(nameof(currentMarkdown.RootNavigation), currentMarkdown.RootNavigation);

src/Elastic.Markdown/Helpers/Htmx.cs:29

  • Wrap the attribute value in quotes (e.g. hx-get="{targetUrl}") to ensure that the generated HTML is valid.
_ = attributes.Append($" hx-get={targetUrl}");

Copy link
Member

@reakaleek reakaleek left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning up!

@Mpdreamz Mpdreamz merged commit a645d4f into main Mar 19, 2025
10 checks passed
@Mpdreamz Mpdreamz deleted the feature/refactor-navigation branch March 19, 2025 21:39
@reakaleek reakaleek mentioned this pull request Mar 20, 2025
3 tasks
@reakaleek
Copy link
Member

I just noticed this introduced a visual bug.
Here is a potential fix: #787

@reakaleek
Copy link
Member

This is maybe also related: #788

@Mpdreamz Mpdreamz restored the feature/refactor-navigation branch March 21, 2025 18:59
@Mpdreamz Mpdreamz deleted the feature/refactor-navigation branch June 12, 2025 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants