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

Text decorator functions for all elements? #27

Open
robinkrahl opened this issue Jul 21, 2020 · 1 comment
Open

Text decorator functions for all elements? #27

robinkrahl opened this issue Jul 21, 2020 · 1 comment

Comments

@robinkrahl
Copy link
Contributor

Is it possible to implement text decorator functions for all elements? The current implementations for plain and rich text are already very helpful, but I would like to tweak the appearance of some specific elements. Let’s say I want to print headings with a bold typeface or I want to set the color based on the element’s class. This could be done with functions like:

fn decorate_element_start(&self, name: &str, attrs: HashMap<String, String>) -> Self::Annotation
fn decorate_element_end(&self, name: &str) -> Self::Annotation
@jugglerchris
Copy link
Owner

That sounds potentially useful, and could become part of the solution for #20.

I'm slightly concerned at the overhead (creating hash maps and calling the decorator for every element), but I guess the compiler could remove most of that for decorators which don't make use of it.

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