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

Feature request: please add custom style syntax #39

Open
lucatrv opened this issue Feb 5, 2023 · 1 comment
Open

Feature request: please add custom style syntax #39

lucatrv opened this issue Feb 5, 2023 · 1 comment

Comments

@lucatrv
Copy link

lucatrv commented Feb 5, 2023

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#");
@Canop
Copy link
Owner

Canop commented Feb 6, 2023

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

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

2 participants