termimad icon indicating copy to clipboard operation
termimad copied to clipboard

Feature request: please add custom style syntax

Open lucatrv opened this issue 2 years ago • 1 comments

First of all thank you for this great crate! I am using termimad to implement a CLI tool which should output text in different colors, not related to bold, italic, code, or strikeout styles. In other words, once I have personalized my bold / italic / code / strikeout styles, then I also need to apply different colors to both stylized and normal text. It would be great to add the possibility to define new custom syntax. For instance, with reference to the following example:

skin.strikeout = CompoundStyle::new(Some(Red), None, Bold.into());

since I need to keep the strikeout style for some text, and also apply red bold style to some other text, it would be great to be able to write something like:

skin.custom_style("rb") = CompoundStyle::new(Some(Red), None, Bold.into());

and then apply it for instance as:

termimad::print_inline("#rb#red bold text!#rb#");

lucatrv avatar Feb 05 '23 23:02 lucatrv

Thanks for the issue. This would probably be one of the best ways to overcome the obvious limitations of the Markdown approach. And I should probably work in this direction.

Before that, note a solution I use, which is to use dedicated skins. For example in safecloset: https://github.com/Canop/safecloset/blob/main/src/tui/skin/status_skin.rs

Canop avatar Feb 06 '23 07:02 Canop