Closed khoulihan closed 4 years ago
This is mostly completed, just a few relevant pseudo-classes to implement and the column combinator.
I guess there is a bit of a problem with using this approach actually. If I use this to specify a different paragraph renderer for paragraphs within blockquotes, for example, if a user implements their own paragraph renderer then they need to remember to also apply it to the "blockquote > p" selector with the same settings to ensure proper rendering of paragraphs in that context...
Maybe I should try to implement a sort of cascade, where all matching directives are compared based on their specificity. Specifying a renderer could be optional, and if only settings are specified then overrides occur in order of specificity, while obviously the most specific renderer is used.
I added this "cascading" functionality.
It would be cool to be able to specify renderers using the syntax of CSS selectors instead of just one renderer type per tag. For example, "li p" would match paragraphs that are children of list items, "div.annotation" would match divs with the class "annotation", and so on. This will help avoid the need for special cases I think, and the internal use of the extension override methods.
Unlike actual CSS, this would have to choose a single best match, rather than cascading the styles, unless I want to rewrite the whole thing to parse CSS or something.