orgmode

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serialize

func Serialize(document Document) string

Serialize renders a Document back to orgmode text.

Types

type Document

type Document struct {
	Preamble string
	Headings []Heading
}

Document is a parsed orgmode file. It contains an optional preamble (text before the first heading) and a sequence of top-level headings.

func Parse

func Parse(text string) (document Document, err error)

Parse reads orgmode text and returns a Document. This is a minimal parser sufficient for round-tripping dodder zettels through orgmode: it handles headings, TODO keywords, tags, property drawers, and body text.

type Heading

type Heading struct {
	Level      int
	Keyword    string // TODO, DONE, etc.
	Title      string
	Tags       []string
	Properties Properties
	Body       string
	Children   []Heading
}

Heading is a single org heading node. Nesting is represented by Level (1 = *, 2 = **, etc.). Subheadings are children.

func MakeHeading

func MakeHeading(
	title string,
	tags []string,
	body string,
	properties Properties,
) Heading

MakeHeading constructs a Heading from dodder object fields. This is the decompile path: dodder -> orgmode.

type Properties

type Properties []Property

Properties is the :PROPERTIES: drawer content as ordered key-value pairs.

func (Properties) Get

func (props Properties) Get(key string) (string, bool)

Get returns the value for a key and whether it was found.

func (*Properties) Set

func (props *Properties) Set(key, value string)

Set sets a key-value pair, replacing an existing key or appending.

type Property

type Property struct {
	Key   string
	Value string
}

Property is a single key-value pair from a :PROPERTIES: drawer.

Source Files

  • main.go

Jump to

Keyboard shortcuts

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