Skip to content

Commit

Permalink
Move sanitizer to a constant in doc renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
nobodywasishere committed May 2, 2024
1 parent 5b36e85 commit 382f7c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compiler/crystal/tools/doc/markd_doc_renderer.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "sanitize"

class Crystal::Doc::MarkdDocRenderer < Markd::HTMLRenderer
SANITIZER = Sanitize::Policy::HTMLSanitizer.common
@anchor_map = Hash(String, Int32).new(0)

def initialize(@type : Crystal::Doc::Type, options)
Expand Down Expand Up @@ -178,7 +179,6 @@ class Crystal::Doc::MarkdDocRenderer < Markd::HTMLRenderer
end

def sanitize(node : Markd::Node) : String
sanitizer = Sanitize::Policy::HTMLSanitizer.common
sanitizer.process(node.text)
SANITIZER.process(node.text)
end
end

0 comments on commit 382f7c7

Please sign in to comment.