Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiki auto-generated TOC is including _Sidebar headers incorrectly positioned #20976

Closed
tepozoa opened this issue Aug 27, 2022 · 1 comment · Fixed by #25460
Closed

Wiki auto-generated TOC is including _Sidebar headers incorrectly positioned #20976

tepozoa opened this issue Aug 27, 2022 · 1 comment · Fixed by #25460
Labels

Comments

@tepozoa
Copy link

tepozoa commented Aug 27, 2022

Description

The new 1.17.x+ Wiki auto-generated TOC is including the headers from _Sidebar.md in a way that's incorrect (or, we should not add them at all?). We could:

  1. Not include _Sidebar.md elements in the auto-generated TOC, or
  2. Include them, but make a new major header in that box named "Sidebar" (same UI as the TOC) so that the included header elements make sense

It presents worse when the Sidebar is using ## or smaller headers, so they're appearing incorrectly indented under an actual TOC entry.

Gitea Version

https://try.gitea.io

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

Demo of issue: https://try.gitea.io/tepozoa/test/wiki/Lorem-Markdownum

Look to "Sidebar Header" and "Sidebar Footer" at the bottom of the TOC, which appear incorrectly as children of "Altissimus clara" which is part of the content on the left.

Git Version

No response

Operating System

No response

How are you running Gitea?

https://try.gitea.io

Database

No response

@tepozoa
Copy link
Author

tepozoa commented Aug 28, 2022

(not a programmer) If I understand the flow in https://github.com/go-gitea/gitea/blob/main/routers/web/repo/wiki.go in a basic sense, it might be as "simple" as moving ctx.Data["toc"] = rctx.TableOfContents from below isSideBar and isFooter conditionals above it, and right below the ctx.Data["EscapeStatus"], ctx.Data["content"], err = renderFn(data) render of the main content so that the TOC renders before the Sidebar/Footer are added to the context? Maybe?

techknowlogick pushed a commit that referenced this issue Jun 23, 2023
Close #20976
Close #20975

1. Fix the bug: the TOC in footer was incorrectly rendered as main
content's TOC
2. Fix the layout: on mobile, the TOC is put above the main content,
while the sidebar is put below the main content
3. Auto collapse the TOC on mobile

ps: many styles of "wiki.css" are moved from old css files, so leave
nits to following PRs.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jun 23, 2023
Close go-gitea#20976
Close go-gitea#20975

1. Fix the bug: the TOC in footer was incorrectly rendered as main
content's TOC
2. Fix the layout: on mobile, the TOC is put above the main content,
while the sidebar is put below the main content
3. Auto collapse the TOC on mobile

ps: many styles of "wiki.css" are moved from old css files, so leave
nits to following PRs.
lunny pushed a commit that referenced this issue Jun 24, 2023
Backport #25460 by @wxiaoguang

Close #20976
Close #20975

1. Fix the bug: the TOC in footer was incorrectly rendered as main
content's TOC
2. Fix the layout: on mobile, the TOC is put above the main content,
while the sidebar is put below the main content
3. Auto collapse the TOC on mobile

ps: many styles of "wiki.css" are moved from old css files, so leave
nits to following PRs.

### for desktop


![image](https://github.com/go-gitea/gitea/assets/2114189/6c84201c-0648-465a-99e6-c53cdaee53c0)

### for mobile


![image](https://github.com/go-gitea/gitea/assets/2114189/9cb4fdfe-b6ab-4e6f-ae82-219ddb8fa27e)

### other changed pages

<details>


![image](https://github.com/go-gitea/gitea/assets/2114189/ef077736-2c3e-4e3d-82fe-d9bf1ebcca98)


![image](https://github.com/go-gitea/gitea/assets/2114189/bb528429-ad5f-4258-a5c4-05f997c624ea)

</details>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant