# Disco TOC for replies

**URL:** https://meta.discourse.org/t/disco-toc-for-replies/217885
**Category:** Feature
**Tags:** completed, disco-toc
**Created:** [February 11, 2022, 2:29pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885 "2022-02-11T14:29:22Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![ganncamp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ganncamp/32/106199_2.png) [@ganncamp](https://meta.discourse.org/u/ganncamp)
#### Post date: [February 11, 2022, 2:29pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/1 "2022-02-11T14:29:23Z")

</div>

Since Disco TOC is one of the theme components in the default list, I’m assuming this is an appropriate place to make a feature request.

It currently only works for the OP. I’d like to be able to add a TOC to a reply. Why?

When we do a webinar, we’ll announce it to the community with a post. After the webinar, we follow up with a reply in the same topic that contains the link to the recording and answers to all the questions that were asked during the webinar. We do this partly as a way to cover all the questions we couldn’t get to during the live session.

Those followup posts tend to get long and are typically sub-categorized by broad topic - perfect for a TOC (& actually the reason I installed the component).

Previously I’ve manually (and painfully) created a static TOC at the top of the reply post, but of course, once you’ve scrolled past it to the content, it’s no longer useful. Having the Disco TOC float alongside the content would be wonderful!

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [February 11, 2022, 2:43pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/2 "2022-02-11T14:43:30Z")

</div>

Interesting use case! I’ve done this in the past before too. Not sure if this will work in your case, but what we ended up doing is editing the first post to add the notes at the bottom, then replying to let everyone know about the edit. That way everything is neatly organized in the first post for posterity.

---

<div class="post-metadata">

### Author: ![ganncamp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ganncamp/32/106199_2.png) [@ganncamp](https://meta.discourse.org/u/ganncamp)
#### Post date: [February 11, 2022, 2:44pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/3 "2022-02-11T14:44:18Z")

</div>

Perhaps its my long-ago days as a journalist, but I tend to be leery of editing history…

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [February 11, 2022, 2:50pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/4 "2022-02-11T14:50:58Z")

</div>

Yes, I totally get that. 🙂 But it can be useful for the long term, and Discourse provides the edit history for those who want full transparency. Here’s an example of a topic that we rewrote after a webinar, back when I was working for Namati. We even changed the language to be past tense, so a summary of the webinar and no longer an announcement. And removed all the logistical details on how to join and so on, because no longer relevant.

[https://community.namati.org/t/webinar-key-learnings-from-institutionalizing-the-paralegal-profession-may-31-2017/36410](https://community.namati.org/t/webinar-key-learnings-from-institutionalizing-the-paralegal-profession-may-31-2017/36410)

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [November 19, 2022, 12:44pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/5 "2022-11-19T12:44:58Z")

</div>

> Update: The changes in this fork have been merged upstream, please use the official theme components instead

> [@Disco TOC for replies](https://meta.discourse.org/t/disco-toc-for-replies/217885):
>
> Since Disco TOC is one of the theme components in the default list, I’m assuming this is an appropriate place to make a feature request. It currently only works for the OP. I’d like to be able to add a TOC to a reply. Why? When we do a webinar, we’ll announce it to the community with a post. After the webinar, we follow up with a reply in the same topic that contains the link to the recording and answers to all the questions that were asked during the webinar. We do this partly as a way to cov…

For anyone who wants to apply DiscoTOC in their replies, I did this part of the work in my own fork!  
Now it can apply TOC to any post and it works fine, just like it does on the OP.  
It seems that the official team doesn’t think it’s necessary to apply DiscoTOC in the replies, so I won’t open a pull request. But you can use my modified version!

[https://github.com/Lhcfl/DiscoTOC-edited](https://github.com/Lhcfl/DiscoTOC-edited)

---

<div class="post-metadata">

### Author: ![krystal](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@krystal](https://meta.discourse.org/u/krystal)
#### Post date: [June 2, 2023, 4:12pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/6 "2023-06-02T16:12:17Z")

</div>

TOC in the replies - yes please!!

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 22, 2023, 1:26pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/7 "2023-08-22T13:26:27Z")

</div>

A TOC for reply posts is possible - see here for the very out-of-the-box method.

> [@I created a bookmarklet to create the table of content for forum posts](https://meta.discourse.org/t/i-created-a-bookmarklet-to-create-the-table-of-content-for-forum-posts/270961):
>
> play_button Table of contents: I created a bookmarklet to generate a foldable table of contents (ToC) like the one shown above. I hope it helps avid community members who write long texts! Summary I sometimes write long topics/posts and needed a ToC for easier reading. I found some existing work, such as [DiscoTOC - automatic table of contents](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143), but I needed a tool just for me, not needing to install something across the community. After publishing a structured post, click the bookmarklet, and the ToC wi…

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [August 22, 2023, 1:36pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/8 "2023-08-22T13:36:15Z")

</div>

For me as heavy iPad/iPhone user that solution is more like closed-in-box 😜

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 22, 2023, 1:38pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/9 "2023-08-22T13:38:40Z")

</div>

hmmm, 🤔 I’m using an iPad Air with Safari iOS 16.6 and it works as expected and the same as Chrome. 🤷🏻‍♀️

---

<div class="post-metadata">

### Author: ![dmitry\_fedyuk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_fedyuk/32/293153_2.png) [@dmitry\_fedyuk](https://meta.discourse.org/u/dmitry_fedyuk)
#### Post date: [January 8, 2024, 2:35pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/10 "2024-01-08T14:35:55Z")

</div>

`Lhcfl/DiscoTOC-edited` throws the error «Uncaught TypeError: **((intermediate value) || this[e]) is not a function**» on inserting a table of contents.  
Discourse **3.2.0.beta4-dev**.

 ![2024-01-08--17-32-45](https://global.discourse-cdn.com/meta/original/4X/9/9/0/9906e9648b3be082937cd55636ff736dcddde3a0.png)

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [January 13, 2024, 3:18am UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/11 "2024-01-13T03:18:27Z")

</div>

Oh, I‘ll look into it.

* * *

This is an automatic merge error that occurred when I synchronized with the upstream. Now I have fixed it.

---

<div class="post-metadata">

### Author: ![fbpbdmin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fbpbdmin/32/300893_2.png) [@fbpbdmin](https://meta.discourse.org/u/fbpbdmin)
#### Post date: [May 7, 2024, 10:20pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/12 "2024-05-07T22:20:01Z")

</div>

hey @Lhc_fl

tried this fork, it is nice…  
but seems, need to add this line to each posts/replies ?

```plaintext
<div data-theme-toc="true"> </div>

```

I already added all categories to the setting: `auto TOC categories`  
seems this fork does not honor this setting ?

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [July 24, 2024, 3:28am UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/13 "2024-07-24T03:28:58Z")

</div>

> [@Lhc\_fl](#):
>
> It seems that the official team doesn’t think it’s necessary to apply DiscoTOC in the replies, so I won’t open a pull request. But you can use my modified version!

Would you be open to revisiting this? It would be great to have it as part of the officially maintained repo. And it wouldn’t / shouldn’t add any issues or instability.

My use-case is meetings, where we use an Event as the OP, and the minutes go in a new post somewhere below it. It would be great to have TOC available to be applied to minutes.

> [@fbpbdmin](#):
>
> I already added all categories to the setting: `auto TOC categories`  
> seems this fork does not honor this setting ?

I would not want it to apply to all posts - that would get unpleasantly busy very fast!!!

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [July 25, 2024, 11:02am UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/14 "2024-07-25T11:02:38Z")

</div>

> [@nathank](#):
>
> Would you be open to revisiting this? It would be great to have it as part of the officially maintained repo. And it wouldn’t / shouldn’t add any issues or instability.

I think with at least four users here in this topic and also sharing the use case, it’s worth it to reconsider.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [August 7, 2024, 8:02am UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/21 "2024-08-07T08:02:35Z")

</div>

![image](https://global.discourse-cdn.com/meta/original/4X/f/8/0/f8073c99b1d0150e46bcf86663280e0053a6d3bf.png)

For those who care about applying TOC to replies - The ability to apply TOC to replies has been merged into the official component. It is a setting that is off by default.

[https://github.com/discourse/DiscoTOC/pull/90](https://github.com/discourse/DiscoTOC/pull/90)

---

<div class="post-metadata">

### Author: ![ganncamp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ganncamp/32/106199_2.png) [@ganncamp](https://meta.discourse.org/u/ganncamp)
#### Post date: [August 7, 2024, 12:14pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/22 "2024-08-07T12:14:37Z")

</div>

Looking forward to seeing this deployed on my site. 😇

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [August 7, 2024, 12:20pm UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/23 "2024-08-07T12:20:06Z")

</div>

As this is a theme component, you should be able to update it from your `/admin/customize/components` page. 🤞

Though if you encounter any issues let me know and we can smooth anything out. 🙂

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 8, 2024, 8:27am UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/24 "2024-08-08T08:27:33Z")

</div>

This works fantastic - great job Linca! 💜

Using this on my local instance and it’s great. Thank you! Now I don’t have to make new topics in my notebook when I want a TOC for a post! 🤗

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [August 9, 2024, 3:33am UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/25 "2024-08-09T03:33:26Z")

</div>

> [@nathank](#):
>
> I would not want it to apply to all posts - that would get unpleasantly busy very fast!!!

After using the new functionality a bit (bravo by the way!), I was wrong about this - as you can specify how many headings before a TOC is activated, it simply isn’t a problem.

However, inserting the TOC code is quite a pain.

> [@Lhc\_fl](#):
>
> ![image](https://global.discourse-cdn.com/meta/original/4X/f/8/0/f8073c99b1d0150e46bcf86663280e0053a6d3bf.png)
> 
> image886×164 9.84 KB

Would you be open to changing this so that with auto specified categories and tags reply TOCs are also turned on? Or making that an option?

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [August 9, 2024, 6:09am UTC](https://meta.discourse.org/t/disco-toc-for-replies/217885/26 "2024-08-09T06:09:09Z")

</div>

> [@nathank](#):
>
> However, inserting the TOC code is quite a pain

How do you insert it? For me, clicking a button in the composer isn’t that complicated.

[Next page](https://meta.discourse.org/t/disco-toc-for-replies/217885.md?page=2)
