diff --git a/lib/sanitize_ext/sanitize_config.rb b/lib/sanitize_ext/sanitize_config.rb index ae5e791338..fdcb0c450b 100644 --- a/lib/sanitize_ext/sanitize_config.rb +++ b/lib/sanitize_ext/sanitize_config.rb @@ -64,7 +64,7 @@ class Sanitize :relative end - if LINK_PROTOCOLS.include?(scheme) && href != text && href != 'https://' + text && cls == '' + if LINK_PROTOCOLS.include?(scheme) && href != text && href != 'https://' + text && !text.start_with?('#') && !text.start_with?('@') current_node['class'] = cls + ' kmy-dangerous-link' current_node.before(Nokogiri::XML::Text.new('⚠', current_node.document)) end