feat(cli/fmt): support more markdown extensions (#12195)

This commit is contained in:
Satya Rohith 2021-09-23 21:49:25 +05:30 committed by GitHub
parent e0c858fa27
commit c5442abc23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 4 deletions

View file

@ -206,7 +206,10 @@ pub fn format_file(
fmt_options: FmtOptionsConfig,
) -> Result<String, String> {
let ext = get_extension(file_path).unwrap_or_else(String::new);
if ext == "md" {
if matches!(
ext.as_str(),
"md" | "mkd" | "mkdn" | "mdwn" | "mdown" | "markdown"
) {
format_markdown(file_text, &fmt_options)
} else if matches!(ext.as_str(), "json" | "jsonc") {
format_json(file_text, &fmt_options)