Documentation
¶
Overview ¶
Package render is a placeholder for Obsite rendering.
Index ¶
- Variables
- func CountWords(htmlContent string) (latinWords, cjkChars int)
- func EmbeddedTemplateAssetNames() []string
- func EmitRuntimeAssets(outputRoot string) error
- func EmitStyleCSS(outputRoot string, site model.SiteConfig) (bool, error)
- func EmitThemeStaticAssets(outputRoot string, assets []ThemeStaticAsset) error
- func FormatReadingTime(latinWords, cjkChars int) string
- func ReadEmbeddedTemplateAsset(name string) ([]byte, error)
- func RuntimeAssetOutputPaths() []string
- func VisibleSummary(note *model.Note) string
- type FolderPageInput
- type IndexPageInput
- type NotFoundPageInput
- type NotePageInput
- type RenderedPage
- func Render404(input NotFoundPageInput) (RenderedPage, error)
- func RenderFolderPage(input FolderPageInput) (RenderedPage, error)
- func RenderIndex(input IndexPageInput) (RenderedPage, error)
- func RenderNote(input NotePageInput) (RenderedPage, error)
- func RenderTagPage(input TagPageInput) (RenderedPage, error)
- func RenderTimelinePage(input TimelinePageInput) (RenderedPage, error)
- type TagPageInput
- type ThemeStaticAsset
- type TimelinePageInput
Constants ¶
This section is empty.
Variables ¶
var RequiredHTMLTemplateNames = []string{
"base.html",
"note.html",
"index.html",
"tag.html",
"folder.html",
"timeline.html",
"404.html",
}
RequiredHTMLTemplateNames lists the HTML template files every external theme must provide.
Functions ¶
func CountWords ¶
CountWords approximates reading units from visible rendered HTML content. Latin text is counted by whitespace-delimited words and CJK text by characters.
func EmbeddedTemplateAssetNames ¶
func EmbeddedTemplateAssetNames() []string
EmbeddedTemplateAssetNames returns the embedded template asset inventory in stable order.
func EmitRuntimeAssets ¶
EmitRuntimeAssets writes the embedded offline math and Mermaid runtime files into the output root.
func EmitStyleCSS ¶
func EmitStyleCSS(outputRoot string, site model.SiteConfig) (bool, error)
EmitStyleCSS writes the configured stylesheet into the output root. It returns whether style.css was actually written.
func EmitThemeStaticAssets ¶
func EmitThemeStaticAssets(outputRoot string, assets []ThemeStaticAsset) error
EmitThemeStaticAssets copies the provided theme-owned files into the output root.
func FormatReadingTime ¶
FormatReadingTime renders a human-readable reading-time label.
func ReadEmbeddedTemplateAsset ¶
ReadEmbeddedTemplateAsset returns an embedded default template asset.
func RuntimeAssetOutputPaths ¶
func RuntimeAssetOutputPaths() []string
RuntimeAssetOutputPaths returns the output paths reserved for the embedded offline runtime assets.
func VisibleSummary ¶
VisibleSummary derives a fallback summary from a note's normalized visible HTML content.
Types ¶
type FolderPageInput ¶
type FolderPageInput struct {
Site model.SiteConfig
FolderPath string
Children []model.NoteSummary
Breadcrumbs []model.Breadcrumb
LastModified time.Time
RelPath string
Pagination *model.PaginationData
SidebarTree []model.SidebarNode
HasSearch bool
}
FolderPageInput supplies the data needed to render a folder listing page.
type IndexPageInput ¶
type IndexPageInput struct {
Site model.SiteConfig
RecentNotes []model.NoteSummary
LastModified time.Time
RelPath string
Pagination *model.PaginationData
SidebarTree []model.SidebarNode
HasSearch bool
}
IndexPageInput supplies the data needed to render the index page.
type NotFoundPageInput ¶
type NotFoundPageInput struct {
Site model.SiteConfig
RecentNotes []model.NoteSummary
LastModified time.Time
SidebarTree []model.SidebarNode
HasSearch bool
}
NotFoundPageInput supplies the data needed to render the 404 page.
type NotePageInput ¶
type NotePageInput struct {
Site model.SiteConfig
Note *model.Note
Tags []model.TagLink
Backlinks []model.BacklinkEntry
RelatedArticles []model.RelatedArticle
Breadcrumbs []model.Breadcrumb
SidebarTree []model.SidebarNode
HasSearch bool
}
NotePageInput supplies the data needed to render a note page.
type RenderedPage ¶
type RenderedPage struct {
Page model.PageData
HTML []byte
Diagnostics []diag.Diagnostic
}
RenderedPage is the rendered HTML plus the PageData used to execute it.
func Render404 ¶
func Render404(input NotFoundPageInput) (RenderedPage, error)
Render404 renders the default 404 page to HTML using the embedded default templates.
func RenderFolderPage ¶
func RenderFolderPage(input FolderPageInput) (RenderedPage, error)
RenderFolderPage renders a folder listing page to HTML using the embedded default templates.
func RenderIndex ¶
func RenderIndex(input IndexPageInput) (RenderedPage, error)
RenderIndex renders the site index page to HTML using the embedded default templates.
func RenderNote ¶
func RenderNote(input NotePageInput) (RenderedPage, error)
RenderNote renders a note page to HTML using the embedded default templates.
func RenderTagPage ¶
func RenderTagPage(input TagPageInput) (RenderedPage, error)
RenderTagPage renders a tag archive page to HTML using the embedded default templates.
func RenderTimelinePage ¶
func RenderTimelinePage(input TimelinePageInput) (RenderedPage, error)
RenderTimelinePage renders the recent-notes timeline page to HTML using the embedded default templates.
type TagPageInput ¶
type TagPageInput struct {
Site model.SiteConfig
Tag *model.Tag
ChildTags []model.TagLink
Notes []model.NoteSummary
Breadcrumbs []model.Breadcrumb
LastModified time.Time
RelPath string
Pagination *model.PaginationData
SidebarTree []model.SidebarNode
HasSearch bool
}
TagPageInput supplies the data needed to render a tag archive page.
type ThemeStaticAsset ¶
ThemeStaticAsset describes one regular file owned by the selected theme root.
func ListThemeStaticAssets ¶
func ListThemeStaticAssets(themeRoot string) ([]ThemeStaticAsset, error)
ListThemeStaticAssets returns the stable inventory of regular, non-HTML files owned by the selected theme root. Theme-owned HTML is always treated as template input and is never emitted as a static asset.
type TimelinePageInput ¶
type TimelinePageInput struct {
Site model.SiteConfig
TimelinePath string
Notes []model.NoteSummary
LastModified time.Time
AsHomepage bool
RelPath string
Pagination *model.PaginationData
SidebarTree []model.SidebarNode
HasSearch bool
}
TimelinePageInput supplies the data needed to render a recent-notes timeline page.