Socket
Socket
Sign inDemoInstall

csv-to-markdown-table

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    csv-to-markdown-table

JavaScript/Node.js Csv to Markdown Table Converter


Version published
Weekly downloads
39K
increased by13.18%
Maintainers
1
Install size
21.2 kB
Created
Weekly downloads
 

Readme

Source

CSV To Markdown Table

npm version npm Coverage Status GitHub license

Simple JavaScript CSV to Markdown Table Converter

You can see it in action and play with the Live Example.

Requires no external libraries. Works in Node as well as in the browser.

Install

npm install csv-to-markdown-table

Usage

CLI

This package also includes a CLI tool. You can install it globally with:

npm install -g csv-to-markdown-table

Then you can use it like so:

$ csvtomarkdown --help
Usage: csvtomarkdown [options]
// … help output

$ csvtomarkdown --delimiter ',' --headers < example.csv
| cats | dogs | fish | 
|------|------|------| 
| 1    | 2    | 3    | 
| 4    | 5    | 6    |
$ csvtomarkdown
Reading from stdin... (press Ctrl+D at the start of a line to finish)
CSV Delimiter: \t (tab) Headers: false
[interactive input]

Raw JS via Global

console.log(
  csvToMarkdown( "header1,header2,header3\nValue1,Value2,Value3", ",", true)
);

Node / npm

const csvToMarkdown = require("csv-to-markdown-table");

console.log(
	csvToMarkdown("header1,header2,header3\nValue1,Value2,Value3", ",", true)
);

TypeScript

import csvToMarkdown from "csv-to-markdown-table";

console.log(
  csvToMarkdown("header1,header2,header3\nValue1,Value2,Value3", ",", true)
);
Outputs:
| header1 | header2 | header3 | 
|---------|---------|---------| 
| Value1  | Value2  | Value3  | 

Which displays in markdown as:

header1header2header3
Value1Value2Value3

Keywords

FAQs

Last updated on 01 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc