Skip to content

Commit

Permalink
add ability to clear before and after hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesKaufmann committed Sep 26, 2020
1 parent 713d730 commit f444360
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions from.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,26 @@ func (conv *Converter) After(hooks ...Afterhook) *Converter {
return conv
}

// ClearBefore clears the current before hooks (including the default before hooks).
func (conv *Converter) ClearBefore() *Converter {
conv.mutex.Lock()
defer conv.mutex.Unlock()

conv.before = nil

return conv
}

// ClearAfter clears the current after hooks (including the default after hooks).
func (conv *Converter) ClearAfter() *Converter {
conv.mutex.Lock()
defer conv.mutex.Unlock()

conv.after = nil

return conv
}

// AddRules adds the rules that are passed in to the converter.
//
// By default it overrides the rule for that html tag. You can
Expand Down

0 comments on commit f444360

Please sign in to comment.