page

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound indicates that the requested Confluence resource does not exist.

Functions

func AttachmentFilenamesFromStorage

func AttachmentFilenamesFromStorage(storage string) []string

AttachmentFilenamesFromStorage extracts referenced attachment filenames in appearance order.

func ConvertMarkdownToStorage

func ConvertMarkdownToStorage(markdown string) (string, error)

ConvertMarkdownToStorage converts the supported markdown subset to Confluence storage format.

func FormatMarkdownFile

func FormatMarkdownFile(frontmatter Frontmatter, body string) []byte

FormatMarkdownFile renders a markdown file with the required frontmatter.

func SyncAttachmentsFromStorage

func SyncAttachmentsFromStorage(ctx context.Context, client Client, pageID string, markdownPath string, storage string, attachmentSources map[string]string, generatedMermaid map[string]string) error

SyncAttachmentsFromStorage uploads all referenced attachments before page body update.

func WarmUpMermaidRenderer

func WarmUpMermaidRenderer(ctx context.Context)

WarmUpMermaidRenderer primes mmdc once to reduce first render latency in watch mode.

Types

type Client

type Client interface {
	SiteBaseURL() string
	ResolveSpaceIDByKey(ctx context.Context, spaceKey string) (string, error)
	ResolveSpaceRootPage(ctx context.Context, spaceID string) (string, error)
	CreatePage(ctx context.Context, spaceID string, parentID string, title string, body string, draft bool) (Page, error)
	UpdatePage(ctx context.Context, pageID string, title string, body string, draft bool) (Page, error)
	PutAttachment(ctx context.Context, pageID string, filePath string) error
	DeleteAttachment(ctx context.Context, pageID string, filename string) error
}

Client defines the Confluence operations required by the page commands.

type Frontmatter

type Frontmatter struct {
	Title    string
	SpaceKey string
	PageID   string
	ParentID string
	Draft    bool
}

Frontmatter is the required metadata stored in local markdown files.

func ParseMarkdownFile

func ParseMarkdownFile(data []byte) (Frontmatter, string, error)

ParseMarkdownFile parses and validates the required YAML frontmatter.

type MermaidResult added in v0.3.0

type MermaidResult struct {
	Storage   string
	Generated map[string]string
	SaveCache func() error
}

MermaidResult contains mermaid rendering output and generated attachment files.

func ConvertMarkdownToStorageWithMermaid

func ConvertMarkdownToStorageWithMermaid(ctx context.Context, markdownPath string, markdown string) (MermaidResult, error)

ConvertMarkdownToStorageWithMermaid converts markdown to storage format and turns mermaid fenced blocks into attachment image macros.

type Page

type Page struct {
	ID       string
	SpaceID  string
	ParentID string
	Title    string
	Body     string
	URL      string
}

Page is the observable remote state used by the CLI.

type RenderResult added in v0.4.0

type RenderResult struct {
	Storage           string
	AttachmentSources map[string]string
	Warnings          []string
	Generated         map[string]string
	SaveCache         func() error
}

RenderResult is the page-sync preparation output used by the CLI.

func RenderMarkdownForSync added in v0.4.0

func RenderMarkdownForSync(ctx context.Context, markdownPath string, markdown string, siteBaseURL string) (RenderResult, error)

RenderMarkdownForSync prepares markdown for page sync by resolving relative references first and then rendering any mermaid blocks.

Jump to

Keyboard shortcuts

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