markdown-it-rust / markdown-it

markdown-it js library rewritten in rust
Other
79 stars 9 forks source link

[Broken] Exclude generated code from formatting #3

Closed black-puppydog closed 1 year ago

black-puppydog commented 1 year ago

Hi, I'm currently using markdown-it.rs as a base to build a rust port of the ssb-markdown module. Kind of as a learning exercise. Suffice it to say I've learned much more about Unicode and Emojis than anything else. 🙈 In any case, thanks for this library! I've found it quite pleasant to work with and hadn't seen the need to modify the library as such, so far.

One thing I'm attempting right now is to port more of the markdown-it test suite, to reproduce more of the custom formatting. For example I think that smartypants typography (smart quotes and such) might be generally useful enough to be included in this library? Even if not, I can worry about breaking such things into separate files later.

To the actual topic here:

My first order of the day was to do cargo fmt because my IDE is set up to use it on save and I didn't want to litter the commit logs with half-formatted things. So I modified testgen.js to include a #[rustfmt::skip] call before each test mode, such that the auto-generated code wouldn't be subject to formatting and everyone could be happy. Re-generating the code for common-mark.rs worked like a charm, you can see that it only added the #[rustfmt::skip] line. For markdown-it.rs however there seems to have been some other issue; there is another change being generated and indeed that test now fails.

Any idea why this might happen?

black-puppydog commented 1 year ago

Since I found a fix for this in #4 I think this one could be closed. However, I'd like to take the opportunity to check whether you'd be up for applying cargo fmt and enforcing strict formatting in CI.

I'd be happy to make a PR to this effect, I think it would make working with the codebase much nicer. :)