Skip to content

Gordon chat: draw a card when its fence follows text on the same line - #26786

Open
trungutt wants to merge 1 commit into
docker:mainfrom
trungutt:gordon-card-fence-own-line
Open

trungutt wants to merge 1 commit into
docker:mainfrom
trungutt:gordon-card-fence-own-line

Conversation

@trungutt

Copy link
Copy Markdown
Contributor

Description

The docs chat draws a card for each openui-lang code block in an answer. Sometimes the model writes the card's opening fence at the end of a sentence instead of on its own line. Markdown only opens a code block at the start of a line, so the card shows up as raw text. Worse, the card's closing fence then opens a new code block that never closes, and it swallows the rest of the answer, including the sources.

Before rendering an answer, and before copying it, the chat now moves any openui-lang opening fence that follows other text onto its own line. Fences that already start a line, and longer backtick runs, are left alone. The fix works while an answer is still streaming.

Before (what the model sends, drawn as raw text with the sources inside a code block):

...requires KVM support.```openui-lang
root = Card("KVM", [], "Check it")
```

Sources:
- https://docs.docker.com/...

After (what the chat renders and copies):

...requires KVM support.

```openui-lang
root = Card("KVM", [], "Check it")
```

Sources:
- https://docs.docker.com/...

To verify, run node --test hack/test/gordon-card-*.mjs. To check it in the browser, render an answer in the chat whose card fence follows a sentence on the same line. The card should draw, the sources should render as a list, and Copy should give the card as markdown.

Reviews

  • Technical review

Markdown only opens a code block at the start of a line. When the model
writes a card's opening fence right after a sentence, the card shows as
raw text and its closing fence opens a code block that swallows the rest
of the answer. Move such fences to their own line before rendering and
before copying.
@netlify

netlify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for docsdocker ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit edb8760
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6b08970bebfa3bad67663cdf
😎 Deploy Preview https://deploy-preview-26786--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added hugo Updates related to hugo area/tests labels Nov 26, 2026
@trungutt
trungutt marked this pull request as ready for review November 26, 2026 20:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tests hugo Updates related to hugo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant