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

Separate Header with a ------- #38

Open
blak3r2 opened this issue Mar 21, 2016 · 3 comments
Open

Separate Header with a ------- #38

blak3r2 opened this issue Mar 21, 2016 · 3 comments

Comments

@blak3r2
Copy link

blak3r2 commented Mar 21, 2016

Would love an option to separate the column headers from the body of the table with a line.

I love the truncation and autowrap features of your module. But, for some of my tables having a table separator looks a lot cleaner in my opinion.

Using tablify:

image

Using columnify

image

@hustcer
Copy link

hustcer commented Apr 27, 2016

+1

@bladerunner2020
Copy link

bladerunner2020 commented Jan 25, 2017

+1. I added the following line to add '----' after header.

col = col.slice(0, col.indexOf('\n')) + '\n' +'-'.repeat(col.indexOf('\n')) + col.slice(col.indexOf('\n'));

@arelstone
Copy link

I did it by doing a simple function that adds the dashes

const addDashes = (text: string) => {
    const repeat = () => `${'-'.repeat(30)}`;
    return `${repeat()}\n${text}\n${repeat()}`
}

and then calling the function in my config.headingTransform.
Like this:

columnify(data,{headingTransform: text => addDashes(text)})

Home someone can use this snippet

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

4 participants