brimdata / super

A novel data lake based on super-structured data
https://zed.brimdata.io/
BSD 3-Clause "New" or "Revised" License
1.38k stars 64 forks source link

Break many docs examples across multiple lines #5248

Closed philrz closed 1 month ago

philrz commented 1 month ago

What's Changing

I've reformatted many of the Zed docs examples across multiple lines to minimize the number of times readers need to "scroll right".

If you'd like to see the rendered site as part of review, I've put a copy of what's on this branch at a personal staging site at:

https://66c7d4d2d4764d84e6cdf484--spiffy-gnome-8f2834.netlify.app/docs/next

Why

Several of us have noticed this before, but a user recently spoke up about it in a community Slack thread and that inspired me to finally take action.

Details

The majority of them were fixable by just changing from:

echo "input data" | zq -z '...zed code...`

to

echo "input data" |
  zq -z '...zed code...`

i.e., I adopted the convention of putting the pipe for shell continuation at end of line when it would help.

For situations where I needed continuation of Zed pipelines, I put the pipes at beginning of next line, e.g.:

from pool
| count()

Overall, I stopped short of being totally dogmatic. In some cases I was able to break long inputs across multiple lines (e.g., when there were many echo'ed individual records) but some things would have required using some of the more ugly shell continuation tricks (e.g., breaking up single long strings) so there remain a handful if situations where "scroll right" is still needed to see everything. I figure this is not the end of the world.

I found a couple bonus things I fixed up along the way, including:

  1. Examples that weren't previously protected by mdtest at all but could be
  2. Switched from " to ' for surrounding the Zed code in some examples, since most already use ' and I figured we should be consistent (plus ' is a good habit for users since it avoids some shell surprises)