FIX: empty highlighted_languages resulted in ["", "auto", "nohighlight"] (PR #10772)


This feels too fancy for me… why not the simple x => x !== ""

This is js idiom, we use it at lots of places in the app already

1 Like

The intent though is kind of odd cause this filters out the empty string, the string false and false and 0 I think

Which is what we want no? It filters anything not truthy, and we don’t want anything falsey here so it does exactly what we expect.

Except one thing is wrong in your list, it wouldn’t filter the string “false”, it’s not falsey.

It’s so minor this probably does not matter, but we could avoid all this filtering if we did this backwards, we allow 2 classes and if the site setting is truthy we split it and concat

Does not compensate for ‘|’ set as an acceptable code lang like the Boolean trick does, but a tiny bit clearer imo

Anyway feel free to merge as is many othe fishes to farm