Live data from Hacker News

ASCII art for semantic code commenting

asciiflow.com

21–30 of 82 posts

Re: ASCII art for semantic code commenting

#21
post #9

For emacs users, there are some modes with similar functionalities (as expected from emacs!): picture-mode and artist-mode See for example http://xahlee.info/emacs/emacs/emacs_ascii_diagram.html

Came here to say this. If it's text, Emacs can handle it.

Oh, also, if you want your ASCII diagrams to render into pretty pictures, I found org-mode + ditaa to work quite nicely:

https://www.orgmode.org/worg/org-contrib/babel/languages/ob-...

Re: ASCII art for semantic code commenting

#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.

Re: ASCII art for semantic code commenting

#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.

Re: ASCII art for semantic code commenting

#26

I've seen this a few times. The key limit is that once drawn the characters are set, you can't move the drawn objects around. What I'd like is something like drawio for ASCII/Unicode. I've been thinking of writing my own for years, but that'll probably never happen so I'll just keep mentioning the idea when similar apps come up in the hope I inspire someone else!

It's a little tedius, but you can highlight sections and then drag the highlighted section around.

Also it would be nice to have some way of snapping boxes to a grid. Similar to creating new elements in figma. It was hard to tell when if all the boxes I made were aligned / same size.

Re: ASCII art for semantic code commenting

#28
post #5

PlantUML can export to text too. And it aligns all the boxes and arrows for you. Still, great idea and great implementation :)

I'm going to second this one, and add that diagrams are a real weak point for accessibility in general, one which using textual drawings exacerbates.

PlantUML is readable by screen readers and contains the same information as the diagram it generates, which is the optimal balance between using visual diagrams as part of software development while not excluding the vision-impaired completely in so doing.

To be clear, I'm not scolding anyone for using ASCII diagrams, especially given that code remains stubbornly text-only. Just boosting awareness of PlantUML in terms of its accessibility advantages. I can mention meaningful diffs in version control as another advantage!

Re: ASCII art for semantic code commenting

#30
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.

    ─  │  ┌ ┬ ┐
    ┄  ┆  ├ ┼ ┤ ╲ ╱
    ┈  ┊  └ ┴ ┘

    ━  ┃  ┏ ┳ ┓ ┏ ┯ ┓ ┏ ┳ ┓ ┏ ┯ ┓
    ┅  ┇  ┣ ╋ ┫ ┣ ┿ ┫ ┠ ╂ ┨ ┠ ┼ ┨
    ┉  ┋  ┗ ┻ ┛ ┗ ┷ ┛ ┗ ┻ ┛ ┗ ┷ ┛
Post reply on HN