Repository navigation
Keep console request lines in Markdown and search text output - #4986
Merged
Merged
Conversation
The parser moves each request line of a `console` block into a separate header for the HTML view and blanks it in the block. The `.md` output and the plain text for the search index read only the block, so they lost every `GET`/`PUT`/`POST` line. Both now put the request lines back. Fixes elastic/docs-eng-team#1158 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A `json` fence that holds request lines misleads anyone who parses it as JSON, so the `.md` fence now reads `console` when the block has request lines. A plain text test keeps the request lines in search text, including a final `GET` with no body. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4986/ Sample changed pages: |
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.
The
.mdversion of a page now shows the request lines ofconsolecode blocks, such asGET /books/_search. The plain text sent to the search index keeps them too.Affects: Content export, Search
Prompt summary: Fix elastic/docs-eng-team#1158. The Markdown version of a page like the index basics guide shows the JSON bodies of its examples but not the HTTP method and path of each request.
Why
The parser moves each request line of a
consoleblock into a separate header so the HTML view can style it, and blanks that line in the block. The.mdrenderer and the plain text renderer read only the block's lines. EveryGET,PUTandPOSTline drops out, so an LLM or a search reader sees bodies with no endpoint.What
Request lines go back where they were
A new
EnhancedCodeBlock.TextLines()returns the block's lines with each request line put back at its original position, and drops trailing blank lines. A request with no body on the last line of a block is kept too.One helper for both text outputs
The
.mdrenderer and the plain text renderer both useTextLines(). Each had its own copy of the trailing blank line helper, and both copies are gone.The Markdown fence says
consoleThe parser relabels
consoleblocks asjsonfor highlighting. Ajsonfence with request lines in it would mislead anyone who parses it as JSON, so the.mdfence readsconsolewhen the block has request lines.docs/data/exporters/llm.mddescribes this.Out of scope: callout markers such as
<1>still appear inside the JSON body ofconsoleblocks in the.mdoutput, as they did before.Verify
Check on the preview
consoleexample sits in aconsolefence and shows its request line (HTTP method and path) above the JSON body. This is the page from the issue.