← 返回
内容创作
中文
TOML
Write valid TOML configuration files with correct types and structure.
编写类型和结构正确的有效TOML配置文件。
ivangdavila
内容创作
clawhub
v1.0.0 1 版本 99917.3 Key: 无需
#latest
概述
Strings
- Basic strings
"..." support escapes: \n, \t, \\, \" - Literal strings
'...' are raw—no escape sequences, backslash is literal - Multiline basic
"""...""" allows newlines; leading newline after """ is trimmed - Multiline literal
'''...''' for raw blocks; no escape processing
Keys
- Bare keys: alphanumeric, dash, underscore only—
key-name_1 valid - Quoted keys for special chars:
"key with spaces" or 'key.with.dots' - Dotted keys
a.b.c = 1 equivalent to nested tables—defines [a.b] implicitly - Keys are case-sensitive—
Key and key are different
Tables
[table] defines table; all following key-values belong to it until next header[a.b.c] creates nested structure—parent tables created implicitly- Dotted keys under
[table] extend it: [fruit] then apple.color = "red" works - Defining table after dotted key created it is error—order matters
Arrays of Tables
[[array]] appends new table to array each time it appears[[products]] twice creates products[0] and products[1]- Mix
[array.nested] after [[array]] to add to most recent array element - Cannot redefine static table as array or vice versa
Inline Tables
point = { x = 1, y = 2 } for compact single-line tables- Inline tables cannot span lines (until TOML 1.1)
- Cannot add keys to inline table after definition—immutable once closed
- Nested inline tables allowed but reduce readability
Types
- Integers: decimal, hex
0xDEAD, octal 0o755, binary 0b1010 - Underscores for readability:
1_000_000 is valid - Floats:
3.14, 5e-10, inf, nan (case-sensitive) - Booleans:
true/false only—lowercase, no yes/no/on/off
Dates & Times
- RFC 3339 format:
2024-01-15T14:30:00Z or with offset +05:30 - Local datetime:
2024-01-15T14:30:00 (no timezone) - Local date:
2024-01-15; Local time: 14:30:00 - Milliseconds supported:
14:30:00.123
Common Pitfalls
- No null type—omit key entirely for optional values
- Arrays must be homogeneous (TOML 1.0)—TOML 1.1 allows mixed types
- Trailing commas not allowed in arrays or inline tables
- Comment
# only outside strings—no inline comment after value on same line works, but avoid ambiguity
版本历史
共 1 个版本
-
v1.0.0
当前
2026-03-29 02:16 安全 安全
安全检测
腾讯云安全 (Sanbu)
安全,无风险
查看报告
🔗 相关推荐
ai-intelligence
ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,362
📥 318,920
content-creation
fly0pants
广告情报与应用数据分析助手,支持搜索广告素材、分析应用排名、下载量、收入及市场洞察,用于广告素材和竞品分析。
★ 295
📥 136,558
productivity
ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 440
📥 148,004