# Data-theme-toc="true" 应放在帖子的开头，并独占一段

**URL:** <https://meta.discourse.org/t/data-theme-toc-true-should-be-placed-at-the-top-of-a-post-in-its-own-paragraph/407863>\
**Category:** Feature\
**Tags:** composer, disco-toc\
**Created:** [2026 年7 月 17 日 07:13 UTC](https://meta.discourse.org/t/data-theme-toc-true-should-be-placed-at-the-top-of-a-post-in-its-own-paragraph/407863 "2026-07-17T07:13:50Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![one1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/one1/32/493591_2.png) [@one1](https://meta.discourse.org/u/one1)\
发布日期： [2026 年7 月 17 日 07:13 UTC](https://meta.discourse.org/t/data-theme-toc-true-should-be-placed-at-the-top-of-a-post-in-its-own-paragraph/407863/1 "2026-07-17T07:13:51Z")

</div>

我刚刚提交了[这个错误报告](https://meta.discourse.org/t/text-after-div-tags-does-not-get-rendered-properly/407858)，从解析用户输入的角度来看，编辑器似乎符合规范。

最初的问题出现在用户插入 `<div data-theme-toc="true"> </div>` 代码以触发目录时。作为一名不熟悉 Markdown 规范的用户，他们完全不知道在此 HTML 代码后没有空行会导致渲染问题。

我建议采取以下两项措施：使用编辑器界面中的 (+) 按钮插入此代码时，应

1. 将代码插入到帖子的顶部
2. 在代码后添加一个空行

当然，用户仍可能操作失误，但这可以防止我们遇到的问题。

顺便说一句，这是一个非常棒的组件。极其有用！

---

_[View the full topic](https://meta.discourse.org/t/data-theme-toc-true-should-be-placed-at-the-top-of-a-post-in-its-own-paragraph/407863)._
