Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Img64 = &img64{}
Img64 is an implementation of goldmark.Extender
Functions ¶
func NewImg64 ¶
func NewImg64(opts ...Img64Option) *img64
NewImg64 initializes Img64: goldmark's extension with its options. Using default Img64 with goldmark.WithRenderOptions(opts) give the same result.
func NewImg64Renderer ¶
func NewImg64Renderer(opts ...Img64Option) *img64Renderer
func WithFileReader ¶ added in v0.1.2
func WithFileReader(r FileReader) interface { renderer.Option Img64Option }
WithFileReader changes reading image attribute from default. For example, it allows reading online images. (it is disabled in default reader)
func WithPathResolver ¶ added in v0.1.2
func WithPathResolver(r PathResolver) interface { renderer.Option Img64Option }
WithPathResolver adds custom behavior to read image source path. For example, relative paths could be converted into absolute paths by adding the parent directory path.
Types ¶
type FileReader ¶ added in v0.1.2
func AllowRemoteFileReader ¶ added in v0.1.2
func AllowRemoteFileReader(client *http.Client) FileReader
AllowRemoteFileReader enables embedding remote images which is prohibited with default reader. Use this only if all images are confirmed to be safe. This is one example of FileReader implementations.
func DefaultFileReader ¶ added in v0.1.2
func DefaultFileReader() FileReader
type Img64Config ¶
type Img64Config struct { html.Config PathResolver PathResolver FileReader FileReader }
Img64Config embeds html.Config to refer to some fields like unsafe and xhtml.
func (*Img64Config) SetOption ¶
func (c *Img64Config) SetOption(name renderer.OptionName, value any)
SetOption implements renderer.NodeRenderer.SetOption
type Img64Option ¶
type Img64Option interface { renderer.Option SetImg64Option(*Img64Config) }
type PathResolver ¶ added in v0.1.2
func DefaultPathResolver ¶ added in v0.1.2
func DefaultPathResolver() PathResolver
func ParentLocalPathResolver ¶ added in v0.1.2
func ParentLocalPathResolver(parentPath string) PathResolver
ParentLocalPathResolver adds parent directory path (ex. /var + target.md = /var/target.md). This is one example of PathResolver implementations.