xmind

package
v0.0.0-...-828955f Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package xmind defines types for XMind content.json and zip I/O.

Index

Constants

This section is empty.

Variables

View Source
var DefaultTheme json.RawMessage

DefaultTheme is the standard XMind theme applied to every new sheet. It is sourced from the kitchen-sink fixture (skeletonThemeId db4a5df4…, colorThemeId Rainbow-#000229-MULTI_LINE_COLORS) and matches what the XMind app writes when creating a new map with the default theme.

Functions

func CreateNewMap

func CreateNewMap(path string, sheets []Sheet) error

CreateNewMap writes a new .xmind zip with content.json, metadata.json, manifest.json, and the standard XMind compatibility content.xml stub.

func DefaultSheetExtensions

func DefaultSheetExtensions(structureClass string) json.RawMessage

DefaultSheetExtensions returns the standard org.xmind.ui.skeleton.structure.style extension block for a new sheet, referencing structureClass as the centralTopic layout.

func WriteMap

func WriteMap(path string, sheets []Sheet) error

WriteMap replaces content.json in an existing .xmind zip, preserving all other entries via raw compressed-byte copy (OpenRaw / CreateRaw).

Types

type AttributedTitleItem

type AttributedTitleItem struct {
	Text string `json:"text"`
	// contains filtered or unexported fields
}

AttributedTitleItem is one run of text in an attributed (rich-link) topic title. XMind uses this to store the human-readable label for a topic that has an href. Treat as opaque: preserve on round-trip, never write from handler logic.

func (*AttributedTitleItem) MarshalJSON

func (a *AttributedTitleItem) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*AttributedTitleItem) UnmarshalJSON

func (a *AttributedTitleItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Boundary

type Boundary struct {
	ID    string `json:"id"`
	Range string `json:"range"`
	Title string `json:"title,omitempty"`
	// contains filtered or unexported fields
}

Boundary groups children visually.

func (*Boundary) MarshalJSON

func (b *Boundary) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Boundary) UnmarshalJSON

func (b *Boundary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Children

type Children struct {
	Attached []Topic `json:"attached,omitempty"`
	Detached []Topic `json:"detached,omitempty"`
	Summary  []Topic `json:"summary,omitempty"`
	// contains filtered or unexported fields
}

Children holds attached, detached, and summary topics.

func (*Children) MarshalJSON

func (c *Children) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Children) UnmarshalJSON

func (c *Children) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Extension

type Extension struct {
	Provider     string   `json:"provider"`
	Content      any      `json:"content,omitempty"`
	ResourceRefs []string `json:"resourceRefs,omitempty"`
}

Extension is task/audio/math metadata on a topic.

type Marker

type Marker struct {
	MarkerID string `json:"markerId"`
	// contains filtered or unexported fields
}

Marker is a topic marker reference.

func (*Marker) MarshalJSON

func (m *Marker) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Marker) UnmarshalJSON

func (m *Marker) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type NoteContent

type NoteContent struct {
	Content string `json:"content"`
}

NoteContent wraps note body.

type Notes

type Notes struct {
	Plain    *NoteContent `json:"plain,omitempty"`
	RealHTML *NoteContent `json:"realHTML,omitempty"`
}

Notes holds plain and HTML note content. Either or both of Plain and RealHTML may be set; omitted keys are not reintroduced on marshal.

type Position

type Position struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	// contains filtered or unexported fields
}

Position is used for floating (detached) topics.

func (*Position) MarshalJSON

func (p *Position) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Position) UnmarshalJSON

func (p *Position) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Relationship

type Relationship struct {
	ID            string              `json:"id"`
	End1ID        string              `json:"end1Id"`
	End2ID        string              `json:"end2Id"`
	Title         string              `json:"title,omitempty"`
	ControlPoints map[string]Position `json:"controlPoints,omitempty"`
	// contains filtered or unexported fields
}

Relationship connects two topics at sheet level.

func (*Relationship) MarshalJSON

func (r *Relationship) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Relationship) UnmarshalJSON

func (r *Relationship) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Sheet

type Sheet struct {
	ID               string          `json:"id"`
	RevisionID       string          `json:"revisionId"`
	Class            string          `json:"class"`
	Title            string          `json:"title"`
	TopicOverlapping string          `json:"topicOverlapping,omitempty"`
	RootTopic        Topic           `json:"rootTopic"`
	Relationships    []Relationship  `json:"relationships,omitempty"`
	Extensions       json.RawMessage `json:"extensions,omitempty"`
	Theme            json.RawMessage `json:"theme,omitempty"`
	LabelSortOrder   string          `json:"labelSortOrder,omitempty"`
	// contains filtered or unexported fields
}

Sheet is one tab/sheet in a workbook.

func ReadMap

func ReadMap(path string) ([]Sheet, error)

ReadMap opens a .xmind zip, reads content.json, and unmarshals it into sheets.

func (*Sheet) MarshalJSON

func (s *Sheet) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Sheet) UnmarshalJSON

func (s *Sheet) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Summary

type Summary struct {
	ID      string `json:"id"`
	Range   string `json:"range"`
	TopicID string `json:"topicId"`
	// contains filtered or unexported fields
}

Summary is a range descriptor on a parent topic (Topic.Summaries).

func (*Summary) MarshalJSON

func (s *Summary) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Summary) UnmarshalJSON

func (s *Summary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Topic

type Topic struct {
	ID            string `json:"id"`
	Class         string `json:"class,omitempty"`
	Title         string `json:"title,omitempty"`
	TitleUnedited bool   `json:"titleUnedited,omitempty"`
	// AttributedTitle holds the display-only label shown when the topic has a link href.
	// XMind writes this field; we preserve it on round-trip but never generate it ourselves.
	AttributedTitle []AttributedTitleItem `json:"attributedTitle,omitempty"`
	StructureClass  string                `json:"structureClass,omitempty"`
	Labels          []string              `json:"labels,omitempty"`
	Markers         []Marker              `json:"markers,omitempty"`
	Href            string                `json:"href,omitempty"`
	Image           *TopicImage           `json:"image,omitempty"`
	Notes           *Notes                `json:"notes,omitempty"`
	Children        *Children             `json:"children,omitempty"`
	Boundaries      []Boundary            `json:"boundaries,omitempty"`
	Extensions      []Extension           `json:"extensions,omitempty"`
	Summaries       []Summary             `json:"summaries,omitempty"`
	Position        *Position             `json:"position,omitempty"`
	// contains filtered or unexported fields
}

Topic is a node in the mind map.

func (*Topic) MarshalJSON

func (t *Topic) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Topic) UnmarshalJSON

func (t *Topic) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type TopicImage

type TopicImage struct {
	Src            string `json:"src"`
	IsMathJaxImage bool   `json:"isMathJaxImage,omitempty"`
	// contains filtered or unexported fields
}

TopicImage references embedded image resource.

func (*TopicImage) MarshalJSON

func (im *TopicImage) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*TopicImage) UnmarshalJSON

func (im *TopicImage) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

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