mdembeds

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAllStringIndex

func FindAllStringIndex(s string) [][]int

FindAllStringIndex returns a slice with start and end positions for all embeds within the specified string.

func ReplaceEmbeds

func ReplaceEmbeds(src string, replF func(args EmbeddedArgs) string) string

ReplaceEmbeds replaces all the embeds tags of the given text with the result of the calling function.

Types

type EmbeddedArgs

type EmbeddedArgs struct {
	// embedded file
	Name string
	Data []byte
	Alt  string
	Typ  string

	// shared link
	Download zkidentity.ShortID
	Filename string
	Size     uint64
	Cost     uint64

	// processed locally
	LocalFilename string

	// May be set externally, not on the link.
	Uid *clientintf.UserID
}

func ParseEmbedArgs

func ParseEmbedArgs(rawEmbedStr string) EmbeddedArgs

ParseEmbedArgs parses the given raw embed string, which should be --[]--, with the embed conted between brackets.

func (EmbeddedArgs) String

func (args EmbeddedArgs) String() string

Jump to

Keyboard shortcuts

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