r/SublimeText • • 14d ago

Is there a way to view (markdown/csv) tabular data in a nice manner in-editor?

I mainly use sublime for text editing, and going through data files, so mainly .md, .csv and .tsv. It would greatly speed up my workflow if I could make sublime show tables "nicely" by default, so like this:

|    Name   |   Phone   |
|-----------|-----------|
| Anna      | 123456789 |
| Alexander | 987654321 |
| _         |           |

I would like for all the recognized tables in any file to show like above, instead of having to select the tabular data and running a command. Usually a table is entered in markdown like this:

| Syntax | Description |
| --- | ----------- |
| Header | Title |
| Paragraph | Text |

which is hard to read. Is there a way?

11 Upvotes

6 comments sorted by

2

u/ifrederico 14d ago

Give this package a try. You can view markdown format as you edit. LiveServerPlus

1

u/tftb 14d ago

That looks relevant, but it looks like it does not work in-editor, rather it displays the formatted markdown as a separate webpage. I was hoping for a solution that would let me keep editing files in sublime text, but still view the tables formatted.

1

u/ifrederico 14d ago

Perhaps try Table Editor or Rainbow CSV.

3

u/Khoa_dot 14d ago

I use the package TableEditor, for markdown tables, that does the job in most cases: https://packagecontrol.io/packages/Table%20Editor

It's not as good as what you asked for (because it edits the buffer to get the nice alignment, it's not just a render) but maybe give it a try!

1

u/ipearx 14d ago

Not a sublime tool, but the clickhouse database is amazing for reading CSV files (or any other data format) and querying it like SQL, and formatting how you want. You can run it locally. e.g.

clickhouse local --query "
  SELECT *
  FROM file('test.csv', CSVWithNames)
  FORMAT PrettyCompactMonoBlock
"
    ┌─src─┬─source_name──────┬──points─┬─unique_devices─┐
 1. │  23 │ XContest         │ 5090137 │            109 │
 2. │  14 │ SeeYou Navigator │ 1079301 │             33 │
 3. │   0 │ OGN              │ 1044729 │            843 │
 4. │  37 │ Bircom           │  495804 │            262 │
 5. │  56 │ SkySignals       │  422317 │            415 │
 6. │  25 │ Flymaster        │  381439 │              2 │
 7. │  53 │ Naviter Oudie N  │  224255 │             13 │
 8. │  50 │ Naviter Omni     │  215827 │              7 │
 9. │  43 │ Wingman          │  111358 │             15 │
10. │  30 │ SportsTrackLive  │   38371 │             50 │
11. │  61 │ pgpilot          │   23221 │             12 │
12. │   9 │ inreach          │   15637 │             57 │
13. │  16 │ PureTrack App    │   11616 │             12 │
14. │  31 │ FFVL Tracking    │    7852 │              7 │
15. │  21 │ API              │    6096 │              9 │
16. │  41 │ SKYTRAXX         │    4952 │            140 │
17. │  40 │ Traccar          │    4676 │              1 │
18. │  36 │ XC Guide         │    2354 │              3 │
19. │  24 │ SkyLines         │     803 │              1 │
20. │   1 │ SPOT             │     417 │              3 │
21. │  42 │ Gaggle           │     297 │              1 │
22. │  47 │ XCglobe/FlyMe    │     160 │              1 │
23. │  55 │ ProteGear        │      12 │              1 │
    └─────┴──────────────────┴─────────┴────────────────┘

1

u/me_myself_ai 14d ago

Yup any of the markdown formatters will auto format those :) check out Formatter for the mainstream one and enable mdformat on save