Refactor markup package (#32399)

To make the markup package easier to maintain:
1. Split some go files into small files
2. Use a shared util.NopCloser, remove duplicate code
3. Remove unused functions
This commit is contained in:
wxiaoguang 2024-11-04 18:59:50 +08:00 committed by GitHub
parent af28ce59b8
commit 61be51e56b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 1154 additions and 1087 deletions

View file

@ -7,13 +7,19 @@ import (
"fmt"
"net/url"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/translation"
"github.com/yuin/goldmark/ast"
)
func createTOCNode(toc []markup.Header, lang string, detailsAttrs map[string]string) ast.Node {
// Header holds the data about a header.
type Header struct {
Level int
Text string
ID string
}
func createTOCNode(toc []Header, lang string, detailsAttrs map[string]string) ast.Node {
details := NewDetails()
summary := NewSummary()