Are they tabs or spaces? How many of them are there? Never be confused again!

Copy-paste the file below into the console to see the whitespace like this:


Also available as a bookmarklet:


Re: @glebm:

Also available as a bookmarklet:
Wow... That is a throwback. I haven't seen a bookmarlet in years. Before I discovered and installed Greasemonkey for the first time, I developed bookmarklets right in the address bar with Notepad open to backup my progress. I felt so spoiled once I started writing userscripts.

But in the future, please leave bookmarklets in the past. They are illegible, especially when encoded, and it is hard to trust what you can't read. I'm sure what you posted is just your script source encoded as a bookmarklet, but I couldn't be absolutely certain without reversing the process. But I and others who can understand JavaScript, aren't going to bother and definitely would never use the bookmarklet because we can't read it. But some non-developer novice user might, and that is a problem because if there was something malicious hiding in there it would go unreported. Other users might take the silence to mean there is nothing wrong.

Bottom line: only post code that is readable. That goes double for comments, and you should use a code block with syntax highlighting (same markdown as used on GitHub).

Re: @sizzle:

you should use a code block with syntax highlighting

@glebm did use a code fence however I added the js to see if it would highlight and it doesn't do well with bookmarklets (inspect the HTML rendered at the pre/code tags and it will have a class of lang-js if the highlighter tried) . I'm usually validating these as much as I can and created this FAQ entry for this exact reason.

I do agree that bookmarklets shouldn't be posted especially since most of the browsers are starting to or have blocked these. Maybe the beautify option on a new script can make it look pretty for validation... haven't tried yet.

Re: @glebm:

Unescaping and beautifying the bookmarklet this comes out to be:

(function () {
  function e(e, o, r) {
    const c = e.nodeValue.split("\t").map(e => e.split(" "));
    if (1 === c.length && 1 === c[0].length) return;
    const a = e.parentNode,
      d = t => {
        a.insertBefore(t, e)
    n(c, e => 1 === e.length && "" === e[0], e => d(t(o.repeat(e))), e => n(e, e => "" === e, e => d(t(r.repeat(e))), e => d(document.createTextNode(e)))), a.removeChild(e)

  function t(e) {
    const t = document.createElement("span");
    return t.textContent = e, = c, t

  function n(e, t, n, o) {
    const r = e.length;
    e.reduce((e, c, a) => {
      const d = t(c);
      return d && a !== r - 1 ? e + 1 : (e > 0 && n(e), d || o(c), 1)
    }, 0)
  var o = "·",
    r = "â",
    c = .8;
  ! function () {
    for (const t of document.querySelectorAll("table[data-tab-size]")) {
      const n = r.padEnd(+t.dataset.tabSize),
        c = document.createTreeWalker(t, NodeFilter.SHOW_TEXT, {
          acceptNode(e) {
            let t = e.parentNode;
            for (;
              "TABLE" != t.nodeName;) {
              if (t.classList.contains("blob-code-inner")) return t.firstChild !== e || " " !== e.nodeValue ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
              t = t.parentNode
            return NodeFilter.FILTER_SKIP
        a = [];
      for (; c.nextNode();) a.push(c.currentNode);
      for (const t of a) e(t, n, o)

... looks like the identifiers have been mangled and the code compressed. Bordering on the fine line between legible and obfuscation.