fluxdown

中文文档
0.14.3发布于 2026/11/04MITTypeScriptESM + CJS构建来源已验证

Streaming Markdown renderer for React AI chat, with syntax repair, smooth output, and customizable components.

原始使用文档
文档目录5 节
  1. Install
  2. Render a message
  3. Make it your own
  4. Documentation
  5. Contributing and license

Fluxdown for React

Streaming Markdown, ready for your React app.

fluxdown renders Markdown with base styles, code highlighting, and copy buttons included. It supports GFM tables, task lists, strikethrough, and autolinks. During generation, it can smooth incoming text, repair unfinished syntax, and fade in trailing characters.

Documentation · Playground · 简体中文

Install

In a React 18 or 19 app:

pnpm add fluxdown

Render a message

import { Fluxdown } from "fluxdown";

type MessageProps = {
  text: string;
  isStreaming: boolean;
};

export function Message({ text, isStreaming }: MessageProps) {
  return <Fluxdown text={text} streaming={isStreaming} />;
}

Pass the full message received so far as text, accumulating chunks in your request handler if necessary. Set isStreaming to false when the request completes, is cancelled, or fails. Fluxdown then shows all received text and stops its streaming effects. Your app handles the request, cancellation, and errors.

For static Markdown, use <Fluxdown text={text} />. In a message list, give each component a stable message ID as its key.

If your bundler does not load the styles automatically, add this to your app's global style entry:

import "fluxdown/styles.css";

Make it your own

OptionPurpose
streamingConfigure trailing syntax repair, smooth output, and optional visual effects.
themeUse the light or dark preset, or override colors, typography, and spacing.
buildEnable syntax such as formulas and footnotes.
pluginsCustomize parsing, rendering, semantic slots, and interactions.
className, styleSet container layout and styling.

streaming={true} enables trailing repair and smooth output. Add an optional visual effect:

<Fluxdown text={text} streaming={isStreaming && { effect: "shad" }} />

Documentation

For a custom renderer outside React, see @fluxdown/core.

Contributing and license

See CONTRIBUTING.md. Licensed under MIT.

版本与发布记录

fluxdown 共发布 25 个版本,首次发布于 2026/09/14;过去 12 个月发布了 25 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.14.3latest2026/11/04今天
0.14.22026/11/022 天前
0.14.12026/10/278 天前
0.14.02026/10/259 天前
0.13.02026/10/2311 天前
0.12.02026/10/2113 天前

其他发布通道:beta → 0.5.2-beta.20260914060133.g70a9205c67e9d58120dce091f2c0f90c52f6fec2.r34811620073.a1。

关于 fluxdown 的常见问题

fluxdown 是什么?

用于React AI聊天的流式Markdown渲染器,具有语法修复,平滑输出和可定制组件。

如何安装 fluxdown?

在项目目录运行 npm install fluxdown,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.0.0 || ^19.0.0)、react-dom(^18.0.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

fluxdown 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

fluxdown 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

fluxdown 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.18.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

fluxdown 可以商用吗?

fluxdown 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

fluxdown 还在维护吗?

最新版本 0.14.3 发布于 2026/11/04(今天);至今共发布 25 个版本,其中过去 12 个月发布了 25 个;首次发布于 2026/09/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。