body

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body interface {
	// ToBytes returns the content as a byte slice.
	ToBytes() ([]byte, error)
	// ToString returns the content as a string.
	ToString() (string, error)
	// contains filtered or unexported methods
}

Body defines the interface for content that can be rendered into an EPUB section. It supports both raw string data and external file paths.

type File

type File string

File represents a path to a file on the local file system. The content is read only when a conversion method is called. The file content must be the structure that holds the <body></body> tag

func (File) ToBytes

func (p File) ToBytes() ([]byte, error)

ToBytes reads the file from the disk and returns its contents as a byte slice. It returns an error if the file cannot be found or read.

func (File) ToString

func (p File) ToString() (string, error)

ToString reads the file from the disk and returns its contents as a string.

type Raw

type Raw string

Raw represents content that is already held in memory as a string. This is useful for dynamically generated HTML or text. The string must be the structure that holds the <body></body> tag

func (Raw) ToBytes

func (r Raw) ToBytes() ([]byte, error)

ToBytes converts the raw string into a byte slice.

func (Raw) ToString

func (r Raw) ToString() (string, error)

ToString returns the raw string as-is.

Jump to

Keyboard shortcuts

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