Skip to content

Response

The text of a reply, rendered as Markdown — headings, lists, tables, links — and written as it streams rather than re-rendered at every token.

  • type: 'text'
On this page
Open

The words of a reply are a text segment, or the message’s content when it is plain text. Core has no Markdown dependency: until you install a renderer, it shows the text as it is, escaped, with its line breaks. Two plugins add the formatting: @aparte/plugin-marked renders a finished reply, @aparte/plugin-streaming-markdown renders one while it arrives. Whatever renders it, the HTML goes through core’s sanitizer before it reaches the page.

Open

With the streaming plugin, each chunk is appended to what is already on screen instead of re-parsing the whole reply, so a list grows item by item and **bold is bold before its closing marks arrive. When the turn ends, the reply is rendered once more in full.

Open

The text stays readable and safe; the Markdown marks show as typed.

ts
import { setupMarkedProvider } from '@aparte/plugin-marked';
import { setupStreamingMarkdownProvider } from '@aparte/plugin-streaming-markdown';

setupMarkedProvider(); // a finished reply, in full
setupStreamingMarkdownProvider(); // a reply while it streams

marked is a peer dependency: install it beside the plugins. The streaming plugin brings its parser with it. The Markdown and code guide covers the options.

VariableWhat it sets
--aparte-content-font-sizeThe size of the reply’s text.
--aparte-content-colorIts colour. Inside a message, --aparte-message-content-text-user or -assistant takes over when set.
--aparte-content-line-heightIts line height.

A table takes the width of its columns, and scrolls sideways when it is wider than the reply. To have it fill the column instead, at the cost of the scroll:

css
.aparte-content table { display: table; width: 100%; }

Another parser plugs in with aparteGlobalConfig.setMarkdownProvider(fn), a function from Markdown to HTML. The sanitizer can be replaced with setHtmlSanitizer().

AparteTextSegment, discriminated by type: 'text'.

FieldTypeRequiredDescription
contentstringyes
sourcesAparteSource[]—The sources this text draws on — a web search’s results, the documents it quotes. The bubble lists them under the reply; a places a chip in the text.
citationsAparteCitation[]—Where in content each source is cited: a chip at the end of the passage.
  • Headings, lists, tables and links come out as the HTML elements they are, so a screen reader can move through a long reply by heading or by list.
  • Tables, quotes and inline code are styled by the same prose sheet as the rest of the reply.
  • Code block — a fenced block in a reply.
  • Reasoning — rendered by the same Markdown path.
  • Message — the bubble the text sits in.