dprint / dprint-plugin-markdown

Markdown code formatting plugin for dprint.
MIT License
25 stars 9 forks source link

Allow trailing words in info string #81

Closed mgeisler closed 1 year ago

mgeisler commented 1 year ago

Thank you for the formatter, I like it a lot!

In Comprehensive Rust, we use the mdbook code block attributes extensively. So we write

```rust,editable
fn main() { }
```

all over the place. An example is in our page about enums.

Right now, it seems like dprint doesn't parse (and ignore) the ,editable part of the code block info string. The result is that the code blocks aren't formatted as Rust like I had hoped.

The spec says:

The first word of the info string is typically used to specify the language of the code sample, and rendered in the class attribute of the code tag. However, this spec does not mandate any particular treatment of the info string.

which implies to me that mdbook should use spaces, not commas, to tack on more information to the code block.

Could dprint be updated to support trailing information, separated by either space or comma?

dsherret commented 1 year ago

@mgeisler would you be able to add an example?

mgeisler commented 1 year ago

@mgeisler would you be able to add an example?

Sorry, I submitted the issue much too soon :smile:

dsherret commented 1 year ago

Run dprint config update then dprint fmt in the repo and it should be implemented now.

mgeisler commented 1 year ago

Run dprint config update then dprint fmt in the repo and it should be implemented now.

Wow, this is amazing! Works very well, thank you so much!