Skip to content

Commit

Permalink
feat(formatters): support typstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
hougesen committed Oct 11, 2024
1 parent 2a56e62 commit 3b4d70f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ mdsf init
<!-- START_SECTION:supported-tools -->

`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 |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -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) |
Expand Down
7 changes: 7 additions & 0 deletions mdsf/src/formatters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ mod ts_standard;
mod twig_cs_fixer;
mod typos;
mod typstfmt;
mod typstyle;
mod ufmt;
mod uiua;
mod usort;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -1459,6 +1465,7 @@ impl AsRef<str> 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",
Expand Down
11 changes: 11 additions & 0 deletions mdsf/src/formatters/typstyle.rs
Original file line number Diff line number Diff line change
@@ -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<String>), MdsfError> {
let mut cmd = CommandType::Direct("typstyle").build();

cmd.arg("-i").arg(snippet_path);

execute_command(cmd, snippet_path)
}
5 changes: 5 additions & 0 deletions schemas/v0.2.7/mdsf.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 3b4d70f

Please sign in to comment.