梧桐设计语言v0.4.1

代码块CodeBlock

代码、SQL、日志、生成的表结构。muted 底、radius-mdcode 13 / 20 mono、内距 space-3 space-4;顶部一行 meta:语言 / 文件名,右侧复制图标。不做彩色语法高亮——只用 foregroundmuted-foreground 两级(注释、字符串弱化)。


  • 超宽横向滚动,不换行。
  • 行号 subtle,只在超过 10 行时显示。
  • 差异(diff):新增行 success-soft 底、删除行 destructive-soft 底,行首 + / −。
  • 移动端字号不小于 13。

消费者提供:代码、语言、是否显示行号、diff 标记。

示例

import
import { CodeBlock } from "@wutong/ui";

代码与 diff

两级灰不做彩色高亮;+ / − 行标 diff

inspection_record.sql
create table inspection_record (
  id          bigserial primary key,
  device_id   bigint not null,   -- 设备
-  status      text,
+  status      text not null default 'pending',
  handled_at  timestamptz
);

API

属性类型默认说明
code / titlestring代码与顶部标签(语言或文件名)
lineNumbersboolean超过 10 行时开
diffboolean以 + / - 开头的行标色