zoottelkeeper-obsidian-plugin icon indicating copy to clipboard operation
zoottelkeeper-obsidian-plugin copied to clipboard

[Feature]: Custom List Styles

Open tristonlees opened this issue 2 years ago • 1 comments

There is currently a limitation that only three 'List Styles' are possible. What I suggest is the ability to define custom styles in the settings.

Most simply, I guess this could be done by replacing the dropdown with two text fields. One for a prefix and another for a suffix. These variables would then replace the switch statement in generateFormattedIndexItem; used to return the completed element prefix + '[[${path}]]' + suffix.

The above worked for me, though, as a quick hack. There should probably remain the current option of choosing from the preset styles plus 'other' in the dropdown. Only if 'other' were chosen would the user then be prompted to give a custom prefix and suffix.

Even better would be to give a whole string that somehow delimited where the data ([[${path}]]) would be inserted.

tristonlees avatar Aug 30 '21 03:08 tristonlees

An alternative UI approach would be to have both drop-down and custom text field.

The drop-down has the current options, plus 'custom'. Whenever any default option is selected, that template text gets put into the free-form text field. (Manually selecting 'custom' simply does nothing.) Whenever the text gets modified, the drop-down choice changes to 'custom'.

The code can then always use the text field contents without deciding based on the mode. Users can directly see different example templates (so they might not need any further explanation) and adjust them without first having to re-create the thing that they want to tweak.


(Interested in this, because I'd like a compact listing style – e.g. a comma-separated list of links on a single line. "foo, bar, baz, ...")

229c9cf0 avatar Feb 10 '22 15:02 229c9cf0