Scan your whole stack
Are you using csv-to-markdown-table?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v2.1.0
csv-to-markdown-table was last scanned on 30 Nov 2026 at version 2.1.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 2.1.0 LATEST | 30 Nov 2026 | No rules fired |
| 2.0.0 | 10 Sep 2026 | No rules fired |
Findings for v2.1.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 2.1.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Simple JavaScript CSV to Markdown Table Converter
You can see it in action and play with the Live Example.
Uses csv-walker for CSV parsing. Works in Node.js (>=20) as well as in the browser.
npm install csv-to-markdown-table
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:
$ csv-to-markdown-table --help
Usage: csv-to-markdown-table [options]
// … help output
$ csv-to-markdown-table --delim ',' --headers < example.csv
| cats | dogs | fish |
|------|------|------|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
$ csv-to-markdown-table
Reading from stdin... (press Ctrl+D at the start of a line to finish)
CSV Delimiter: \t (tab) Headers: false
[interactive input]
<script src="https://unpkg.com/csv-to-markdown-table"></script>
<script>
console.log(
csvToMarkdown("Name,Role,Location\nAda Lovelace,Mathematician,London\nGrace Hopper,Computer scientist,New York", ",", true)
);
</script>
const csvToMarkdown = require("csv-to-markdown-table");
console.log(
csvToMarkdown("Name,Role,Location\nAda Lovelace,Mathematician,London\nGrace Hopper,Computer scientist,New York", ",", true)
);
import csvToMarkdown from "csv-to-markdown-table";
console.log(
csvToMarkdown("Name,Role,Location\nAda Lovelace,Mathematician,London\nGrace Hopper,Computer scientist,New York", ",", true)
);
import csvToMarkdown from "csv-to-markdown-table";
console.log(
csvToMarkdown("Name,Role,Location\nAda Lovelace,Mathematician,London\nGrace Hopper,Computer scientist,New York", ",", true)
);
| Name | Role | Location |
|--------------|--------------------|----------|
| Ada Lovelace | Mathematician | London |
| Grace Hopper | Computer scientist | New York |
Which displays in markdown as:
| Name | Role | Location |
|---|---|---|
| Ada Lovelace | Mathematician | London |
| Grace Hopper | Computer scientist | New York |
Markdown output escapes pipes and backslashes. Column widths include the added backslashes.
The optional fourth argument accepts conversion settings:
csvToMarkdown('name,quote\nAda,"line one\nline two"', ",", true, {
newlineReplacement: "<br />",
cellFilter: (value) => value.trim(),
});
enclosure and escape are optional strings passed to csv-walker
when supplied. Omitting them retains csv-walker's defaults: enclosure is ",
and escape is \. Enclosure and escape must each be a
single character, except that escape: "" disables CSV escaping.
csvToMarkdown("'name','note'\n'Ada','hello, world'", ",", true, {
enclosure: "'",
escape: "",
});
newlineReplacement sets the string used for newlines within CSV fields
(LF, CR, or CRLF). It defaults to "<br>"; use "" to remove them or null
to skip newline replacement and preserve the original newline characters.
Existing calls without options retain the same behavior. TypeScript users can
import the CsvToMarkdownOptions type; the argument accepts
Partial<CsvToMarkdownOptions> so each setting can be supplied independently.
import type { CsvToMarkdownOptions } from "csv-to-markdown-table";
cellFilter accepts a (value: string, rowIndex: number, columnIndex: number) => string callback to transform each
parsed CSV field, including headers and empty fields. It runs before tab and
newline replacement, Markdown escaping, and column sizing. By default, values
are returned unchanged.
Indexes are zero-based and refer to parsed CSV rows and columns, including the header row. Callbacks can ignore either or both indexes. For example, to uppercase only the first row:
csvToMarkdown(csv, ",", true, {
cellFilter: (value, rowIndex) => rowIndex === 0 ? value.toUpperCase() : value,
});
Supplied options are merged with the defaults. Omit a property to use its default
value; explicitly setting a property to undefined is unsupported. TypeScript
users can enable exactOptionalPropertyTypes to catch this at compile time.
prettyPrint defaults to true, padding cells to align columns. Set it to
false for compact output with outer pipes and three-dash separators. Spaces
within cell values are preserved.
Both modes use the same input:
const csv = [
"Name,Role,Location",
"Ada Lovelace,Mathematician,London",
"Grace Hopper,Computer scientist,New York",
].join("\n");
csvToMarkdown(csv, ",", true); // prettyPrint: true (default)
csvToMarkdown(csv, ",", true, { prettyPrint: false });
With prettyPrint: true, columns line up in the Markdown source:
| Name | Role | Location |
|--------------|--------------------|----------|
| Ada Lovelace | Mathematician | London |
| Grace Hopper | Computer scientist | New York |
With prettyPrint: false, only the cell content and table delimiters remain:
|Name|Role|Location|
|---|---|---|
|Ada Lovelace|Mathematician|London|
|Grace Hopper|Computer scientist|New York|
Both render as the same table.
cellWidth sets how cell widths are measured in pretty output. It defaults to
JavaScript string length. A custom function receives escaped Markdown cell text.
It must return a consistent, non-negative integer. It must return zero for an
empty string.
CSV parsing fully supports Unicode. Pretty printing works with Unicode text, but its default width calculation may misalign columns in the Markdown source. For better alignment across languages, you can use a Unicode-aware width library. These libraries add substantial code. To keep the package small, none is included by default.
Install string-width to measure
display widths:
npm install string-width
Pass it as the cellWidth option:
import csvToMarkdown from "csv-to-markdown-table";
import stringWidth from "string-width";
const csv = "Name,City\nKenji,名前\nAda,Tokyo";
console.log(csvToMarkdown(csv, ",", true, { cellWidth: stringWidth }));
Display width can vary by font and environment.
This package is distributed in multiple formats:
lib/CsvToMarkdown.js (unminified)lib/CsvToMarkdown.min.js (minified)lib/CsvToMarkdown.mjslib/CsvToMarkdown.cjsThe package.json is configured with the appropriate fields to ensure the correct format is used in each environment:
main: Points to the CommonJS buildmodule: Points to the ESM buildunpkg: Points to the minified UMD buildexports: Provides conditional exports for different environmentsInstall dependencies and run the tests from the project directory:
npm ci
npm test
The test command builds the project before running the tests.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.