# 自动生成目录

**URL:** <https://meta.discourse.org/t/automatic-table-of-contents-generation/79626>\
**Category:** Feature\
**Created:** [2018 年2 月 2 日 14:16 UTC](https://meta.discourse.org/t/automatic-table-of-contents-generation/79626 "2018-02-02T14:16:37Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)\
发布日期： [2018 年2 月 2 日 14:16 UTC](https://meta.discourse.org/t/automatic-table-of-contents-generation/79626/1 "2018-02-02T14:16:37Z")

</div>

Has anyone else felt the need more recently to generate tables of contents for a post automatically based on the structure of its headings?

Continuing the discussion from [Spec: Table of Contents](https://meta.discourse.org/t/spec-table-of-contents/32248/16):

> [@Spec: Table of Contents](https://meta.discourse.org/t/spec-table-of-contents/32248/16):
>
> Automatic TOC generation is a difficult problem to solve. There’s more discussion about this in the aforementioned feature topic: [Linking to a heading within a post or topic](https://meta.discourse.org/t/deep-linking-to-headings-anchors/47552)

I looked in the linked topic and don’t really see clearly where automatic generation of a table of contents is covered.

I’m documenting some best practices for some communications our org does which currently lean heavily on Google Docs and benefit from Google Docs built-in ToC generation feature.

There may be an opportunity to move these to Discourse in the future, which would provide a number of other benefits (tagging, better discussion, linking between topics, bumping older topics).

Copy/paste from Google Docs to Discourse works so well now, that I anticipate that will also reduce the switching cost. And for this and many other use cases, I’m already starting to find places where suggesting the workflow, “Author you topic in Google Docs, then paste it into Discourse” makes a lot of sense.

But these docs are sometimes lengthy and it may be hard to let go of the easy ToC creation.

---

_[View the full topic](https://meta.discourse.org/t/automatic-table-of-contents-generation/79626)._
