Skip to content

Directives: add list-sub-pages directive#2847

Merged
cotti merged 5 commits intomainfrom
feature/list-sub-pages-directive
Mar 20, 2026
Merged

Directives: add list-sub-pages directive#2847
cotti merged 5 commits intomainfrom
feature/list-sub-pages-directive

Conversation

@reakaleek
Copy link
Copy Markdown
Member

What

  • Add a new {list-sub-pages} directive that renders a list of child pages for the current section
  • Each entry shows the page title as a link, with an optional description from frontmatter (separated by an em dash)

Why

  • Index pages often need a way to list their child pages so readers can discover content within a section
  • This directive automates that listing based on the TOC structure, removing the need to manually maintain link lists

Notes

  • The directive resolves pages from the navigation tree at parse time, so ResolveDirectoryTree must run before ParseFullAsync — the base DirectiveTest was updated to call it, which caused a pre-existing test (IncludeNeedsToLiveInSpecialFolder) to see an extra diagnostic; the assertion was relaxed to accommodate this
  • Descriptions come from IDocumentationFile.Description (frontmatter description field); a future improvement could use DescriptionGenerator as a fallback when no frontmatter description is set

Made with Cursor

@reakaleek reakaleek requested review from a team as code owners March 3, 2026 23:06
@reakaleek reakaleek requested a review from cotti March 3, 2026 23:06
Comment thread src/Elastic.Markdown/Myst/Directives/SubPages/ListSubPagesBlock.cs Fixed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 3, 2026

🔍 Preview links for changed docs

reakaleek and others added 4 commits March 4, 2026 10:02
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…s-directive

# Conflicts:
#	src/Elastic.Markdown/Myst/Directives/DirectiveBlockParser.cs
#	src/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cs
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7d64f6e1-1b2b-4a8b-9dc4-df638251ba9e

📥 Commits

Reviewing files that changed from the base of the PR and between 49e4efc and 2453476.

📒 Files selected for processing (12)
  • docs/_docset.yml
  • docs/syntax/directives.md
  • docs/syntax/list-sub-pages.md
  • src/Elastic.Markdown/Myst/Directives/DirectiveBlockParser.cs
  • src/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cs
  • src/Elastic.Markdown/Myst/Directives/SubPages/ListSubPagesBlock.cs
  • src/Elastic.Markdown/Myst/Directives/SubPages/ListSubPagesView.cshtml
  • src/Elastic.Markdown/Myst/Directives/SubPages/ListSubPagesViewModel.cs
  • tests/Elastic.Markdown.Tests/Directives/DirectiveBaseTests.cs
  • tests/Elastic.Markdown.Tests/Directives/ListSubPagesTests.cs
  • tests/Elastic.Markdown.Tests/DocSet/NavigationTests.cs
  • tests/Elastic.Markdown.Tests/FileInclusion/IncludeTests.cs

📝 Walkthrough

Walkthrough

This pull request introduces a new {list-sub-pages} directive for the documentation system. The implementation spans documentation updates, parser and renderer modifications to recognize and handle the directive, a new ListSubPagesBlock class that resolves sibling pages from navigation data, a corresponding view model and Razor template for HTML rendering, and comprehensive test coverage including three test suites. Supporting changes adjust test infrastructure and relax diagnostic assertions in existing tests.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/list-sub-pages-directive
  • 🛠️ Update Documentation: Commit on current branch
  • 🛠️ Update Documentation: Create PR

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can get early access to new features in CodeRabbit.

Enable the early_access setting to enable early access features such as new models, tools, and more.

@cotti cotti merged commit 836c0b8 into main Mar 20, 2026
31 checks passed
@cotti cotti deleted the feature/list-sub-pages-directive branch March 20, 2026 17:53
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.

3 participants