Live data from Hacker News

ASCII art for semantic code commenting

asciiflow.com

51–60 of 82 posts

Re: ASCII art for semantic code commenting

#51
post #23
post #12

For longer CSS files I use ASCII text to mark and visually separate the breakpoints. An advantage of this is the ability to see the breakpoints in the minimap. Something like this: https://css-tricks.com/wp-content/uploads/2015/09/mini-map.j... There's even a Sublime Text plugin to generate this text.

At that point it would be better to just split it into several files though.

Maybe it is, maybe this is just an intermediate file in a build process, optimised for readability.

Re: ASCII art for semantic code commenting

#52

For what it's worth, I keep a file in my home folder containing some box drawing characters. It's not super fast to draw by copy-paste but the result usually looks quite nice. ─ │ ┌ ┬ ┐ ┄ ┆ ├ ┼ ┤ ╲ ╱ ┈ ┊ └ ┴ ┘ ━ ┃ ┏ ┳ ┓ ┏ ┯ ┓ ┏ ┳ ┓ ┏ ┯ ┓ ┅ ┇ ┣ ╋ ┫ ┣ ┿ ┫ ┠ ╂ ┨ ┠ ┼ ┨ ┉ ┋ ┗ ┻ ┛ ┗ ┷ ┛ ┗ ┻ ┛ ┗ ┷ ┛

Wikipedia has a good page that also includes shading

[1] https://en.wikipedia.org/wiki/Box-drawing_character

Re: ASCII art for semantic code commenting

#53
Why don't we all use code editors that know how to render things like Graphviz and Markdown with lists, tables? Maybe in a side window rather than in the main display, but like, come-on...

Like, Visual Studio Code supports something like this:

https://marketplace.visualstudio.com/items?itemName=joaompin...

Re: ASCII art for semantic code commenting

#54
post #34

For what it's worth, I keep a file in my home folder containing some box drawing characters. It's not super fast to draw by copy-paste but the result usually looks quite nice. ─ │ ┌ ┬ ┐ ┄ ┆ ├ ┼ ┤ ╲ ╱ ┈ ┊ └ ┴ ┘ ━ ┃ ┏ ┳ ┓ ┏ ┯ ┓ ┏ ┳ ┓ ┏ ┯ ┓ ┅ ┇ ┣ ╋ ┫ ┣ ┿ ┫ ┠ ╂ ┨ ┠ ┼ ┨ ┉ ┋ ┗ ┻ ┛ ┗ ┷ ┛ ┗ ┻ ┛ ┗ ┷ ┛

Do you have an example context in which you'd use these? I've never thought to do this and am curious about the possibilities and use cases.

Basically I use the same kind of philosophy as RFCs, and document things using ascii art where some kind of diagram makes sense. For example, see the TCP RFC https://datatracker.ietf.org/doc/html/rfc793 where they use it for packet layout, flow diagrams, block diagrams, etc. It makes the whole thing self contained, you can copy paste diagrams to almost anywhere, easy to modify. Disadvantage is in some more complex diagrams it can get noisy

Re: ASCII art for semantic code commenting

#55
post #22

This is a neat tool, but unfortunately, text art like this generates is extremely unfriendly to folks that use screen readers. If you do use this for comment documentation, consider making sure that there is also a written description above/below it with equivalent descriptive content.

This is a very good point that I hadn't considered for some reason. Thanks!

Re: ASCII art for semantic code commenting

#58
post #54
post #34

Earlier quoted context omitted.

Do you have an example context in which you'd use these? I've never thought to do this and am curious about the possibilities and use cases.

Basically I use the same kind of philosophy as RFCs, and document things using ascii art where some kind of diagram makes sense. For example, see the TCP RFC https://datatracker.ietf.org/doc/html/rfc793 where they use it for packet layout, flow diagrams, block diagrams, etc. It makes the whole thing self contained, you can copy paste diagrams to almost anywhere, easy to modify. Disadvantage is in some more complex di…

[deleted]

Re: ASCII art for semantic code commenting

#60
post #18
post #3

EDIT: Deleted before I get even more downvotes.

On a general note, I think it's time to call things "text" instead of "ascii". Every time someone utters the word "ascii", they just mean text. Saying “I'm using ASCII” doesn't mean anything anymore, because nobody uses EBCDIC anymore – you are, no matter what, effectively using a superset of ASCII, by default UTF-8. The real question is which one.

> Saying “I'm using ASCII” doesn't mean anything anymore, because nobody uses EBCDIC anymore

I get what you're saying, but I have seen bugs at work caused by distributed systems sending text in ASCII or UTF8 to an IBM z/OS mainframe with EBCDIC.

Post reply on HN