Just had an awesome idea; in you could inspect the characters in code blocks and make a very good educated guess if it's pointless ASCII art or if it actually has code in. Not only can I have the current setting in Ariane to collapse all code blocks, I can have an additional one that will just skip rendering any code blocks that look like ASCII art altogether.

The best thing about this idea is it'll be really fun to code.

Thinking about this some more, it'd be easier to have an array of 'normal' characters present in a wide range of programming languages and calculate a percentage from that. Some ASCII art is made up of just normal characters, I could accept that, or could try and look for a valid combination of letter and symbols. This is a perfect TDD scenario.


I can't think of legitimate code syntax where there'd be say 5 consecutive identical non-whitespace characters. It might be that simple.

@oppen i thought i had a counter-example from one of my students, but they 'only' used 4 consecutive characters for some variable names 😅

@oppen a possible legitimate code syntax with that amount of repetition would be brainf*ck code (i don't know how common would that kind of content be in gemini, though 😅)

anyways, now you left me wondering: wouldn't that criterion result in false negatives? ascii art that doesn't resort to repetition.

@chirrolafupa I'd use it as one of a few rules, and include some common character blocks in another check too. As soon as I can get to a computer I'm going to copy all the ASCII art I can find in Geminispace and start. Writing some tests

@oppen Lisp and Scheme easily accumulate more than 5 consecutive ")"''s.

@oppen I can't think of any other examples. Brilliant heuristic!

@oppen I don't think you'd ever expect to see that many "(", in contrast. You could probably get a way with just a ")" special case.

Sign in to participate in the conversation

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.