Repository navigation
Show Copy page on API Markdown pages - #4984
Conversation
Intro, outro and Authentication pages already write a `.md` export, but `MarkdownPageViewModel` hid the Copy page button. This deletes that opt-out. No other page used it, so the download-only menu for pages without Markdown goes too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| @supports not selector(:popover-open) { | ||
| .api-page-actions--download-only .api-page-actions-split { | ||
| display: none; | ||
| } | ||
| .api-page-actions--download-only .api-page-actions-menu { | ||
| display: block; | ||
| } |
There was a problem hiding this comment.
Severity: P3 (Low)
Removing the inline fallback makes the JSON and YAML downloads inaccessible on authored API pages in the legacy layout when the browser lacks the Popover API. The new chevron cannot open the menu, and floating.css hides it. Keep a fallback for the split menu so adding Copy page does not remove access to the downloads.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
There was a problem hiding this comment.
No change here. Authored pages now use the same split menu as the spec landing, group and operation pages. Those pages put the JSON and YAML downloads in the same popover and have never had a fallback for browsers without the Popover API. The deleted fallback only covered the download-only menu, and no page renders that menu anymore. The Popover API has been Baseline in Chromium, Firefox and Safari since April 2024, and is now widely available. A fallback for the split menu would apply to every API page, so it belongs in its own change if we want one.
An empty authored page rendered Copy page and View as Markdown, but the generator skipped its `.md` because the export was empty. It now skips only pages with no export, so the links always resolve. Per review by @infra-vault-gh-plugin-prod. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The earlier test checked only the layout model, so it passed even if a layout dropped the button or the link. The new tests render the Kibana intro page and check Copy page in the current layout and View as Markdown in the navigation-preview rail. Per review by @infra-vault-gh-plugin-prod. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| var markdown = await page.RenderCommonMarkAsync(renderContext, pageModel, ctx).ConfigureAwait(false); | ||
| if (string.IsNullOrEmpty(markdown)) | ||
| // An empty authored page still gets its export, which its Copy page links to. | ||
| if (markdown is null) |
There was a problem hiding this comment.
Severity: P3 (Low)
An empty guide.md now reserves the output path guide.md as a file. If the same API lists guide.md.md as another child, that page already needs guide.md/ as its HTML directory. These distinct child slugs built before the empty export was added, but now one of the writes fails and the API build can be left incomplete. Check for file/directory collisions when assigning export paths.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
There was a problem hiding this comment.
No change in this PR. The collision does not come from the empty export. CreateSlugFromFile turns guide.md.md into the slug guide.md. A non-empty guide.md already wrote guide.md as its export before this change, so the two children already collided on main. This change applies the same export rule to empty pages and adds no new kind of collision. The general fix is to reject an authored slug that ends in .md (or contains a dot) in ValidateSlugForCollisions. That applies to every authored page whether or not it is empty, so it belongs in its own change.
There was a problem hiding this comment.
That describes a pre-existing collision when guide.md is non-empty, but it doesn’t rule out the regression for an empty guide.md: before this change, empty Markdown was skipped; now only null is skipped, so an empty page gets a guide.md export (changed guard).
The paths explain the conflict: guide.md produces slug guide, while guide.md.md produces slug guide.md (slug creation). The first page’s Markdown export is guide.md; the second page’s HTML output requires the guide.md/ directory (output path mapping, render/write sequence). So the general slug-validation fix may be worth handling separately, but this change does introduce that collision for the previously non-exported empty-page case.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4984/ |
Authored Markdown pages in the API reference, such as the Kibana Spaces overview, now show the Copy page menu like every other API page.
Affects: API reference
Prompt summary: Jan asks why
/docs/api/kibana/kibana-api-overviewhas no Copy page button, when other API pages do. The goal is to give these pages the same button.Why
MarkdownPageViewModelsetsShowPageActionstofalse, so authored intro, outro and Authentication pages hide Copy page. These pages already write a.mdexport, and their<link rel="alternate" type="text/markdown">points to it. Only the button is missing.What
Markdown pages get Copy page
The override in
MarkdownPageViewModelis gone. Copy page and View as Markdown on these pages open the.mdthat the build already writes.Every authored page writes its export
The generator used to skip the
.mdfor a page whose export was empty, such as an empty authored file. It now skips only a page with no export, so Copy page never links to a missing file.The page-actions opt-out is removed
No other page turned page actions off, so the
ShowPageActionshook and the layout flag are deleted.ApiPageActionsModel.MarkdownUrlis no longer nullable. The download-only menu for pages without Markdown (_SpecDownloadActions, its CSS and its snapshot test) is deleted, because no page renders it now.Verify
Then open
http://localhost:3000/api/kibana/kibana-api-overviewand click Copy page. The clipboard holds the page's Markdown with its front matter.Check on the preview
.md.🤖 Generated with Claude Code