Skip to content

Keep console request lines in Markdown and search text output - #4986

Merged
akira28 merged 2 commits into
mainfrom
feature/markdown-versions-files-missing
Nov 20, 2026
Merged

akira28 merged 2 commits into
mainfrom
feature/markdown-versions-files-missing

Conversation

@akira28

@akira28 akira28 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

The .md version of a page now shows the request lines of console code blocks, such as GET /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 console block into a separate header so the HTML view can style it, and blanks that line in the block. The .md renderer and the plain text renderer read only the block's lines. Every GET, PUT and POST line 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 .md renderer and the plain text renderer both use TextLines(). Each had its own copy of the trailing blank line helper, and both copies are gone.

The Markdown fence says console

The parser relabels console blocks as json for highlighting. A json fence with request lines in it would mislead anyone who parses it as JSON, so the .md fence reads console when the block has request lines. docs/data/exporters/llm.md describes this.

Out of scope: callout markers such as <1> still appear inside the JSON body of console blocks in the .md output, as they did before.

Verify

dotnet test --project tests/Elastic.Authoring.Tests --treenode-filter "/*/*/ConsoleCodeBlocks/*"
# LlmMarkdown/ConsoleCodeBlocks — .md output; PlainText/ConsoleCodeBlocks — search text

Check on the preview

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]>
@akira28
akira28 requested a review from a team as a code owner November 20, 2026 11:47
@akira28
akira28 requested a review from reakaleek November 20, 2026 11:47
@akira28 akira28 added the bug label Nov 20, 2026
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]>
@github-actions

Copy link
Copy Markdown
Contributor

@akira28
akira28 merged commit 808397a into main Nov 20, 2026
44 checks passed
@akira28
akira28 deleted the feature/markdown-versions-files-missing branch November 20, 2026 12:12
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.

1 participant