5 releases
0.0.4 | Apr 13, 2024 |
---|---|
0.0.3 | Apr 5, 2024 |
0.0.2 | Apr 1, 2024 |
0.0.1 | Mar 19, 2024 |
0.0.0 | Mar 9, 2024 |
#639 in Development tools
493 downloads per month
390KB
13K
SLoC
mdsf
Format markdown code snippets using your favorite code formatters.
Installation
The latest version of mdsf
can be downloaded directly from github.com/hougesen/mdsf/releases.
Cargo
Install using the published crate:
cargo install mdsf
or directly from source:
git clone git@github.com:hougesen/mdsf.git
cargo install --path ./mdsf --bin mdsf
Usage
mdsf format <NAME_OF_FOLDER_OR_FOLDER>
Configuration
The default configuration of mdsf
aims to as sane 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
mdsf
supports running multiple formatters on the save code snippet.
{
// Only run `ruff` on Python snippets,
"python": "ruff",
// Run `usort` on file and then `black`
"python": ["usort", "black"],
// Run `usort`, if that fails run `isort`, finally run `black`
"python": [["usort", "isort"], "black"]
}
Supported languages & formatters
[!NOTE] mdsf is not a tool for installing formatters.
Only formatters that are already installed will be used.
Language | Formatters |
---|---|
Blade | blade-formatter |
C | clang-format |
CSharp | clang-format , csharpier |
Cabal | cabal_format |
Clojure | cljstyle |
Cpp | clang-format |
Crystal | crystal_format |
Css | prettier , stylelint |
Dart | dart_format |
Elixir | mix_format |
Elm | elm-format |
Erlang | efmt , erlfmt |
FSharp | fantomas |
Fortran | fprettify |
Gleam | gleam_format |
Go | gofmt , gofumpt , goimports |
GraphQL | prettier |
Groovy | npm-groovy-lint |
Haskell | fourmolu , hindent , ormolu , stylish-haskell |
Hcl | terraform_fmt , tofu_fmt |
Html | prettier |
Java | clang-format , google-java-format |
JavaScript | biome , clang-format , deno_fmt , prettier , standardjs |
Json | biome , clang-format , deno_fmt , prettier |
Julia | juliaformatter.jl |
Just | just_fmt |
Kcl | kcl_fmt |
Kotlin | ktfmt , ktlint |
Lua | luaformatter , stylua |
Markdown | prettier |
Nim | nimpretty |
Nix | alejandra , nixfmt , nixpkgs-fmt |
OCaml | ocamlformat , ocp-indent |
ObjectiveC | clang-format |
Perl | perltidy |
Protobuf | buf , clang-format |
PureScript | purs-tidy |
Python | autopep8 , black , blue , isort , ruff , usort , yapf |
ReScript | rescript_format |
Roc | roc_format |
Ruby | rubocop , rubyfmt , rufo , standardrb |
Rust | rustfmt |
Scala | scalafmt |
Shell | beautysh , shfmt |
Sql | sql-formatter , sqlfluff |
Swift | swift-format , swiftformat |
Toml | taplo |
TypeScript | biome , deno_fmt , prettier |
Vue | prettier |
Xml | xmlformat , xmllint |
Yaml | prettier , yamlfix , yamlfmt |
Zig | zigfmt |
Dependencies
~8–20MB
~266K SLoC