Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define a maximum number of characters per line #100

Open
Nexucis opened this issue Jan 16, 2023 · 5 comments
Open

Define a maximum number of characters per line #100

Nexucis opened this issue Jan 16, 2023 · 5 comments

Comments

@Nexucis
Copy link

Nexucis commented Jan 16, 2023

Hi,

It would be nice to be able to define the number of characters per line for the command mdox fmt. Like that every paragraphs are not inline anymore and it's easier to read in IntelliJ for example.

Because then you don't need to scroll horizontally which is a pain to do it regardless how much your UI is awesome :).

If you find it interesting, I would probably take some time to implement it.

@saswatamcode
Copy link
Collaborator

Hi! So we already had this request previously here and added option in mdox to preserve soft line breaks in markdown (--soft-wraps), which essentially preserves any soft line breaks. For example, if you have the following markdown,

Path to directory where metrics are saved in
OpenMetrics format; If empty, no metrics will
be saved.

with mdox fmt file.md you'd get,

Path to directory where metrics are saved in OpenMetrics format; If empty, no metrics will be saved.

but with mdox fmt --soft-wraps file.md you'd get,

Path to directory where metrics are saved in
OpenMetrics format; If empty, no metrics will
be saved.

This option is already being used in prometheus-operator. Maybe this addresses your use case better? 🙂

@Nexucis
Copy link
Author

Nexucis commented Jan 16, 2023

Oh yeah that's already cool to have this option ! Thank you for pointing it, I didn't pay enough attention to the documentation.

I still think it would be cool to enforce a maximum length per line. So it's the breaks-line logic for everyone :).

@saswatamcode
Copy link
Collaborator

I see! I'm not opposed to line limits, and would be interested in a PR if you have some time. 🙂
But it might be difficult to implement as I expect there'll be some edge cases (uneven spacing, words, bullets etc.).

mdox internally uses https://github.com/Kunde21/markdownfmt for markdown formatting, so that might be a good place to start!

@Nexucis
Copy link
Author

Nexucis commented Jan 16, 2023

ah nice, thanks for the pointer ! I will look there then :).

@bwplotka
Copy link
Owner

bwplotka commented Jul 5, 2023

Still, it would be amazing to have auto-wrap with given width option e.g. --auto-wrap-max-chars=<num>. Help wanted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants