mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Use markdown frontmatter to provide Table of contents, language and frontmatter rendering (#11047)
* Add control for the rendering of the frontmatter * Add control to include a TOC * Add control to set language - allows control of ToC header and CJK glyph choice. Signed-off-by: Andrew Thornton art27@cantab.net
This commit is contained in:
		@@ -54,13 +54,13 @@ func RenderRaw(body []byte, urlPrefix string, wikiMarkdown bool) []byte {
 | 
			
		||||
						extension.Ellipsis: nil,
 | 
			
		||||
					}),
 | 
			
		||||
				),
 | 
			
		||||
				meta.New(meta.WithTable()),
 | 
			
		||||
				meta.Meta,
 | 
			
		||||
			),
 | 
			
		||||
			goldmark.WithParserOptions(
 | 
			
		||||
				parser.WithAttribute(),
 | 
			
		||||
				parser.WithAutoHeadingID(),
 | 
			
		||||
				parser.WithASTTransformers(
 | 
			
		||||
					util.Prioritized(&GiteaASTTransformer{}, 10000),
 | 
			
		||||
					util.Prioritized(&ASTTransformer{}, 10000),
 | 
			
		||||
				),
 | 
			
		||||
			),
 | 
			
		||||
			goldmark.WithRendererOptions(
 | 
			
		||||
@@ -71,7 +71,7 @@ func RenderRaw(body []byte, urlPrefix string, wikiMarkdown bool) []byte {
 | 
			
		||||
		// Override the original Tasklist renderer!
 | 
			
		||||
		converter.Renderer().AddOptions(
 | 
			
		||||
			renderer.WithNodeRenderers(
 | 
			
		||||
				util.Prioritized(NewTaskCheckBoxHTMLRenderer(), 1000),
 | 
			
		||||
				util.Prioritized(NewHTMLRenderer(), 10),
 | 
			
		||||
			),
 | 
			
		||||
		)
 | 
			
		||||
 | 
			
		||||
@@ -85,7 +85,6 @@ func RenderRaw(body []byte, urlPrefix string, wikiMarkdown bool) []byte {
 | 
			
		||||
	if err := converter.Convert(giteautil.NormalizeEOL(body), &buf, parser.WithContext(pc)); err != nil {
 | 
			
		||||
		log.Error("Unable to render: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return markup.SanitizeReader(&buf).Bytes()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user