Skip to content

Commit

Permalink
💎 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Jun 23, 2024
1 parent b86276b commit 39ca284
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/selma/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Selma
VERSION = "0.3.0"
VERSION = "0.3.1"
end
25 changes: 25 additions & 0 deletions ok.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require "selma"
class RemoveLinkClass
SELECTOR = Selma::Selector.new(match_element: %(a:not([class="anchor"])))

def selector
SELECTOR
end

def handle_element(element)
element.remove_attribute("class")
end
end

require "commonmarker"
text = "[^1]\n[^1]:\n" * 200000
html = Commonmarker.to_html(text, options: {
extension: { footnotes: true, description_lists: true },
render: { hardbreaks: false },
})

sanitizer_config = Selma::Sanitizer.new(Selma::Sanitizer::Config::RELAXED)
rewriter = Selma::Rewriter.new(sanitizer: sanitizer_config, handlers: [RemoveLinkClass.new])
rewriter.rewrite(html)

0 comments on commit 39ca284

Please sign in to comment.