npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mdsf-cli

v0.11.1

Published

Format, and lint, markdown code snippets using your favorite tools

Readme

mdsf

Format, and lint, markdown code snippets using your favorite tools.

Table of contents

Installation

The latest version of mdsf can be downloaded directly from github.com/hougesen/mdsf/releases.

Linux & MacOS

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/hougesen/mdsf/releases/latest/download/mdsf-installer.sh | sh

Windows

powershell -ExecutionPolicy ByPass -c "irm https://github.com/hougesen/mdsf/releases/latest/download/mdsf-installer.ps1 | iex"

Cargo

Install using the published crate:

cargo install mdsf --locked

or directly from source:

git clone [email protected]:hougesen/mdsf.git

cargo install --path ./mdsf --bin mdsf

If you do not have Cargo installed, you need to install it first.

npm/npx

You can install mdsf using npm:

npm install -g mdsf-cli

mdsf format .

or run it directly using npx:

npx mdsf-cli format .

Homebrew

brew install hougesen/tap/mdsf

Conda

An unofficial (and unsupported) Conda package can be found at https://anaconda.org/conda-forge/mdsf.

conda install conda-forge::mdsf

Usage

mdsf 0.11.1
Format, and lint, markdown code snippets using your favorite tools
Mads Hougesen <[email protected]>

Usage: mdsf [OPTIONS] <COMMAND>

Commands:
  format       Run tools on input files
  verify       Verify files are formatted
  init         Create a new mdsf config
  completions  Generate shell completion
  cache-prune  Remove caches
  help         Print this message or the help of the given subcommand(s)

Options:
      --log-level <LOG_LEVEL>  [possible values: trace, debug, info, warn, error, off]
  -h, --help                   Print help
  -V, --version                Print version

Formatting code

The format command, as the name implies, is used to format documents.

mdsf format file.md
Run tools on input files

Usage: mdsf format [OPTIONS] [INPUT]...

Arguments:
  [INPUT]...
          Path to files and/or directories

Options:
      --stdin
          Read input from stdin and write output to stdout

      --config <CONFIG>
          Path to config file

      --debug
          Log stdout and stderr of formatters

      --threads <THREADS>
          Amount of threads to use.

          Defaults to 0 (auto).

      --cache
          Cache results

      --log-level <LOG_LEVEL>
          [possible values: trace, debug, info, warn, error, off]

      --timeout <TIMEOUT>
          Tool timeout in seconds.

          Defaults to no timeout.

      --on-missing-language-definition <ON_MISSING_LANGUAGE_DEFINITION>
          What to do when a codeblock language has no tools defined

          [possible values: ignore, fail, fail-fast]

      --on-missing-tool-binary <ON_MISSING_TOOL_BINARY>
          What to do when the binary of a tool cannot be found

          [possible values: ignore, fail, fail-fast]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Caching formatting results

To speed formatting caching can be enabled by supplying the format command with the --cache argument.

mdsf format --cache docs/
Removing old caches

Old caches can be removed by running the mdsf cache-prune command.

Remove caches

Usage: mdsf cache-prune [OPTIONS]

Options:
      --log-level <LOG_LEVEL>  [possible values: trace, debug, info, warn, error, off]
  -h, --help                   Print help
  -V, --version                Print version

Verifying code

You can verify that the document is formatted using the mdsf verify command.

mdsf verify docs/
Verify files are formatted

Usage: mdsf verify [OPTIONS] [INPUT]...

Arguments:
  [INPUT]...
          Path to files and/or directories

Options:
      --stdin
          Read input from stdin and write output to stdout

      --config <CONFIG>
          Path to config file

      --debug
          Log stdout and stderr of formatters

      --threads <THREADS>
          Amount of threads to use.

          Defaults to 0 (auto).

      --timeout <TIMEOUT>
          Tool timeout in seconds.

          Defaults to no timeout.

      --log-level <LOG_LEVEL>
          [possible values: trace, debug, info, warn, error, off]

      --on-missing-language-definition <ON_MISSING_LANGUAGE_DEFINITION>
          What to do when a codeblock language has no tools defined

          [possible values: ignore, fail, fail-fast]

      --on-missing-tool-binary <ON_MISSING_TOOL_BINARY>
          What to do when the binary of a tool cannot be found

          [possible values: ignore, fail, fail-fast]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

GitHub Action

There are a lot of different ways to run mdsf using GitHub actions.

The easiest way, in my opinion, is to use the official GitHub action to install mdsf.

After that you can run the binary like you would in your terminal.

[!NOTE] mdsf is not a package manager.

You must also install the tools you wish to use in your GitHub action.

name: mdsf

on: push

jobs:
  format:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Install mdsf
        uses: hougesen/mdsf@main

      - name: Run mdsf
        run: mdsf format --log-level warn .

      - name: Commit changes
        uses: EndBug/add-and-commit@v9
        with:
          message: "style: formatted markdown code blocks"

Visual Studio Code

mdsf can be run using the VSCode extension.

[!NOTE] The mdsf VS Code extension does currently not support installing mdsf. Which means mdsf must be installed using other means.

Vim / NeoVim

conform.nvim

conform.nvim has native support for running mdsf.

local conform = require("conform")

conform.setup({
	formatters_by_ft = {
		markdown = { "mdsf" },
		-- ...
	},
	-- ...
})

treefmt

Add the following to your treefmt.toml to run mdsf using treefmt.

# treefmt.toml

[formatter.mdsf]
command = "mdsf"
options = ["format"]
includes = ["*.md"]

pre-commit

See pre-commit for instructions

Sample .pre-commit-config.yaml:

repos:
  - repo: https://github.com/hougesen/mdsf
    rev: main
    hooks:
      - id: mdsf-format

Configuration

The default configuration of mdsf aims to as simple as possible. For that reason the default formatter for each language is the one most people have installed.

If you are interested in customizing which formatter is run, you can create a new mdsf configuration file by running mdsf init.

Create a new mdsf config

Usage: mdsf init [OPTIONS]

Options:
      --force                  Create config even if one already exists in current directory
      --log-level <LOG_LEVEL>  [possible values: trace, debug, info, warn, error, off]
  -h, --help                   Print help
  -V, --version                Print version

mdsf supports running multiple formatters on the code snippet.

{
  "languages": {
    // Only run `ruff` on Python snippets,
    "python": "ruff:format",
    // Run `usort` on file and then `black`
    "python": ["usort", "black"],
    // Run `usort`, if that fails run `isort`, finally run `black`
    "python": [["usort", "isort"], "black"],

    // Formatters listed under "*" will be run on any snippet.
    "*": ["typos"],

    // Formatters listed under "_" will only be run when there is not formatter configured for the file type OR globally ("*").
    "_": "prettier"
  }
}

Language aliases

Multiple languages can easily be mapped to the same tools using the language_aliases option.

{
  "language_aliases": {
    "language": "is_alias_of"
  }
}

In the example below bash and zsh would use the tools defined under languages.shell.

{
  "languages": {
    "shell": "shfmt"
  },
  "language_aliases": {
    "bash": "shell",
    "zsh": "shell"
  }
}

Newlines

By default LF (\n) is used for newlines.

That can be changed by specifying the newline config option.

{
  "newline": "lf" // "lf" | "cr" | "crlf"
}

Custom tools and commands

Custom commands can be defined in the mdsf.json file.

When defining the arguments the variable $PATH will automatically be replaced with the file path.

{
  "languages": {
    "rust": {
      "binary": "rustfmt",
      "arguments": ["--edition", "2018", "$PATH"],
      "stdin": false
    }
  }
}

Tools

[!NOTE] mdsf is not a package manager.

Only tools that are already installed will be used.

mdsf currently supports 335 tools. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃

| Name | Description | Categories | Languages | | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | actionlint | Static checker for GitHub Actions workflow files | linter | yaml | | air | R formatter | formatter | r | | alejandra | The Uncompromising Nix Code Formatter | formatter | nix | | alex | Catch insensitive, inconsiderate writing | spell-check | markdown | | ameba | A static code analysis tool for Crystal | linter | crystal | | ansible-lint | ansible-lint checks playbooks for practices and behavior that could potentially be improved and can fix some of the most common ones for you | linter | ansible | | api-linter | A linter for APIs defined in protocol buffers | linter | protobuf | | asmfmt | Go Assembler Formatter | formatter | go | | astyle | A Free, Fast, and Small Automatic Formatter for C, C++, C++/CLI, Objective-C, C#, and Java Source Code | formatter | c#, c++, c, java, objective-c | | atlas | Manage your database schema as code | formatter | hcl | | auto-optional | Makes typed arguments Optional when the default argument is None | formatter | python | | autocorrect | A linter and formatter to help you to improve copywriting, correct spaces, words, and punctuations between CJK (Chinese, Japanese, Korean) | spell-check | | | autoflake | Removes unused imports and unused variables as reported by pyflakes | linter | python | | autopep8 | A tool that automatically formats Python code to conform to the PEP 8 style guide | formatter | python | | bashate | Code style enforcement for bash programs | formatter | bash | | beancount-black | Opinionated code formatter, just like Python's black code formatter but for Beancount | formatter | beancount | | beautysh | A Bash beautifier for the masses | formatter | bash, shell | | bibtex-tidy | Cleaner and Formatter for BibTeX files | formatter | bibtex | | bicep | Bicep is a declarative language for describing and deploying Azure resources | formatter | bicep | | biome | A toolchain for web projects | formatter, linter | javascript, json, typescript, vue | | black | The uncompromising Python code formatter | formatter | python | | blade-formatter | An opinionated blade template formatter for Laravel that respects readability | formatter | blade, laravel, php | | blue | The slightly less uncompromising Python code formatter | formatter | python | | bpfmt | A formatter for Blueprint files | formatter | blueprint | | brittany | Haskell source code formatter | formatter | haskell | | brunette | A best practice Python code formatter | formatter | python | | bsfmt | A code formatter for BrighterScript (and BrightScript) | formatter | brighterscript, brightscript | | bslint | A linter for BrightScript and BrighterScript | linter | brightscript, brightscripter | | buf | The best way of working with Protocol Buffers | formatter | protobuf | | buildifier | A bazel BUILD file formatter and editor | formatter | bazel | | cabal-fmt | An experiment of formatting .cabal files | formatter | cabal | | cabal-gild | Format Haskell package descriptions | formatter | cabal, haskell | | cabal-prettify | Prettify your Cabal package configuration files | formatter | cabal | | cabal | Cabal is a system for building and packaging Haskell libraries and programs | formatter | cabal | | caddy | Formats or prettifies a Caddyfile | formatter | caddy | | caramel | Formatter for the Caramel programming language | formatter | caramel | | cedar | Command Line Interface for Cedar | formatter | cedar | | cfn-lint | CloudFormation Linter | linter | cloudformation, json, yaml | | checkmake | Linter/analyzer for Makefiles | linter | makefile | | clang-format | A tool to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code | formatter | c#, c++, c, java, javascript, json, objective-c, protobuf | | clang-tidy | clang-tidy is a clang-based C++ “linter” tool | linter | c++ | | clj-kondo | Static analyzer and linter for Clojure code that sparks joy | linter | clojure, clojurescript | | cljfmt | A tool for formatting Clojure code | formatter | clojure | | cljstyle | A tool for formatting Clojure code | formatter | clojure | | cmake-format | cmake-format can format your listfiles nicely so that they don't look like crap | formatter | cmake | | cmake-lint | Lint CMake files | linter | cmake | | codeql | Format queries and libraries with CodeQL | formatter | codeql | | codespell | Check code for common misspellings | spell-check | | | coffeelint | Lint your CoffeeScript | linter | coffeescript | | cppcheck | Cppcheck is a static analysis tool for C/C++ code | linter | c++, c | | cpplint | Static code checker for C++ | linter | c++ | | crlfmt | Formatter for CockroachDB's additions to the Go style guide | formatter | go | | crystal | Tools for the Crystal programming language | formatter | crystal | | csharpier | CSharpier is an opinionated code formatter for C# | formatter | c# | | css-beautify | A CSS formatter | formatter | css | | csscomb | CSS coding style formatter | formatter | css | | csslint | Automated linting of Cascading Stylesheets | linter | css | | cue | The home of the CUE language! Validate and define text-based and dynamic configuration | formatter | cue | | cueimports | CUE tool that updates your import lines, adding missing ones and removing unused ones | formatter | cue | | curlylint | Experimental HTML templates linting for Jinja, Nunjucks, Django templates, Twig, Liquid | linter | django, html, jinja, liquid, nunjucks, twig | | d2 | A modern language that turns text to diagrams | formatter | d2 | | dart | Formatter and linter for Dart | formatter, linter | dart, flutter | | dcm | Code Quality Tool for Flutter Developers | formatter, linter | dart, flutter | | deadnix | Scan Nix files for dead code | linter | nix | | deno | Formatter and linter for JavaScript and TypeScript | formatter, linter | javascript, json, typescript | | dfmt | Dfmt is a formatter for D source code | formatter | d | | dhall | Format Dhall files | formatter | dhall | | djade | A Django template formatter | formatter | django, python | | djlint | Lint & Format HTML Templates | formatter, linter | handlebars, html, jinja, mustache, nunjucks, twig | | docformatter | Formats docstrings to follow PEP 257 | formatter | python | | dockerfmt | Dockerfile formatter. a modern dockfmt | formatter | docker | | dockfmt | Dockerfile format and parser. Like gofmt but for Dockerfiles | formatter | docker | | docstrfmt | A formatter for reStructuredText | formatter | python, restructuredtext, sphinx | | doctoc | Generates table of contents for markdown files | formatter | markdown | | dotenv-linter | Lightning-fast linter for .env files | linter | env | | dprint | A pluggable and configurable code formatting platform written in Rust | formatter | | | dscanner | Swiss-army knife for D source code | linter | d | | dune | Build tool for OCaml projects | formatter | dune, ocaml, reasonml | | duster | Automatic configuration for Laravel apps to apply Tighten's standard linting & code standards | formatter, linter | php | | dx | Fullstack app framework for web, desktop, and mobile | formatter | rsx, rust | | easy-coding-standard | The Easiest way to add coding standard to your PHP project | formatter, linter | php | | efmt | Erlang code formatter | formatter | erlang | | elm-format | elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide | formatter | elm | | eradicate | Removes commented-out code from Python files | linter | python | | erb-formatter | Format ERB files with speed and precision | formatter | erb, ruby | | erg | A statically typed language compatible with Python | linter | erg | | erlfmt | An automated code formatter for Erlang | formatter | erlang | | eslint | Find and fix problems in your JavaScript code | linter | javascript, typescript | | fantomas | FSharp source code formatter | formatter | f# | | fish_indent | Fish indenter and prettifier | formatter | fish | | fixjson | JSON Fixer for Humans using (relaxed) JSON5 | formatter, linter | json5, json | | floskell | Floskell is a flexible Haskell source code pretty printer | formatter | haskell | | flynt | A tool to automatically convert old string literal formatting to f-strings | formatter | python | | fnlfmt | A formatter for Fennel code | formatter | fennel | | forge | Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust | formatter | solidity | | fortitude | A Fortran linter | linter | | | fortran-linter | A simple fortran syntax checker, including automatic fixing of the code | formatter, linter | fortran | | fourmolu | A fourk of ormolu that uses four space indentation and allows arbitrary configuration | formatter | haskell | | fprettify | Auto-formatter for modern Fortran source code | formatter | fortran | | futhark | Code formatter for the furhark programming language | formatter | futhark | | fvm | Flutter Version Management: A simple CLI to manage Flutter SDK versions | formatter, linter | dart, flutter | | gci | GCI, a tool that control golang package import order and make it always deterministic | formatter | go | | gdformat | GDScript formatter | formatter | gdscript | | gdlint | GDScript linter | linter | gdscript | | gersemi | A formatter to make your CMake code the real treasure | formatter | cmake | | ghokin | Parallelized formatter with no external dependencies for gherkin (cucumber, behat...) | formatter | behat, cucumber, gherkin | | gleam | Format Gleam source code | formatter | gleam | | gluon | A static, type inferred and embeddable language written in Rust | formatter | gluon | | gofmt | Gofmt formats Go programs | formatter | go | | gofumpt | A stricter gofmt | formatter | go | | goimports-reviser | Right imports sorting & code formatting tool (goimports alternative) | formatter | go | | goimports | goimports updates your Go import lines, adding missing ones and removing unreferenced ones | formatter | go | | golangci-lint | Fast linters runner for Go | formatter, linter | go | | golines | A golang formatter that fixes long lines | formatter | go | | google-java-format | Reformats Java source code to comply with Google Java Style | formatter | java | | gospel | Misspelled word linter for Go comments, string literals and embedded files | spell-check | go | | grafbase | The Grafbase command line interface | linter | graphql | | grain | Code formatter for the Grain programming language | formatter | grain | | hadolint | Dockerfile linter, validate inline bash, written in Haskell | linter | dockerfile | | haml-lint | Tool for writing clean and consistent HAML | linter | haml | | hclfmt | Formatter for hcl files | formatter | hcl | | hfmt | Format Haskell programs. Inspired by the gofmt utility | formatter | haskell | | hindent | Haskell pretty printer | formatter | haskell | | hlint | Haskell source code suggestions | linter | haskell | | html-beautify | A html formatter | formatter | html | | htmlbeautifier | A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates | formatter | erb, html, ruby | | htmlhint | The static code analysis tool you need for your HTML | linter | html | | hurlfmt | Formatter for hurl files | formatter | hurl | | imba | A formatter for Imba | formatter | imba | | inko | A language for building concurrent software with confidence | formatter | inko | | isort | A Python utility to sort imports | formatter | python | | janet-format | A formatter for Janet code. | formatter | janet | | joker | Small Clojure interpreter, linter and formatter | formatter, linter | clojure | | jq | Command-line JSON processor | formatter | json | | jqfmt | like gofmt, but for jq | formatter | jq | | js-beautify | Beautifi