Create default link and image render hooks

Fixes #11933
This commit is contained in:
Bjørn Erik Pedersen
2024-01-30 11:43:20 +01:00
parent 80595bbe3e
commit 5b7cb258ec
15 changed files with 229 additions and 42 deletions

View File

@@ -73,10 +73,39 @@ var Default = Config{
// Config configures Goldmark.
type Config struct {
DuplicateResourceFiles bool
Renderer Renderer
Parser Parser
Extensions Extensions
DuplicateResourceFiles bool
RenderHooks RenderHooks
}
// RenderHooks contains configuration for Goldmark render hooks.
type RenderHooks struct {
Image ImageRenderHook
Link LinkRenderHook
}
// ImageRenderHook contains configuration for the image render hook.
type ImageRenderHook struct {
// Enable the default image render hook.
// We need to know if it is set or not, hence the pointer.
EnableDefault *bool
}
func (h ImageRenderHook) IsEnableDefault() bool {
return h.EnableDefault != nil && *h.EnableDefault
}
// LinkRenderHook contains configuration for the link render hook.
type LinkRenderHook struct {
// Disable the default image render hook.
// We need to know if it is set or not, hence the pointer.
EnableDefault *bool
}
func (h LinkRenderHook) IsEnableDefault() bool {
return h.EnableDefault != nil && *h.EnableDefault
}
type Extensions struct {