Created
October 24, 2025 07:35
-
-
Save garcon/87602fd468cf120fff51b6d2c431f433 to your computer and use it in GitHub Desktop.
Replace the space following Czech single-character words and some English prepositions and articles with non-breaking space.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:!function(){let e=window.getSelection();if(!e.rangeCount)return;let t=e.getRangeAt(0),n=e.toString();if(!n.trim())return;let a=n.replace(/\b([ksvzouai]|do|na|po|od|ke|ve|za|ze|of|in|at|to|as|the|an)\s(?=\S)/gi,%22$1\xa0%22),o=document.activeElement,r=o&&o.tagName.toLowerCase();if((%22textarea%22===r||%22input%22===r&&%22text%22===o.type)&&%22number%22==typeof%20o.selectionStart){let%20l=o.selectionStart,i=o.selectionEnd;o.setRangeText(a,l,i,%22select%22)}else{let%20s=document.createTextNode(a);t.deleteContents(),t.insertNode(s),e.removeAllRanges();let%20g=document.createRange();g.setStartBefore(s),g.setEndAfter(s),e.addRange(g)}}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment