antv-t8-ntv
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNarrative Text Visualization Skill
叙事文本可视化 Skill
This skill provides a workflow for transforming data into structured narrative text visualizations using T8 Syntax - a declarative Markdown-like language for creating data narratives with semantic entity annotations.
此 skill 提供一套工作流,利用 T8 Syntax——一种声明式、类 Markdown 语言——将数据转换为带语义实体标注的结构化叙事文本可视化。
What is T8
T8 是什么
T8 is a text visualization solution under the AntV technology stack designed specifically for insight-based narrative text display. Instead of manually constructing DOM elements, you write simple, human-readable syntax that describes your data narrative.
Key Features:
- LLM-Friendly: The syntax is intuitive and can be easily generated by AI models
- Declarative & Readable: Write what you want, not how to build it
- Framework Agnostic: Works with React, Vue, or vanilla JavaScript
- Standardized Styling: Professional appearance by default
- Built-in Data Visualizations: Mini charts (pie, line) are native to the syntax
- Lightweight: Less than 20KB before gzip
T8 是 AntV 技术栈下的一种文本可视化解决方案,专为基于洞察的叙事文本展示而设计。你无需手动构建 DOM 元素,只需编写简单、易读的语法来描述数据叙事。
主要特性:
- 适合 LLM 使用:语法直观,易于由 AI 模型生成
- 声明式且易读:只需描述你想要什么,无需关心如何构建
- 框架无关:适用于 React、Vue 或原生 JavaScript
- 标准化样式:默认呈现专业外观
- 内置数据可视化:语法原生支持迷你图表(饼图、折线图)
- 轻量:gzip 压缩前小于 20KB
Workflow
工作流
To generate narrative text visualizations, follow these steps:
要生成叙事文本可视化,请遵循以下步骤:
1. Understand the Requirements
1. 理解需求
Analyze the user's request to determine:
- The topic or data to be analyzed
- The type of narrative needed (report, summary, article)
- The key insights to highlight
- Any specific data sources or metrics
分析用户请求,以确定:
- 待分析的主题或数据
- 所需叙事的类型(报告、摘要、文章)
- 需要突出的关键洞察
- 任何特定的数据来源或指标
2. Generate T8 Syntax Content
2. 生成 T8 Syntax 内容
Create narrative text using T8 Syntax following the specification below. The content must include:
- Proper document structure (headings, paragraphs, lists)
- Entity annotations for all meaningful data points
- Appropriate metadata for entities (origin, assessment, etc.)
按以下规范使用 T8 Syntax 创建叙事文本。内容必须包含:
- 正确的文档结构(标题、段落、列表)
- 为所有有意义的数据点添加实体注释
- 为实体提供适当的元数据(origin、assessment 等)
3. Generate Frontend Code
3. 生成前端代码
Create HTML, React, or Vue code to render the T8 content based on user's preferred framework.
根据用户偏好的框架,创建用于渲染 T8 内容的 HTML、React 或 Vue 代码。
4. Validate Output
4. 验证输出
Ensure:
- All data is from authentic sources
- Minimum content length (800 words or equivalent)
- Proper entity annotations throughout
- Clear structure and logical flow
确保:
- 所有数据均来自真实可靠的来源
- 最低内容长度(800 词或等效内容)
- 恰当的实体注释贯穿全文
- 结构清晰、逻辑流畅
T8 Syntax Specification
T8 Syntax 规范
T8 Syntax is a Markdown-like language for creating narrative text with semantic entity annotations. It makes data analysis reports more expressive and visually appealing.
T8 Syntax 是一种类 Markdown 语言,用于创建带语义实体标注的叙事文本,可让数据分析报告更具表现力与视觉吸引力。
Document Structure
文档结构
Headings (6 levels)
标题(6 个级别)
Use standard Markdown heading syntax:
undefined使用标准 Markdown 标题语法:
undefinedLevel 1 Heading (Main Title)
Level 1 Heading (Main Title)
Level 2 Heading (Section)
Level 2 Heading (Section)
Level 3 Heading (Subsection)
Level 3 Heading (Subsection)
Level 4 Heading
Level 4 Heading
Level 5 Heading
Level 5 Heading
Level 6 Heading
Level 6 Heading
**Rules:**
- Each heading must be on its own line
- Add one space after the `#` symbols
- Headings create visual hierarchy in the rendered output
**规则:**
- 每个标题必须独占一行
- 在 `#` 符号后添加一个空格
- 标题在渲染输出中建立视觉层级Paragraphs
段落
Regular text paragraphs are separated by blank lines:
This is the first paragraph with some content.
This is the second paragraph, separated by a blank line.Rules:
- Paragraphs can span multiple lines
- Use blank lines to separate distinct paragraphs
- Text within a paragraph flows naturally
常规文本段落之间用空行分隔:
This is the first paragraph with some content.
This is the second paragraph, separated by a blank line.规则:
- 段落可以跨多行
- 使用空行分隔不同段落
- 段落内文本自然衔接
Lists
列表
T8 Syntax supports both unordered and ordered lists.
Unordered Lists:
- First item
- Second item
- Third itemOrdered Lists:
1. First step
2. Second step
3. Third stepRules:
- Each list item must be on its own line
- Add one space after the bullet marker (,
-) or number* - Lists can contain entities and text formatting
T8 Syntax 同时支持无序列表和有序列表。
无序列表:
- First item
- Second item
- Third item有序列表:
1. First step
2. Second step
3. Third step规则:
- 每个列表项必须独占一行
- 在项目符号标记(、
-)或数字后添加一个空格* - 列表可以包含实体和文本格式
Text Formatting
文本格式
T8 Syntax supports inline text formatting using Markdown syntax:
Bold Text:
This is **bold text** that stands out.Italic Text:
This is *italic text* for emphasis.Underline Text:
This is __underlined text__ for importance.Links:
Visit [our website](https://example.com) for more information.Rules:
- Formatting markers must be balanced (opening and closing)
- Formatting can be combined with entities
- Links use syntax where URL starts with
[text](URL),http://, orhttps:///
T8 Syntax 支持使用 Markdown 语法进行行内文本格式化:
粗体文本:
This is **bold text** that stands out.斜体文本:
This is *italic text* for emphasis.下划线文本:
This is __underlined text__ for importance.链接:
Visit [our website](https://example.com) for more information.规则:
- 格式标记必须成对出现(开始与结束)
- 可以将格式与实体结合使用
- 链接使用 语法,其中 URL 以
[text](URL)、http://或https://开头/
Entity Annotation Syntax
实体注释语法
The core feature of T8 Syntax is entity annotation - marking specific data points with semantic meaning and metadata.
核心功能是 实体注释——用于标记具有语义含义和元数据的特定数据点。
Basic Entity Syntax
基础实体语法
[displayText](entityType)- : The text shown to readers
displayText - : The semantic type of this entity
entityType
Example:
The [sales revenue](metric_name) reached [¥1.5 million](metric_value) this quarter.[displayText](entityType)- :向读者显示的文本
displayText - :该实体的语义类型
entityType
示例:
The [sales revenue](metric_name) reached [¥1.5 million](metric_value) this quarter.Entity with Metadata
带元数据的实体
[displayText](entityType, key1=value1, key2=value2, key3="string value")Metadata Rules:
- Separate multiple metadata fields with commas
- Numbers and booleans: write directly (e.g., ,
origin=1500000)active=true - Strings: wrap in double quotes (e.g., ,
unit="元")region="Asia"
Example:
Revenue grew by [15.3%](ratio_value, origin=0.153, assessment="positive") compared to last year.[displayText](entityType, key1=value1, key2=value2, key3="string value")元数据规则:
- 使用逗号分隔多个元数据字段
- 数字和布尔值:直接写入(例如,、
origin=1500000)active=true - 字符串:用双引号包裹(例如,、
unit="元")region="Asia"
示例:
Revenue grew by [15.3%](ratio_value, origin=0.153, assessment="positive") compared to last year.Entity Types Reference
实体类型参考
Use these entity types to annotate different kinds of data:
| Entity Type | Description | When to Use | Examples |
|---|---|---|---|
| Name of a metric or KPI | When mentioning what you're measuring | "revenue", "user count", "market share" |
| Primary metric value | The main number/value being reported | "¥1.5 million", "50,000 users", "250 units" |
| Secondary or supporting metric value | Additional metrics that provide context | "average order value: $120" |
| Absolute change/difference | When showing numeric change between periods | "+1,200 units", "-$50K", "increased by 500" |
| Percentage change/rate | When showing percentage change | "+15.3%", "-5.2%", "grew 23%" |
| Contribution percentage | When showing what % something contributes | "accounts for 45%", "represents 30% of total" |
| Trend description | Describing direction/pattern of change | "steadily rising", "declining trend", "stable" |
| Dimensional value/category | Geographic, categorical, or segmentation data | "North America", "Enterprise segment", "Q3" |
| Time period or timestamp | When specifying when something occurred | "Q3 2024", "January-March", "fiscal year 2023" |
| Proportion or ratio | When expressing parts of a whole | "3 out of 5", "60% of customers" |
| Ranking or position | When indicating order or position in a list | "ranked 1st", "top 3", "5th place" |
| Comparative difference | When highlighting difference between two items | "difference of $50K", "gap of 200 units" |
| Unusual or unexpected value | When pointing out outliers or anomalies | "unusual spike", "unexpected drop" |
| Relationship or correlation | When describing connections between metrics | "strongly correlated", "linked to", "related" |
| Data distribution pattern | When describing how data is spread | "evenly distributed", "concentrated in", "spread across" |
| Seasonal pattern or trend | When describing recurring seasonal patterns | "seasonal peak", "holiday period", "Q4 surge" |
使用以下实体类型注释不同种类的数据:
| 实体类型 | 说明 | 使用场景 | 示例 |
|---|---|---|---|
| 指标或 KPI 的名称 | 当提及所衡量的对象时 | “营收”、“用户数”、“市场份额” |
| 主要指标值 | 正在报告的主要数字或数值 | “¥150 万”、“5 万用户”、“250 台” |
| 次要或补充指标值 | 提供上下文的额外指标 | “平均订单价值:$120” |
| 绝对变化或差值 | 展示不同时期之间的数值变化 | “+1,200 台”、“-$50K”、“增加 500” |
| 百分比变化或比率 | 展示百分比变化 | “+15.3%”、“-5.2%”、“增长 23%” |
| 贡献百分比 | 展示某项内容所占的百分比 | “占 45%”、“占总量的 30%” |
| 趋势描述 | 描述变化的方向或模式 | “持续上升”、“呈下降趋势”、“稳定” |
| 维度值或类别 | 地理、分类或细分数据 | “北美”、“企业级细分市场”、“Q3” |
| 时间段或时间戳 | 指定事件发生的时间 | “Q3 2024”、“1—3 月”、“2023 财年” |
| 比例或占比 | 表达整体中的组成部分 | “4 个中有 3 个”、“60% 的客户” |
| 排名或位置 | 表示列表中的顺序或位置 | “排名第 1”、“前 3”、“第 5 名” |
| 比较差异 | 突出显示两个项目之间的差异 | “相差 $50K”、“差距为 200 台” |
| 异常或意外数值 | 指出离群值或异常情况 | “异常峰值”、“意外下跌” |
| 关系或相关性 | 描述指标之间的联系 | “强相关”、“存在关联”、“相关” |
| 数据分布模式 | 描述数据的分散方式 | “分布均匀”、“集中于”、“分散在” |
| 季节性模式或趋势 | 描述反复出现的季节性规律 | “季节性峰值”、“假日期间”、“Q4 激增” |
Common Metadata Fields
常用元数据字段
Add these optional fields to provide richer data context:
添加以下可选字段,以提供更丰富的数据上下文:
origin
(number)
originorigin
(数字)
originThe raw numerical value behind the displayed text.
Examples:
[¥1.5M](metric_value, origin=1500000)[23.7%](ratio_value, origin=0.237)[5.2K users](metric_value, origin=5200)[3 out of 4](proportion, origin=0.75)
Why use it: Enables data visualization, sorting, and calculations
显示文本背后的原始数值。
示例:
[¥1.5M](metric_value, origin=1500000)[23.7%](ratio_value, origin=0.237)[5.2K users](metric_value, origin=5200)[3 out of 4](proportion, origin=0.75)
使用原因:支持数据可视化、排序和计算。
assessment
(string)
assessmentassessment
(字符串)
assessmentEvaluates whether a change is positive, negative, or neutral.
Valid values: , , ,
"positive""negative""equal""neutral"Examples:
[increased 15%](ratio_value, assessment="positive")[dropped 8%](ratio_value, assessment="negative")[remained flat](trend_desc, assessment="equal")
Why use it: Enables visual indicators (colors, icons) for good/bad trends
评估变化是积极、消极还是中性。
有效值: 、、、
"positive""negative""equal""neutral"示例:
[increased 15%](ratio_value, assessment="positive")[dropped 8%](ratio_value, assessment="negative")[remained flat](trend_desc, assessment="equal")
使用原因:支持通过颜色、图标等视觉指标呈现利好或利空趋势。
unit
(string)
unitunit
(字符串)
unitThe unit of measurement for the value.
Examples:
[¥1,500,000](metric_value, unit="元", origin=1500000)[150](metric_value, unit="units")
值的计量单位。
示例:
[¥1,500,000](metric_value, unit="元", origin=1500000)[150](metric_value, unit="units")
detail
(any)
detaildetail
(任意类型)
detailAdditional context or breakdown data for chart rendering. Required for certain entity types.
Required for these entity types:
- : Array of numbers representing ranking data
rank- Example:
[top performer](rank, detail=[5, 8, 12, 15, 20])
- Example:
- : Array of numbers showing comparative values
difference- Example:
[gap narrowing](difference, detail=[100, 80, 60, 40])
- Example:
- : Array of numbers highlighting outliers
anomaly- Example:
[unusual spike](anomaly, detail=[10, 12, 11, 45, 13])
- Example:
- : Array of {x, y} objects for correlation data
association- Example:
[strong correlation](association, detail=[{"x":1,"y":2},{"x":2,"y":4},{"x":3,"y":6}])
- Example:
- : Array of numbers showing data spread
distribution- Example:
[uneven distribution](distribution, detail=[5, 15, 45, 25, 10])
- Example:
- : Object with data array and optional range
seasonality- Example:
[Q4 peak](seasonality, detail={"data":[10,12,15,30],"range":[0,40]})
- Example:
Optional for other types:
[steady growth](trend_desc, detail=[100, 120, 145, 180, 210])
用于图表渲染的额外上下文或明细数据。某些实体类型必须提供此字段。
以下实体类型必须使用:
- :表示排名数据的数字数组
rank- 示例:
[top performer](rank, detail=[5, 8, 12, 15, 20])
- 示例:
- :展示比较值的数字数组
difference- 示例:
[gap narrowing](difference, detail=[100, 80, 60, 40])
- 示例:
- :用于突出显示离群值的数字数组
anomaly- 示例:
[unusual spike](anomaly, detail=[10, 12, 11, 45, 13])
- 示例:
- :用于相关性数据的
association对象数组{x, y}- 示例:
[strong correlation](association, detail=[{"x":1,"y":2},{"x":2,"y":4},{"x":3,"y":6}])
- 示例:
- :展示数据分布情况的数字数组
distribution- 示例:
[uneven distribution](distribution, detail=[5, 15, 45, 25, 10])
- 示例:
- :包含
seasonality数组和可选data的对象range- 示例:
[Q4 peak](seasonality, detail={"data":[10,12,15,30],"range":[0,40]})
- 示例:
其他类型可选:
[steady growth](trend_desc, detail=[100, 120, 145, 180, 210])
Data Requirements
数据要求
Critical: All data must be from publicly authentic sources:
- Official announcements/financial reports
- Authoritative media (Reuters, Bloomberg, TechCrunch, etc.)
- Industry research institutions (IDC, Canalys, Counterpoint Research, etc.)
- Never use fictional, AI-guessed, or simulated data
- Use specific numbers (e.g., "146 million units", "7058 units"), not vague approximations
关键要求:所有数据必须来自公开且真实可靠的来源:
- 官方公告或财务报告
- 权威媒体(Reuters、Bloomberg、TechCrunch 等)
- 行业研究机构(IDC、Canalys、Counterpoint Research 等)
- 绝不使用虚构、AI 猜测或模拟的数据
- 使用具体数字(例如,“1.46 亿台”、“7058 台”),不要使用模糊的近似值
Complete T8 Syntax Example
完整的 T8 Syntax 示例
undefinedundefined2024 Smartphone Market Analysis
2024 Smartphone Market Analysis
Market Overview
Market Overview
Global smartphone shipments reached [1.2 billion units](metric_value, origin=1200000000) in 2024, showing a [modest decline of 2.1%](ratio_value, origin=-0.021, assessment="negative") year-over-year.
The premium segment (devices over $800) showed remarkable [resilience](trend_desc, assessment="positive"), growing by [5.8%](ratio_value, origin=0.058, assessment="positive"). Average selling price was [$420](metric_value, origin=420, unit="USD").
Global smartphone shipments reached [1.2 billion units](metric_value, origin=1200000000) in 2024, showing a [modest decline of 2.1%](ratio_value, origin=-0.021, assessment="negative") year-over-year.
The premium segment (devices over $800) showed remarkable [resilience](trend_desc, assessment="positive"), growing by [5.8%](ratio_value, origin=0.058, assessment="positive"). Average selling price was [$420](metric_value, origin=420, unit="USD").
Key Findings
Key Findings
- Asia-Pacific remains the largest market
- Premium devices showed strong growth
- Budget segment faced headwinds
- Asia-Pacific remains the largest market
- Premium devices showed strong growth
- Budget segment faced headwinds
Regional Breakdown
Regional Breakdown
Asia-Pacific
Asia-Pacific
Asia-Pacific remains the largest market with [680 million units](metric_value, origin=680000000) shipped, though this represents a [decline of 180 million units](delta_value, origin=-180000000, assessment="negative") from the previous year.
Key markets:
- China: [320M units](metric_value, origin=320000000) - down [8.5%](ratio_value, origin=-0.085, assessment="negative"), [ranked 1st](rank, detail=[320, 180, 90, 65, 45]) globally, accounting for [47%](contribute_ratio, origin=0.47, assessment="positive") of regional sales
- India: [180M units](metric_value, origin=180000000) - up [12.3%](ratio_value, origin=0.123, assessment="positive"), [ranked 2nd](rank, detail=[320, 180, 90, 65, 45])
- Southeast Asia: [180M units](metric_value, origin=180000000) - [stable](trend_desc, assessment="equal")
For detailed methodology, visit our research page.
---Asia-Pacific remains the largest market with [680 million units](metric_value, origin=680000000) shipped, though this represents a [decline of 180 million units](delta_value, origin=-180000000, assessment="negative") from the previous year.
Key markets:
- China: [320M units](metric_value, origin=320000000) - down [8.5%](ratio_value, origin=-0.085, assessment="negative"), [ranked 1st](rank, detail=[320, 180, 90, 65, 45]) globally, accounting for [47%](contribute_ratio, origin=0.47, assessment="positive") of regional sales
- India: [180M units](metric_value, origin=180000000) - up [12.3%](ratio_value, origin=0.123, assessment="positive"), [ranked 2nd](rank, detail=[320, 180, 90, 65, 45])
- Southeast Asia: [180M units](metric_value, origin=180000000) - [stable](trend_desc, assessment="equal")
For detailed methodology, visit our research page.
---Using T8 in HTML, React, and Vue
在 HTML、React 和 Vue 中使用 T8
Using in HTML (via CDN)
在 HTML 中使用(通过 CDN)
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>T8 Narrative Text</title>
</head>
<body>
<div id="container"></div>
<!-- Import T8 from unpkg CDN -->
<script src="https://unpkg.com/@antv/t8/dist/t8.min.js"></script>
<script>
// T8 is available as a global variable
const { Text } = window.T8;
// Initialize T8 instance
const text = new Text(document.getElementById('container'));
// Render narrative text using T8 Syntax
const narrativeText = `html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>T8 Narrative Text</title>
</head>
<body>
<div id="container"></div>
<!-- Import T8 from unpkg CDN -->
<script src="https://unpkg.com/@antv/t8/dist/t8.min.js"></script>
<script>
// T8 is available as a global variable
const { Text } = window.T8;
// Initialize T8 instance
const text = new Text(document.getElementById('container'));
// Render narrative text using T8 Syntax
const narrativeText = `Sales Report
Sales Report
This quarter, bookings are higher than usual. They are [¥348k](metric_value, origin=348.12).
Bookings are up [¥180.3k](delta_value, assessment="positive") relative to the same time last quarter.
`;
text.theme('light').render(narrativeText);Installation:
bash
npm install @antv/t8This quarter, bookings are higher than usual. They are [¥348k](metric_value, origin=348.12).
Bookings are up [¥180.3k](delta_value, assessment="positive") relative to the same time last quarter.
`;
text.theme('light').render(narrativeText);安装:
bash
npm install @antv/t8or
or
yarn add @antv/t8
undefinedyarn add @antv/t8
undefinedUsing in React
在 React 中使用
tsx
import { Text } from '@antv/t8';
import { useEffect, useRef } from 'react';
function T8Component() {
const containerRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!containerRef.current) return;
// Initialize T8 instance
const text = new Text(containerRef.current);
// Render narrative text using T8 Syntax
const narrativeText = `tsx
import { Text } from '@antv/t8';
import { useEffect, useRef } from 'react';
function T8Component() {
const containerRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!containerRef.current) return;
// Initialize T8 instance
const text = new Text(containerRef.current);
// Render narrative text using T8 Syntax
const narrativeText = `Sales Report
Sales Report
This quarter, bookings are higher than usual. They are [¥348k](metric_value, origin=348.12).
Bookings are up [¥180.3k](delta_value, assessment="positive") relative to the same time last quarter.
`;
text.theme('light').render(narrativeText);
// Cleanup on unmount
return () => {
text.unmount();
};}, []);
return <div ref={containerRef} />;
}
export default T8Component;
undefinedThis quarter, bookings are higher than usual. They are [¥348k](metric_value, origin=348.12).
Bookings are up [¥180.3k](delta_value, assessment="positive") relative to the same time last quarter.
`;
text.theme('light').render(narrativeText);
// Cleanup on unmount
return () => {
text.unmount();
};}, []);
return <div ref={containerRef} />;
}
export default T8Component;
undefinedUsing in Vue 3
在 Vue 3 中使用
vue
<template>
<div ref="containerRef"></div>
</template>
<script setup lang="ts">
import { Text } from '@antv/t8';
import { ref, onMounted, onBeforeUnmount } from 'vue';
const containerRef = ref<HTMLDivElement>();
let textInstance: Text | null = null;
onMounted(() => {
if (!containerRef.value) return;
// Initialize T8 instance
textInstance = new Text(containerRef.value);
// Render narrative text using T8 Syntax
const narrativeText = `vue
<template>
<div ref="containerRef"></div>
</template>
<script setup lang="ts">
import { Text } from '@antv/t8';
import { ref, onMounted, onBeforeUnmount } from 'vue';
const containerRef = ref<HTMLDivElement>();
let textInstance: Text | null = null;
onMounted(() => {
if (!containerRef.value) return;
// Initialize T8 instance
textInstance = new Text(containerRef.value);
// Render narrative text using T8 Syntax
const narrativeText = `Sales Report
Sales Report
This quarter, bookings are higher than usual. They are [¥348k](metric_value, origin=348.12).
Bookings are up [¥180.3k](delta_value, assessment="positive") relative to the same time last quarter.
`;
textInstance.theme('light').render(narrativeText);
});
onBeforeUnmount(() => {
if (textInstance) {
textInstance.unmount();
}
});
</script>
undefinedThis quarter, bookings are higher than usual. They are [¥348k](metric_value, origin=348.12).
Bookings are up [¥180.3k](delta_value, assessment="positive") relative to the same time last quarter.
`;
textInstance.theme('light').render(narrativeText);
});
onBeforeUnmount(() => {
if (textInstance) {
textInstance.unmount();
}
});
</script>
undefinedUsing in Vue 2
在 Vue 2 中使用
vue
<template>
<div ref="container"></div>
</template>
<script>
import { Text } from '@antv/t8';
export default {
name: 'T8Component',
data() {
return {
textInstance: null,
};
},
mounted() {
// Initialize T8 instance
this.textInstance = new Text(this.$refs.container);
// Render narrative text using T8 Syntax
const narrativeText = `vue
<template>
<div ref="container"></div>
</template>
<script>
import { Text } from '@antv/t8';
export default {
name: 'T8Component',
data() {
return {
textInstance: null,
};
},
mounted() {
// Initialize T8 instance
this.textInstance = new Text(this.$refs.container);
// Render narrative text using T8 Syntax
const narrativeText = `Sales Report
Sales Report
This quarter, bookings are higher than usual. They are [¥348k](metric_value, origin=348.12).
Bookings are up [¥180.3k](delta_value, assessment="positive") relative to the same time last quarter.
`;
this.textInstance.theme('light').render(narrativeText);},
beforeDestroy() {
if (this.textInstance) {
this.textInstance.unmount();
}
},
};
</script>
---This quarter, bookings are higher than usual. They are [¥348k](metric_value, origin=348.12).
Bookings are up [¥180.3k](delta_value, assessment="positive") relative to the same time last quarter.
`;
this.textInstance.theme('light').render(narrativeText);},
beforeDestroy() {
if (this.textInstance) {
this.textInstance.unmount();
}
},
};
</script>
---Writing Guidelines and Best Practices
编写指南与最佳实践
Content Requirements
内容要求
- Minimum Length: No less than 800 words (adjust based on data complexity)
- Structure: Clear hierarchy with logical flow between sections
- Analysis: Don't just list numbers - explain their significance and context
- Tone: Natural, fluent, objective, and professional
- Entity Usage: Annotate ALL meaningful data points - metrics, values, trends, times, changes, percentages
- 最低长度: 不少于 800 词(根据数据复杂度调整)
- 结构: 清晰的层级,章节之间逻辑连贯
- 分析: 不要只罗列数字——应解释其意义和上下文
- 语气: 自然、流畅、客观且专业
- 实体使用: 为所有有意义的数据点添加注释——指标、值、趋势、时间、变化、百分比
Entity Annotation Best Practices
实体注释最佳实践
- Be Comprehensive: Mark all quantitative data, not just major figures
- Use Appropriate Types: Choose the entity type that best describes the semantic meaning
- Add Metadata: Include ,
origin, and other relevant fields when applicableassessment - Natural Flow: Entities should blend seamlessly into readable prose
- 全面: 标记所有定量数据,而不只是主要数字
- 使用适当类型: 选择最能描述语义含义的实体类型
- 添加元数据: 适用时包含 、
origin和其他相关字段assessment - 自然衔接: 实体应无缝融入可读的叙述中
What to Annotate
应注释的内容
✅ DO annotate:
- All numeric values (revenue, counts, measurements)
- All percentages (changes, contributions, proportions)
- Metric names and KPIs
- Time periods
- Geographic regions and categories
- Trend descriptions
- Comparisons and changes
❌ DON'T annotate:
- Generic text without specific data meaning
- Connecting phrases and transitions
- Context that doesn't represent measurable concepts
✅ 应当注释:
- 所有数值(营收、数量、测量值)
- 所有百分比(变化、贡献、占比)
- 指标名称和 KPI
- 时间段
- 地理区域和类别
- 趋势描述
- 比较和变化
❌ 不应注释:
- 不具备具体数据含义的普通文本
- 连接性短语和过渡语
- 不代表可度量概念的上下文
Output Format
输出格式
When generating T8 Syntax content for the user:
- Output the T8 Syntax content directly without wrapping in code blocks
- Provide the frontend code (HTML/React/Vue) based on user preference
- Ensure all entities are properly annotated with appropriate metadata
- Verify that content meets minimum length and quality requirements
The rendered output provides:
- Rich semantic markup for data entities
- Interactive entity highlighting
- Clear visual hierarchy
- Professional report-style formatting
- Responsive design for all devices
生成面向用户的 T8 Syntax 内容时:
- 直接输出 T8 Syntax 内容,不使用代码块包裹
- 根据用户偏好提供前端代码(HTML/React/Vue)
- 确保所有实体均使用适当元数据进行注释
- 验证内容满足最低长度和质量要求
渲染后的输出提供:
- 为数据实体提供丰富的语义标记
- 交互式实体高亮
- 清晰的视觉层级
- 专业的报告式排版
- 适配所有设备的响应式设计
Reference Links
参考链接
- T8 GitHub Repository: https://github.com/antvis/T8
- T8 Documentation: https://github.com/antvis/T8/blob/main/site/en/tutorial/quick-start.md
- T8 Syntax Reference: https://github.com/antvis/T8/blob/main/prompt.md