-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use nice UTF box-drawing characters for borders by default #99
Comments
I was looking through the source code trying to find the best way to do this, and I decided instead to make a post-formatter that would convert the default def prettify_table(table)
top_border, *middle, bottom_border = table.render.lines.map(&:strip)
new_table = middle.map do |line|
line[0] == '+' ? "├#{line[1...-1].tr('-+', '─┼')}┤" : line.tr('|', '│')
end
new_table.unshift "┌#{top_border[1...-1].tr('-+', '─┬')}┐"
new_table.push "└#{bottom_border[1...-1].tr('-+', '─┴')}┘"
# Move the T-shaped corners down two rows if there's a title
if table.title
new_table[0] = new_table[0].tr('┬', '─')
new_table[2] = new_table[2].tr('┼', '┬')
end
new_table.join("\n")
end It works for my admittedly basic needs, which are just titles and separators, but I figured I'd drop it here in case anyone else comes looking. |
Nice! That could work too. Just noticed another tool that can output tables: https://github.com/cldwalker/hirb/tree/master#views-anytime-anywhere. It uses similar
|
@TylerRick @nateberkopec I think this can be closed - fixed as part of #113 |
Instead of boring ASCII characters:
is there a reason we don't use the nice UTF box-drawing characters by default?
That is, something more like this:
Or if we can't make them the default for some reason, could we at least make it possible to use them for all corners and intersections?
Different intersections require different glyphs, so this doesn't look super great:
The best-looking approximation I've come up with is:
The text was updated successfully, but these errors were encountered: