diff --git a/docs/docs/api.md b/docs/docs/api.md index bbe19d21..85be28ee 100644 --- a/docs/docs/api.md +++ b/docs/docs/api.md @@ -113,7 +113,8 @@ Requires no authorization. // Market attributes. All times are in milliseconds since epoch closeTime?: number // Min of creator's chosen date, and resolutionTime question: string - description: string + description: JSONContent // Rich text content. See https://tiptap.dev/guide/output#option-1-json + textDescription: string // string description without formatting, images, or embeds // A list of tags on each market. Any user can add tags to any market. // This list also includes the predefined categories shown as filters on the home page. diff --git a/web/pages/api/v0/_types.ts b/web/pages/api/v0/_types.ts index 76d2aea2..3248071f 100644 --- a/web/pages/api/v0/_types.ts +++ b/web/pages/api/v0/_types.ts @@ -7,6 +7,7 @@ import { User } from 'common/user' import { removeUndefinedProps } from 'common/util/object' import { ENV_CONFIG } from 'common/envs/constants' import { JSONContent } from '@tiptap/core' +import { richTextToString } from 'common/lib/util/parse' export type LiteMarket = { // Unique identifer for this market @@ -22,6 +23,7 @@ export type LiteMarket = { closeTime?: number question: string description: string | JSONContent + textDescription: string // string version of description tags: string[] url: string outcomeType: string @@ -117,6 +119,10 @@ export function toLiteMarket(contract: Contract): LiteMarket { : closeTime, question, description, + textDescription: + typeof description === 'string' + ? description + : richTextToString(description), tags, url: `https://manifold.markets/${creatorUsername}/${slug}`, pool,