Git Product home page Git Product logo

markdown-table-formatter's Introduction

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

markdown-table-formatter's People

Contributors

github-actions[bot] avatar nvuillam avatar renovate[bot] avatar rolfmoleman avatar tpansino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

markdown-table-formatter's Issues

[๐Ÿ’ก idea: ] ability to ignore sections of markdown akin to markdownlint

I really like the formatter. Howeverm, it can cause a continuous PR loop which consumes excessive action minutes, when used with tools such as terraform-docs.

Why

Terraform docs gnerates terrform documentation into markdown, but then when using megalinter the markdown-table-formatter picks up that the table is incorrectly formatted and attempts to reformat it. which then on our rlelease pieplien causes terraform-docs to run afgain, createing a fresh (or reopening) a pr from megalinter where the only changes are from this.

What

would it be possible to implement markdown comment blocks where this ignores the code between them akin to <!-- markdownlint-enable --> and <!-- markdownlint-disable --> in markdownlint or <!-- prettier-ignore-start --> and <!-- prettier-ignore-end --> in prettier

tables not starting with | are ignored

Label | Label
-|-
Row | Row

Is not recognized, but rendered correctly in visual studio code preview. I think it should at least warn the user about formatting this table.

Config option for spacing

The formatter currently expects this:

| First Header | Second Header |
|--------------|---------------|
| Content Cell | Content Cell  |
| Content Cell | Content Cell  |

but should have the option to allow this:

| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/deploy-PROD.yml
  • actions/checkout v4
  • actions/setup-node v4.0.3
.github/workflows/deploy-RELEASE.yml
  • actions/checkout v4
  • actions/setup-node v4.0.3
.github/workflows/github-dependents-info.yml
  • actions/checkout v4
  • peter-evans/create-pull-request v5
.github/workflows/mega-linter.yml
  • actions/checkout v4
  • oxsecurity/megalinter v7
  • actions/upload-artifact v4
  • peter-evans/create-pull-request v5
  • stefanzweifel/git-auto-commit-action v5
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-node v4.0.3
  • actions/checkout v4
  • actions/setup-node v4.0.3
  • actions/checkout v4
  • actions/setup-node v4.0.3
npm
package.json
  • debug ^4.3.4
  • find-package-json ^1.2.0
  • fs-extra ^11.1.1
  • glob ^10.3.14
  • markdown-table-prettify ^3.6.0
  • optionator ^0.9.4
  • @babel/eslint-parser ^7.23.3
  • eslint ^9.0.0
  • mega-linter-runner ^7.6.0
  • mocha ^10.2.0
  • nyc ^15.1.0
  • which ^4.0.0
  • node >=18.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.