auanasgheps / snapraid-aio-script

The definitive all-in-one SnapRAID script on Linux. Diff, sync, scrub are things of the past. Manage SnapRAID and much, much more!
GNU General Public License v3.0
231 stars 37 forks source link

Wrap snapraid cmd output to prevent invalid markdown formatting #11

Closed cmcginty closed 3 years ago

cmcginty commented 3 years ago

This tweaks the email output to correct some issues with the markdown formatting. The main part is wrapping the snapraid output in code blocks. This makes the formatting a lot nicer and also fixes the status output so it's easy to read.

I dropped the extra "echo" lines, since it doesn't impact the markdown output. If there is concern that it makes the text output worse, then I can add them back.

auanasgheps commented 3 years ago

This is a wonderful tweak! Since SnapRAID does not natively support markdown formatting, I thought this could never happen! I was always sad when seeing those broken tables.

I can see only one downside: wrapped text is not formatted. Do you think there's a way to change the font? If not, I'll still merge: it's a great change. image

cmcginty commented 3 years ago

Markdown does not have a way to change the font .. only the style like headings, bold, etc.

I don't understand the "wrapped text not formatted" issue. Do you have an example? If your device has a small screen and wraps the line, I don't think there is anything to do. The only solution is to to re-write all of the output from snapraid which would be very difficult and probably break after any new updates.

auanasgheps commented 3 years ago

What I meant is

I tested the output on my smartphone with Gmail and I can read the email correctly.

If you look at the screen I posted the messages we write are formatted (above) but the sync command is not (below).

cmcginty commented 3 years ago

Oh, right. Yeah you can't have formatting inside of the code blocks. Since snapraid doesn't output markdown format anyway, it's a mute point. The one exception is line "Everything OK" that was adjusted to be bolded by the script. Maybe in that case just write a new line after the command output?

auanasgheps commented 3 years ago

That's fine, I'll leave it as is. I made that message bold to add clarity but realized I never actually look at that part. So I'll merge, this is a very welcome change :)