diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bbb8d9..b02ed69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### [Unreleased](https://github.com/hougesen/mdsf/compare/v0.2.6...HEAD) +- feat(formatters): support typstfmt [`#484`](https://github.com/hougesen/mdsf/pull/484) - feat(formatters): support ufmt [`#483`](https://github.com/hougesen/mdsf/pull/483) - feat(formatters): support markdownfmt [`#482`](https://github.com/hougesen/mdsf/pull/482) - feat(formatters): support ziggy fmt [`#481`](https://github.com/hougesen/mdsf/pull/481) diff --git a/README.md b/README.md index d575851..9f769f1 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ mdsf init -`mdsf` currently supports 182 tools. Feel free to open an issue/pull-request if your favorite tool is missing! 😃 +`mdsf` currently supports 183 tools. Feel free to open an issue/pull-request if your favorite tool is missing! 😃 | Formatter | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | @@ -355,6 +355,7 @@ mdsf init | twig-cs-fixer | [https://github.com/VincentLanglet/Twig-CS-Fixer](https://github.com/VincentLanglet/Twig-CS-Fixer) | | typos | [https://github.com/crate-ci/typos](https://github.com/crate-ci/typos) | | typstfmt | [https://github.com/astrale-sharp/typstfmt](https://github.com/astrale-sharp/typstfmt) | +| typstyle | [https://github.com/Enter-tainer/typstyle](https://github.com/Enter-tainer/typstyle) | | ufmt | [https://github.com/omnilib/ufmt](https://github.com/omnilib/ufmt) | | uiua_fmt | [https://github.com/uiua-lang/uiua](https://github.com/uiua-lang/uiua) | | usort | [https://github.com/facebook/usort](https://github.com/facebook/usort) | diff --git a/mdsf/src/formatters/mod.rs b/mdsf/src/formatters/mod.rs index 9026cb7..2346444 100644 --- a/mdsf/src/formatters/mod.rs +++ b/mdsf/src/formatters/mod.rs @@ -175,6 +175,7 @@ mod ts_standard; mod twig_cs_fixer; mod typos; mod typstfmt; +mod typstyle; mod ufmt; mod uiua; mod usort; @@ -1032,6 +1033,10 @@ pub enum Tooling { #[serde(rename = "typstfmt")] Typstfmt, + #[doc = "https://github.com/Enter-tainer/typstyle"] + #[serde(rename = "typstyle")] + Typstyle, + #[doc = "https://github.com/omnilib/ufmt"] #[serde(rename = "ufmt")] Ufmt, @@ -1268,6 +1273,7 @@ impl Tooling { Self::TwigCsFixer => twig_cs_fixer::run(snippet_path), Self::Typos => typos::run(snippet_path), Self::Typstfmt => typstfmt::run(snippet_path), + Self::Typstyle => typstyle::run(snippet_path), Self::Ufmt => ufmt::run(snippet_path), Self::UiuaFmt => uiua::run_fmt(snippet_path), Self::Usort => usort::run(snippet_path), @@ -1459,6 +1465,7 @@ impl AsRef for Tooling { Self::TwigCsFixer => "twig-cs-fixer", Self::Typos => "typos", Self::Typstfmt => "typstfmt", + Self::Typstyle => "typstyle", Self::Ufmt => "ufmt", Self::UiuaFmt => "uiua_fmt", Self::Usort => "usort", diff --git a/mdsf/src/formatters/typstyle.rs b/mdsf/src/formatters/typstyle.rs new file mode 100644 index 0000000..777b701 --- /dev/null +++ b/mdsf/src/formatters/typstyle.rs @@ -0,0 +1,11 @@ +use super::execute_command; +use crate::{error::MdsfError, runners::CommandType}; + +#[inline] +pub fn run(snippet_path: &std::path::Path) -> Result<(bool, Option), MdsfError> { + let mut cmd = CommandType::Direct("typstyle").build(); + + cmd.arg("-i").arg(snippet_path); + + execute_command(cmd, snippet_path) +} diff --git a/schemas/v0.2.7/mdsf.schema.json b/schemas/v0.2.7/mdsf.schema.json index c66133c..7676336 100644 --- a/schemas/v0.2.7/mdsf.schema.json +++ b/schemas/v0.2.7/mdsf.schema.json @@ -893,6 +893,11 @@ "type": "string", "enum": ["typstfmt"] }, + { + "description": "https://github.com/Enter-tainer/typstyle", + "type": "string", + "enum": ["typstyle"] + }, { "description": "https://github.com/omnilib/ufmt", "type": "string",