New `Category` Attribute/Field in LangDefs, Themes and Plugins
I think it would be cool to add a
category field to the langDef metadata.
I've seen it used in Highlight.js — although it's an undocumented feature, most syntaxes do have the
category set, most likely to allow grouping syntaxes according to "Language categories" in the website preview:
In the HJS website this allows to quickly select groups of related syntaxes examples. Currently the supported categories by HJS are:
Highlight could also implement a
categories attribute, allowing each syntax to belong to one or more categories.
The command line tool could then allow to filter the list of supported languages (via
--list-scripts=langs) by including/excluding one or more categories via some switch like
--categories:<cat>[,<cat>]. But this could hold true also for themes and plugins — with the latter being more useful, as it would allow to filter plugins according to their functionality, but themes could also benefit from a "light" vs "dark" filter, or "base16", "editor", etc.!
I'm not sure how the filtering system should work, but ideally it should allow to narrow down the list to syntaxes that match the passed categories — but possibly some operators could improve this by allowing AND and OR conditions to act on the the filter. I just can't think of a good practical example of how the syntax should work, but one might wish to filter themes that must be "base16", "dark", have "high contrast" colors and NOT pastel.
The whole purpose of this filter would be to simplify seeing which syntaxes of any given kind are supported. E.g. "interactive fiction", "assembly", "scripting", "markup", etc. In some cases, multiple filters make sense (eg, "assembly"+"x86", since Assembly covers many architectures); or to filter themes and plugins according to various criteria. This could be useful in both manual searches and automated tasks.
With themes now being around 200 in total, this feature could really help narrow down selections by category keywords; this could also be implemented in Highlight GUI to effectively filter down the list of choosable themes in the dropdown menu.
Of course, this features should be well thought, providing some sensible guidelines to the categories for langDefs, themes and plugins, to prevent duplicates by differently spelled same-keywords, or categories overload — although as a general principle users should be free to add keywords that make sense to their contributed material.
What's your view on this feature request? Does it make sense? Is it worth implementing for langs, themes and plugins at once, or maybe it makes sense for some types of scripts only (eg. themes)?