summaryrefslogtreecommitdiffstats
path: root/markup/goldmark
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-01-30 11:43:20 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-01-30 20:12:19 +0100
commit5b7cb258ec26d7de690099f5dc39935b8d728155 (patch)
tree53544c8ab46e3fffda4a1e33c5d6e705183e2652 /markup/goldmark
parent80595bbe3e7901ecd6200e59d43af142c3c85b6b (diff)
Create default link and image render hooks
Fixes #11933
Diffstat (limited to 'markup/goldmark')
-rw-r--r--markup/goldmark/goldmark_config/config.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/markup/goldmark/goldmark_config/config.go b/markup/goldmark/goldmark_config/config.go
index 1c393e3f4..9a14bf9b8 100644
--- a/markup/goldmark/goldmark_config/config.go
+++ b/markup/goldmark/goldmark_config/config.go
@@ -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 {