:TOC: label in "org mode" readme files should be hidden #6556

Closed
opened 2025-11-02 06:59:14 -06:00 by GiteaMirror · 16 comments
Owner

Originally created by @finex on GitHub (Dec 20, 2020).

  • Gitea version (or commit ref): 1.13.0

  • Git version: 2.11.0

  • Operating system: Debian (official gitea docker image)

  • Database (use [x]):

    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite

Description

I've created a README.org file using Emacs org mode. The file is something like:

#TITLE: file title

* Table of contents :TOC:
- [[#title][Title]]

* Title
Lorem ipsum...

Usually github/gitlab doesn't show the :TOC: attribute, which is used by Emacs to regenerate the table of contents on save.

Screenshots

Actual result:

image

Desidered behaviour:

image

Extra issues

I've found other two "bugs", the first is that if the README already has a TOC, gitea shouldn't render his own index. The second is that the anchors generated using org mode doesn't works. Should I open two separate issues for this two bug?

Thank you.

Originally created by @finex on GitHub (Dec 20, 2020). - Gitea version (or commit ref): 1.13.0 - Git version: 2.11.0 - Operating system: Debian (official gitea **docker** image) - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [X] SQLite ## Description I've created a `README.org` file using Emacs org mode. The file is something like: ``` #TITLE: file title * Table of contents :TOC: - [[#title][Title]] * Title Lorem ipsum... ``` Usually github/gitlab doesn't show the `:TOC:` attribute, which is used by Emacs to regenerate the table of contents on save. ## Screenshots ### Actual result: ![image](https://user-images.githubusercontent.com/287009/102715090-cfad4c00-42ca-11eb-9bee-ede45ef7aede.png) ### Desidered behaviour: ![image](https://user-images.githubusercontent.com/287009/102715100-e489df80-42ca-11eb-8677-3055d01b6f7c.png) # Extra issues I've found other two "bugs", the first is that if the README already has a TOC, gitea shouldn't render his own index. The second is that the anchors generated using org mode doesn't works. Should I open two separate issues for this two bug? Thank you.
GiteaMirror added the type/upstream label 2025-11-02 06:59:14 -06:00
Author
Owner

@a1012112796 commented on GitHub (Dec 20, 2020):

@finex because gitea not support this format now, it consider this file as an simple markdown file.
related issue :#12832. Thanks.

@a1012112796 commented on GitHub (Dec 20, 2020): @finex because gitea not support this format now, it consider this file as an simple markdown file. related issue :#12832. Thanks.
Author
Owner

@lunny commented on GitHub (Dec 20, 2020):

@a1012112796 In fact, we support org-mod on git files but not wikis. This should be a problem of upstream library which Gitea depends on.

@lunny commented on GitHub (Dec 20, 2020): @a1012112796 In fact, we support org-mod on git files but not wikis. This should be a problem of upstream library which Gitea depends on.
Author
Owner

@a1012112796 commented on GitHub (Dec 20, 2020):

ok, I see, I will check it and send issue to upstream repo.

@a1012112796 commented on GitHub (Dec 20, 2020): ok, I see, I will check it and send issue to upstream repo.
Author
Owner

@finex commented on GitHub (Dec 21, 2020):

Thanks!

@finex commented on GitHub (Dec 21, 2020): Thanks!
Author
Owner

@niklasfasching commented on GitHub (Jan 2, 2021):

Usually github/gitlab doesn't show the :TOC: attribute, which is used by Emacs to regenerate the table of contents on save.

I couldn't find anything on the :TOC: label in the org mode docs and haven't seen it before. Could you link me to documentation / example markup that modifies the TOC html in emacs org export? In my tests emacs just ignores it.

(Assuming :TOC: is just a normal tag - i.e. no reason to modify go-org) gitea can modify display of tags using css span.tags { ... }

See my comment in https://github.com/niklasfasching/go-org/issues/44#issuecomment-748925565

@niklasfasching commented on GitHub (Jan 2, 2021): > Usually github/gitlab doesn't show the :TOC: attribute, which is used by Emacs to regenerate the table of contents on save. I couldn't find anything on the `:TOC:` label in the [org mode docs](https://orgmode.org/manual/Table-of-Contents.html) and haven't seen it before. Could you link me to documentation / example markup that modifies the TOC html in emacs org export? In my tests emacs just ignores it. (Assuming `:TOC:` is just a normal tag - i.e. no reason to modify `go-org`) gitea can modify display of tags using css `span.tags { ... }` See my comment in https://github.com/niklasfasching/go-org/issues/44#issuecomment-748925565
Author
Owner

@finex commented on GitHub (Jan 2, 2021):

Hi, you're right, I was using Doom Emacs and I didn't know (until now) that this feature is not default but it's from the following package installed by Doom: https://github.com/snosov1/toc-org

@finex commented on GitHub (Jan 2, 2021): Hi, you're right, I was using Doom Emacs and I didn't know (until now) that this feature is not default but it's from the following package installed by Doom: https://github.com/snosov1/toc-org
Author
Owner

@niklasfasching commented on GitHub (Jan 2, 2021):

thx.
as org mode supports positioning the toc using #+TOC I'd opt for implementing that - that would also get rid of the default toc. Fixing the links is up to gitea - they work in raw go-org output.

Would that solve your problem? No promises, would have to check if this is as low hanging fruit as I'm expecting.

@niklasfasching commented on GitHub (Jan 2, 2021): thx. as org mode supports positioning the toc using `#+TOC` I'd opt for implementing that - that would also get rid of the default toc. Fixing the links is up to gitea - they work in raw go-org output. Would that solve your problem? No promises, would have to check if this is as low hanging fruit as I'm expecting.
Author
Owner

@finex commented on GitHub (Feb 23, 2021):

Hi, yes, it should be good :-)

@finex commented on GitHub (Feb 23, 2021): Hi, yes, it should be good :-)
Author
Owner

@niklasfasching commented on GitHub (Mar 28, 2021):

7c239a7aeb
go-org now supports #+TOC: headlines $n - $n being the max headline lvl to include (0 being all).
The default toc has to be disabled manually (#+OPTIONS: toc:nil) as that's the way org mode does it. See #keywords examples (you probably have to scroll the html output to see the toc)

@niklasfasching commented on GitHub (Mar 28, 2021): https://github.com/niklasfasching/go-org/commit/7c239a7aeb26a3de2027838d31d22d60828ce17e go-org now supports `#+TOC: headlines $n` - `$n` being the max headline lvl to include (0 being all). The default toc has to be disabled manually (`#+OPTIONS: toc:nil`) as that's the way org mode [does it](https://orgmode.org/manual/Table-of-Contents.html). See [#keywords examples](https://niklasfasching.github.io/go-org/#keywords.org) (you probably have to scroll the html output to see the toc)
Author
Owner

@finex commented on GitHub (Mar 29, 2021):

Thank you 😄

@finex commented on GitHub (Mar 29, 2021): Thank you :smile:
Author
Owner

@lunny commented on GitHub (Mar 31, 2021):

Once go-org released, we can upgrade the vendor.

@lunny commented on GitHub (Mar 31, 2021): Once go-org released, we can upgrade the vendor.
Author
Owner

@braoult commented on GitHub (Feb 19, 2022):

There are many reasons to upgrade go-org, many features supported here are not in gitea (VERSE and EXPORT blocks, TODO separate class, ATTR_HTML, etc...).

@braoult commented on GitHub (Feb 19, 2022): There are many reasons to upgrade go-org, many features supported [here](https://niklasfasching.github.io/go-org/) are not in gitea (VERSE and EXPORT blocks, TODO separate class, ATTR_HTML, etc...).
Author
Owner

@zeripath commented on GitHub (Feb 19, 2022):

#18824 could be backported to 1.16 - but users of org should confirm that it doesn't cause regressions.

@zeripath commented on GitHub (Feb 19, 2022): #18824 could be backported to 1.16 - but users of org should confirm that it doesn't cause regressions.
Author
Owner

@braoult commented on GitHub (Feb 19, 2022):

#18824 could be backported to 1.16 - but users of org should confirm that it doesn't cause regressions.

I can confirm that on go-org test page (https://niklasfasching.github.io/go-org/)

#+TITLE: file title

* Table of contents :TOC:
- [[#title][Title]]

* Title
Lorem ipsum...

Gives the expected result:
Screenshot_2022-02-19_16-43-15

@braoult commented on GitHub (Feb 19, 2022): > #18824 could be backported to 1.16 - but users of org should confirm that it doesn't cause regressions. I can confirm that on go-org test page (https://niklasfasching.github.io/go-org/) ``` #+TITLE: file title * Table of contents :TOC: - [[#title][Title]] * Title Lorem ipsum... ``` Gives the expected result: ![Screenshot_2022-02-19_16-43-15](https://user-images.githubusercontent.com/8958429/154807989-bfe58690-824d-4021-a603-6bb3e422776f.png)
Author
Owner

@zeripath commented on GitHub (Feb 19, 2022):

This was not what I meant. I meant testing #18824, either once it is in or by downloading 18824 and building and/or download the gitea 1.16 source code, and run:

go get -d github.com/niklasfasching/go-org
make vendor
make

to then test gitea to see if there were significant downgrade

@zeripath commented on GitHub (Feb 19, 2022): This was not what I meant. I meant testing #18824, either once it is in or by downloading 18824 and building and/or download the gitea 1.16 source code, and run: ``` go get -d github.com/niklasfasching/go-org make vendor make ``` to then test gitea to see if there were significant downgrade
Author
Owner

@braoult commented on GitHub (Feb 19, 2022):

This was not what I meant. I meant testing #18824, either once it is in or by downloading 18824 and building and/or download the gitea 1.16 source code, and run:

I tried to compile, but there too many dependencies, I am afraid to break something here if I upgrade stuff like npm. What do you mean by once it is in ? Is there a place where I could download a gitea binary version (linux/x86_64 or linux/armv7l) with #18824 patch ?

@braoult commented on GitHub (Feb 19, 2022): > This was not what I meant. I meant testing #18824, either once it is in or by downloading 18824 and building and/or download the gitea 1.16 source code, and run: I tried to compile, but there too many dependencies, I am afraid to break something here if I upgrade stuff like npm. What do you mean by `once it is in` ? Is there a place where I could download a gitea binary version (linux/x86_64 or linux/armv7l) with #18824 patch ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6556