Rails 8.1 introduces native markdown rendering support, adding `format.md` to `respond_to` blocks and a `to_markdown` convention for objects — mirroring existing `to_json` and `to_xml` patterns. Controllers can now serve markdown responses via Accept headers, URL extensions, or format parameters without manual MIME type registration. The feature targets use cases like serving AI-generated content, documentation APIs, and export functionality, with full content negotiation handled automatically by Rails.

3m read timeFrom blog.saeloun.com
Post cover image
Table of contents
IntroductionBeforeAfterThe to_markdown ConventionRendering OptionsUse CasesContent NegotiationCombining with ViewsTestingConclusionReferences

Sort: