Skip to content

Commit

Permalink
Ensure {{exec}} has precedence over {{copy}}
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
  • Loading branch information
jdbaldry committed Jun 27, 2024
1 parent 79e87b2 commit beb6a68
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tools/transformer/goldmark/renderer/markdown/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,18 @@ func (r *Renderer) renderFencedCodeBlock(w util.BufWriter, source []byte, node a
r.write(w, "```")

if r.Config.KillercodaActions {
if _, ok := n.AttributeString("data-killercoda-exec"); ok {
r.write(w, "{{exec}}")
}
var action string

if _, ok := n.AttributeString("data-killercoda-copy"); ok {
r.write(w, "{{copy}}")
action = "{{copy}}"
}

// exec takes precedence over copy.
if _, ok := n.AttributeString("data-killercoda-exec"); ok {
action = "{{exec}}"
}

r.write(w, action)
}

r.write(w, '\n')
Expand Down

0 comments on commit beb6a68

Please sign in to comment.