Skip to content

Instantly share code, notes, and snippets.

@tobybot
Created February 28, 2020 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobybot/59d76fb461800a9d8b61c53b1a16bfcb to your computer and use it in GitHub Desktop.
Save tobybot/59d76fb461800a9d8b61c53b1a16bfcb to your computer and use it in GitHub Desktop.
Automatically superscript special marks
// superscript all reg, copy, and dagger symbols and add "regmark" class
jQuery(document).ready(function ($) {
// Find symbols & replace if they aren't inside a sup tag or a .nosup classed element
$('body :not(script,sup,.nosup)').contents().filter(function () {
return this.nodeType === 3;
}).replaceWith(function () {
return this.nodeValue.replace(/([®©†™])/gi, '<sup class="regmark">$&</sup>');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment