Skip to content
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

Add a horizontal line under the heading line #1

Open
rahji opened this issue Aug 22, 2024 · 3 comments
Open

Add a horizontal line under the heading line #1

rahji opened this issue Aug 22, 2024 · 3 comments

Comments

@rahji
Copy link

rahji commented Aug 22, 2024

This is a great script, thanks! Since the horizontal lines are all created as dashes, the markdown table is rendered without a horizontal line under it. It would be nice if you had the option to create the table with equal signs instead.

In the meantime, this command will do it:

sed -i 'N;/^[^-]*-/{n;s/-/=/g;:a;n;ba};P;D' table.md

:)

@kkew3
Copy link
Owner

kkew3 commented Aug 27, 2024

I'm not an expert in sed. So I run your sed script on example-formatted.txt, and it returns this text:

+----------------+----------------------------------------------------------+
| Usage          | tabulate [-h] [-W WIDTH_LIST] [FILE]                     |
+================+==========================================================+
| Description    | Make fixed-width plaintext table with multi-line cell    |
|                | supports. Currently only support grid table, but it's    |
|                | trivial to adapt it to other layout once the table has   |
|                | been built. What plaintext table content is expected:    |
|                | <TAB> will be regarded as field delimiter, <LF> (or      |
|                | <CRLF> if on Windows) as row delimiter, and all the      |
|                | others as cell content.                                  |
+----------------+----------------------------------------------------------+
| FILE           | table content from which to read; if FILE is not         |
|                | specified, the table content will be expected from stdin |
+----------------+----------------------------------------------------------+
| -h, --help     | show this help message and exit                          |
+----------------+----------------------------------------------------------+

which basically renders the second --- row as === row.

Is this what you want?

@rahji
Copy link
Author

rahji commented Aug 27, 2024

Yes. If you look at section 8.9.4 Extension: grid_tables on this page https://pandoc.org/chunkedhtml-demo/8.9-tables.html you'll see the same thing in their example. What it does is make sure there's a horizontal line under the heading row when it gets rendered.

@kkew3
Copy link
Owner

kkew3 commented Sep 21, 2024

With the new release, you may run

tabulate -Lgrid table.txt

to produce the table you want. See more in README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants