Skip to content

🐛 Fixed design preview showing raw markdown when llms.txt is enabled#28266

Merged
9larsons merged 1 commit into
TryGhost:mainfrom
magicpages:fix/llms-txt-preview-markdown
May 31, 2026
Merged

🐛 Fixed design preview showing raw markdown when llms.txt is enabled#28266
9larsons merged 1 commit into
TryGhost:mainfrom
magicpages:fix/llms-txt-preview-markdown

Conversation

@betschki
Copy link
Copy Markdown
Contributor

fixes #28265

  • the design & branding and announcement bar previews fetch the page, read it as text, and re-parse it as HTML into the iframe. They have always sent Accept: text/plain purely as a "give me the raw body" signal, which the frontend ignored
  • the llms.txt feature added Accept-based content negotiation that now treats text/plain as a request for the markdown variant, so with labs.llmsTxt enabled these previews received markdown and rendered it as garbled text
  • the previews genuinely want HTML, so they now ask for text/html instead of accidentally opting into markdown content negotiation

Got some code for us? Awesome 🎊!

Please take a minute to explain the change you're making:

  • Why are you making it?
  • What does it do?
  • Why is this something Ghost users or developers need?

Please check your PR against these items:

  • I've read and followed the Contributor Guide
  • I've explained my change
  • I've written an automated test to prove my change works

We appreciate your contribution! 🙏

fixes TryGhost#28265

- the design & branding and announcement bar previews fetch the page,
  read it as text, and re-parse it as HTML into the iframe — they have
  always sent `Accept: text/plain` purely as a "give me the raw body"
  signal, which the frontend ignored
- the llms.txt feature added Accept-based content negotiation that now
  treats `text/plain` as a request for the markdown variant, so with
  labs.llmsTxt enabled these previews received markdown and rendered it
  as garbled text
- the previews genuinely want HTML, so they now ask for `text/html`
  instead of accidentally opting into markdown content negotiation
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f0c6a9fd-84e8-46e1-9788-8bc8681540b1

📥 Commits

Reviewing files that changed from the base of the PR and between 033866e and 028f0ad.

📒 Files selected for processing (3)
  • apps/admin-x-settings/src/components/settings/site/announcement-bar/announcement-bar-preview.tsx
  • apps/admin-x-settings/src/components/settings/site/design-and-branding/theme-preview.tsx
  • apps/admin-x-settings/test/acceptance/site/design.test.ts

Walkthrough

This PR fixes a bug where markdown was being returned in design previews instead of HTML when the llmsTxt feature was enabled. The fix updates the HTTP Accept header from text/plain to text/html in two preview components—announcement bar preview and theme preview—ensuring they request the correct content type. A corresponding acceptance test assertion was added to verify the header is correctly set to text/html.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change - fixing design preview markdown rendering when llms.txt is enabled, which is the primary objective.
Description check ✅ Passed The description clearly explains the root cause, what was changed, and why - directly addressing the llms.txt content negotiation issue affecting previews.
Linked Issues check ✅ Passed The PR successfully addresses issue #28265 by changing the Accept header from text/plain to text/html in both preview components and adding corresponding test assertion.
Out of Scope Changes check ✅ Passed All changes are directly related to the issue objective - updating Accept headers in two preview components and adding test coverage for the fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@9larsons 9larsons merged commit bf01b18 into TryGhost:main May 31, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enabled llms.txt leads to markdown being returned in post preview in design preview

2 participants