#2375·cobra

错误: MDX 编译失败 - 预期是一个结尾标签

作者: ribiza创建于 2026年3月30日更新于 2026年9月26日

使用如下命令:go var cmd = &cobra.Command{ Use: "export [-c --collections | -p --pretty | -f --format] <output_path>", Short: "Export the database", Long: "Export the database to a file. If a file exists at the <output_path> location, it will be overwritten.", } 结果为以下 Markdown:Export the database to a file. If a file exists at the <output_path> location, it will be overwritten. Markdown 编译失败,错误为:Error: MDX 编译失败,文件为 "xxx" 原因:在 `paragraph` 结束之前,期望有 <output_path> 的闭合标签 (7:56-7:69) 详细信息: { "column": 1, "file": "", "message": "Expected a closing tag for `<output_path>` (7:56-7:69) before the end of `paragraph`", "line": 7, "name": "7:1-7:103", "place": { "start": { "_bufferIndex": 0, "_index": 0, "line": 7, "column": 1, "offset": 78 }, "end": { "_bufferIndex": -1, "_index": 1, "line": 7, "column": 103, "offset": 180 } }, "reason": "Expected a closing tag for `<output_path>` (7:56-7:69) before the end of `paragraph`", "ruleId": "end-tag-mismatch", "source": "mdast-util-mdx-jsx" } Markdown 编译成功,如下:Export the database to a file. If a file exists at the \<output_path> location, it will be overwritten. 是否应该让 cobra 自动对这些出现的 < 进行转义?