ui

package
v1.1.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Layout

type Layout struct {
	// 页面标题
	Title string

	// 文档标题
	DocTitle string

	// 项目名称
	ProjectName string

	// 项目版本
	Version string

	// 基础URL
	BaseURL string

	// 导航项目
	NavItems []NavItem

	// CSS文件列表
	CSSFiles []string

	// JS文件列表
	JSFiles []string

	// 自定义CSS代码
	CustomCSS string

	// 自定义JS代码
	CustomJS string

	// 页脚内容
	Footer string

	// Logo URL
	LogoURL string

	// 是否启用搜索
	EnableSearch bool

	// Google Analytics ID
	GoogleAnalyticsID string

	// 输出目录
	OutputDir string

	// 主题
	Theme string
}

Layout 表示文档UI的布局

func NewLayout

func NewLayout() *Layout

NewLayout 创建新的布局

func (*Layout) AddCSSFile

func (l *Layout) AddCSSFile(file string) *Layout

AddCSSFile 添加CSS文件

func (*Layout) AddJSFile

func (l *Layout) AddJSFile(file string) *Layout

AddJSFile 添加JS文件

func (*Layout) AddNavItem

func (l *Layout) AddNavItem(item NavItem) *Layout

AddNavItem 添加导航项目

func (*Layout) EnableSearchFunction

func (l *Layout) EnableSearchFunction(enable bool) *Layout

EnableSearchFunction 启用搜索功能

func (*Layout) GenerateLayout

func (l *Layout) GenerateLayout() error

GenerateLayout 生成布局文件

func (*Layout) RenderPage

func (l *Layout) RenderPage(content template.HTML, outputPath string) error

RenderPage 渲染页面

func (*Layout) SetBaseURL

func (l *Layout) SetBaseURL(url string) *Layout

SetBaseURL 设置基础URL

func (*Layout) SetCustomCSS

func (l *Layout) SetCustomCSS(css string) *Layout

SetCustomCSS 设置自定义CSS

func (*Layout) SetCustomJS

func (l *Layout) SetCustomJS(js string) *Layout

SetCustomJS 设置自定义JS

func (*Layout) SetDocTitle

func (l *Layout) SetDocTitle(title string) *Layout

SetDocTitle 设置文档标题

func (*Layout) SetFooter

func (l *Layout) SetFooter(footer string) *Layout

SetFooter 设置页脚

func (*Layout) SetGoogleAnalyticsID

func (l *Layout) SetGoogleAnalyticsID(id string) *Layout

SetGoogleAnalyticsID 设置Google Analytics ID

func (*Layout) SetLogoURL

func (l *Layout) SetLogoURL(url string) *Layout

SetLogoURL 设置Logo URL

func (*Layout) SetOutputDir

func (l *Layout) SetOutputDir(dir string) *Layout

SetOutputDir 设置输出目录

func (*Layout) SetProjectName

func (l *Layout) SetProjectName(name string) *Layout

SetProjectName 设置项目名称

func (*Layout) SetTheme

func (l *Layout) SetTheme(theme string) *Layout

SetTheme 设置主题

func (*Layout) SetTitle

func (l *Layout) SetTitle(title string) *Layout

SetTitle 设置页面标题

func (*Layout) SetVersion

func (l *Layout) SetVersion(version string) *Layout

SetVersion 设置版本

type NavItem struct {
	// 项目标题
	Title string

	// 链接URL
	URL string

	// 是否活跃
	Active bool

	// 子项目
	Children []NavItem

	// 图标(可选)
	Icon string

	// 是否展开
	Expanded bool
}

NavItem 表示导航项目

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL