mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 19:06:18 +01:00 
			
		
		
		
	Automatically render wiki TOC (#19873)
Automatically add sidebar in the wiki view containing a TOC for the wiki page. Make the TOC collapsable Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		| @@ -33,18 +33,26 @@ func Init() { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // Header holds the data about a header. | ||||
| type Header struct { | ||||
| 	Level int | ||||
| 	Text  string | ||||
| 	ID    string | ||||
| } | ||||
|  | ||||
| // RenderContext represents a render context | ||||
| type RenderContext struct { | ||||
| 	Ctx           context.Context | ||||
| 	Filename      string | ||||
| 	Type          string | ||||
| 	IsWiki        bool | ||||
| 	URLPrefix     string | ||||
| 	Metas         map[string]string | ||||
| 	DefaultLink   string | ||||
| 	GitRepo       *git.Repository | ||||
| 	ShaExistCache map[string]bool | ||||
| 	cancelFn      func() | ||||
| 	Ctx             context.Context | ||||
| 	Filename        string | ||||
| 	Type            string | ||||
| 	IsWiki          bool | ||||
| 	URLPrefix       string | ||||
| 	Metas           map[string]string | ||||
| 	DefaultLink     string | ||||
| 	GitRepo         *git.Repository | ||||
| 	ShaExistCache   map[string]bool | ||||
| 	cancelFn        func() | ||||
| 	TableOfContents []Header | ||||
| } | ||||
|  | ||||
| // Cancel runs any cleanup functions that have been registered for this Ctx | ||||
|   | ||||
		Reference in New Issue
	
	Block a user