Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

markdown-table-formatter

nvuillam30kMIT1.6.1

Format markdown tables in files

markdown, table, formatter, format, prettify

readme

Markdown table formatter

Version Downloads/week Downloads/total Mega-Linter Generated by github-dependents-info codecov GitHub contributors GitHub stars License PRs Welcome

Format markdown tables in files, using embedded markdown-table-prettify

Banner

Table of contents

Installation

Local

npm install markdown-table-formatter --save

Global

npm install markdown-table-formatter -g

Usage

markdown-table-formatter [OPTIONS] (file(s) or glob expression)

Options

Parameter Description Default value
-c
--check
Check only, does not update files false
-p
--columnpadding
Override column padding number of spaces
-h
--help
Displays help
-v
--version
Displays version

Examples

Format all markdown files found within current directory

markdown-table-formatter

Format all markdown files found with a glob expression

markdown-table-formatter **/docs/*.md

Format markdown tables in a single file

markdown-table-formatter myfile.md

Format markdown tables in a multiple file

markdown-table-formatter myfile.md anotherFile.md andAnotherFile.md

Check if markdown table formatting is necessary in a single file

markdown-table-formatter --check myfile.md

Check if markdown table formatting is necessary in a multiple files

markdown-table-formatter --check myfile.md anotherFile.md andAnotherFile.md

You can see more examples in test methods

Continuous Integration

You can automatically check markdown tables formatting and fix it using MegaLinter, that embeds markdown-table-formatter out of the box

Ignoring Code Blocks

You may wish to ignore specific markdown content, especially when using with Megalinter or terraform-docs

To achieve this, place tags <!-- markdown-table-prettify-ignore-start --> and <!-- markdown-table-prettify-ignore-end --> around the content you want markdown-table-formatter to ignore.

Contribute

Contributions are very welcome !

Please follow Contribution instructions

Release Notes

See complete CHANGELOG

changelog

Changelog

[1.6.1] 2024-06-11

  • Upgrade dependencies

[1.6.0] 2024-04-27

  • Core: Upgrade minimum NodeJS version to 18.0
  • Upgrade dependencies

[1.5.0] 2023-11-25

  • Core: Now requires Node 16+
  • Upgrade dependencies
  • Doc
    • Add table of contents
    • Add explanation of how to disable and re-enable formatting
  • CI
    • Upgrade MegaLinter to v7
    • Rename master branch into main

[1.4.0] 2022-07-25

  • Add --verbose mode
  • Dependencies: run npm audit fix to secure dependencies
  • CI: Upgrade MegaLinter to v6

[1.3.0] 2022-01-31

  • Allow to override the table columns padding number of spaces using argument --columnpadding
  • CI: Upgrade MegaLinter to v5 + fix CI tests on Windows & Mac

[1.2.0] 2021-08-20

  • Allow to call markdown-table-formatter with a glob parameter to find files to format
  • Allow to call markdown-table-formatter without arguments (*/.md will be used by default to collect files)
  • Fix logs format

[1.1.0] 2021-04-05

  • Upgrade markdown-table-prettify to 3.4.0 so it can take in account inline disable comments

[1.0.2] 2021-01-19

  • Fix code coverage

[1.0.1] 2021-01-14

  • First working version :)

[0.0.1] 2021-01-13

  • Initial version