For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/sdk/logs/functions/highlightText.md.
  • 简体中文
  • Function: highlightText()

    function highlightText(raw: string, color?: boolean): string;

    Defined in: logs/format.ts:243

    高亮文本中的关键系统词,并剥离 Minecraft 原生的 § 样式颜色代码。

    Parameters

    ParameterTypeDefault valueDescription
    rawstringundefined原始文本字符串。
    colorbooleantrue是否应用 ANSI 颜色进行高亮渲染(默认为 true)。

    Returns

    string

    处理后的文本字符串。