Hey fedizens  

Anybody know a trusted script¹ or extention² to automatically replace "smart" (aka "curly") quotation marks and apostrophes with straight ones?

  • Double quotation marks -- replacing “ and ” with ".
  • Single quotation marks -- replacing ‘ and ’ with '.
  • Apostrophe - replacing ’ with '.

Genuinely asking, but no reply guys please 🫶

Thanks 🩷

#AskFedi #punctuation #PunctuationMarks #QuotationMarks #apostrophe #GenuinelyAsking #NoReplyGuys

Edit: Apologies for any confusion caused. We're looking only for something basic and trusted that can replace certain characters or text strings with another. So long as we can easily configure it to replace the above, it doesn't matter if it's a more-general script or extension for replacing text.

Edit 2: We found an extention that could automagically do it for us. It's called FoxReplace. Took us a few moments to work out how it worked, but we ended up creating a rule for text only (ignoring URLs) to apply the desired substitutions automatically to the text output on any rendered web page on a page load/reload.

¹ Compatible with violentmonkey.
² Compatible with Firefox or Firefox-based browsers.

Quotation mark - Wikipedia

@SleepyCatten If you use nushell str replace -ra "„|“|”" '"' | str replace -ra "‚|‘|’" "'" should do the job:

'foo„“”‚‘’bar' | str replace -ra "„|“|”" '"' | str replace -ra "‚|‘|’" "'"
will yield
foo"""'''barThat said, I am curious why you would want that, Ascii-quote are kinda really not great…?

@Fiona Alas, don't know what nushell is 😅

As for why, it's honestly just personal preference.

We've just always loathed them since they started appearing and setting themselves to default.

We're happy with others liking them, but we just prefer the basics, and are seeking an automagic way to replace them on a webpage.

@SleepyCatten Sorry, I only noticed afterwards that you were talking about a browser-setting… I’m currently looking into writing some JS, but note that if you are not careful, there are some security implications to using ascii-quotes, because they can in some contexts carry meaning for the used markaup-language

@Fiona No worries and totally get it. We're looking solely for replacing at the rendered-text-on-the-page level, not at any kind of code level.

Basically, so if we're on a webpage with instead of ', a script or extension would replace the rendered output.

Guess we really should have asked more generally for a script or extension that replaces text strings or characters with others 😅🤦‍♀️

@SleepyCatten If you can get custom JS to load, the following JavaScript should kinda work, but be aware that this will only run once and won’t replace new occurances, resulting from things like dynamic content.

document.body.innerHTML = document.body.innerHTML.replaceAll(/‚|‘|’/g, "'").replaceAll(/„|“|”/g, """);
Also be aware that on places where you edit content, this might lead to undesirable results: Don’t run this when editing Wikipedia articles for example.

@SleepyCatten The security concern is that both of those quotes are used in HTML itself;

so

<a href="/foo/“bar=”baz">…
would become
<a href="/foo/" bar="baz">... if you are not careful, which could change more than you might initially like… My command above will use the escape sequences for “"” and “'”, so it should work, but still be aware that the value of attributes might still change if they use proper quotes; it’s kinda surprisingly annoying to edit only the displayed text in HTML…