diff --git a/app/assets/javascripts/copy_as_gfm.js.es6 b/app/assets/javascripts/copy_as_gfm.js.es6 index 2bfe57b41000467c0200914dd2bdbb76632246f8..4bd537a6f28ed51f12c92a5444345927a88c4a6c 100644 --- a/app/assets/javascripts/copy_as_gfm.js.es6 +++ b/app/assets/javascripts/copy_as_gfm.js.es6 @@ -91,6 +91,9 @@ require('./lib/utils/common_utils'); }, }, SanitizationFilter: { + 'a[name]:not([href]):empty'(el, text) { + return el.outerHTML; + }, 'dl'(el, text) { let lines = text.trim().split('\n'); // Add two spaces to the front of subsequent list items lines, diff --git a/spec/features/copy_as_gfm_spec.rb b/spec/features/copy_as_gfm_spec.rb index f3a5b56512292e0a1b67de7c4eb43fd5001968d8..fec86128d039b0e69b40989d5bc6b8d55ef49ae7 100644 --- a/spec/features/copy_as_gfm_spec.rb +++ b/spec/features/copy_as_gfm_spec.rb @@ -251,6 +251,8 @@ describe 'Copy as GFM', feature: true, js: true do 'SanitizationFilter', <<-GFM.strip_heredoc + <a name="named-anchor"></a> + <sub>sub</sub> <dl>