Open alexreg opened 5 years ago
Thanks @alexreg. Due to the way CLI options are parsed, this might need to be implemented as:
"inline": [ "+", "li" ]
And
"inline": [ "-", "a" ]
@bitwiseman Sure. I mean, that's slightly less intuitive, but if it makes the implementation a lot easier, then sounds fair. Does the bonus feature (in either form) sound doable to you too?
@alexreg
Re Bonus feature:
It is possible, but it definitely won't be implemented as part if this feature.
Also, to be clear, it is unlikely I'll have time to implement it - it would need someone else to take ownership of it.
Please open a new issue and we can discuss it there.
Implementation would probably go in these two methods:
In
If we went with the "inline": [ "+", "li" ]
syntax, those methods would need to look at the first element in the array to determine if it was an add
or subtract
case instead of the default set
case.
As an alternative, those methods could look for option named <optionName>
and if not found take the default. Then look for <optionName>-add
followed by <optionName>-rm
and process those on top of the current value. Then return.
Description
I propose the addition of
include+
andinclude-
properties in the configuration options, which respectively add and remove items from theinclude
list. At the moment, only the entire list can be replaced/redefined, which is quite unergonomic and does not compose well with presets, etc.Bonus
It would be very useful to be able to specify a function to the option that takes an HTML node object as a parameter, and returns a boolean value to specify whether the element should be beautified (or conversely, whether it should be considered inline). Returning "undefined" would fall back to the static
include
/include+
/include-
properties in options. This feature would allow you to only inline for exampleul.classA > li
elements (to use CSS notation). Adding support for such CSS/jQuery notation to the existinginclude
family of properties is an alternative solution.Input
With this new feature, I expect this configuration:
to be equivalent to:
Likewise, I expect this configuration:
to be equivalent to: