feat: return content as markdown by default (contentFormat param + CONTENT_FORMAT env var)#63
Merged
Merged
Conversation
Issue #52 — return content as markdown by default with configurable contentFormat param and CONTENT_FORMAT env var. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add parseContentFormat() validator function supporting "markdown" and "html" - Add CONTENT_FORMAT to DEFAULTS with "markdown" as default - Add contentFormat field to config object returned by loadConfig() - Add contentFormat validation in validateConfig() - Update test expectations to include new contentFormat field Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add optional contentFormat field to POST / request body validation. Accepts "markdown" or "html" values, falls back to server config default when omitted. Returns HTTP 400 with descriptive error message listing valid options for invalid values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Import toMarkdown from markdown.js and apply it after DOMPurify sanitization when contentFormat is "markdown". Update existing sanitization and media-tag test assertions to expect markdown output since the default contentFormat is now "markdown". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add documentation for the new markdown output feature: - Document contentFormat request parameter (optional, overrides server default) - Document CONTENT_FORMAT environment variable (server-wide default) - Update example response showing markdown content format - Add breaking change notice for consumers expecting HTML content - Document opt-in paths for HTML output (per-request or server-wide) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
contentresponse field now returns markdown by default instead of sanitized HTML (breaking change — mitigated byCONTENT_FORMAT=htmlenv var)contentFormatrequest body param ("markdown"|"html") lets consumers override the format per-requestCONTENT_FORMATenv var sets the server-wide default (defaults to"markdown")[Video: Provider](url), unknown iframes →[Embedded content](url), video tags →[Video](src)Breaking change
Existing consumers expecting HTML in
contentmust either setCONTENT_FORMAT=html(server-wide) or passcontentFormat: "html"per-request. Documented in README.Test plan
pnpm test— 28/28 pass (default markdown, explicit html, invalid 400, sanitize+convert interaction, GFM tables, env var config)pnpm memory:soak— 100 requests, 0 failuresdocker build -t readability-js .— clean build