neorg icon indicating copy to clipboard operation
neorg copied to clipboard

feat(concealer): simpler config for ordered list icon & multichar icon for unorderd list

Open champignoom opened this issue 2 years ago • 2 comments

One can now configure the icon of ordered lists simply with a sample string that represents the iconf for index 1. The icons for the rest of indices will be calculated automatically.

For example:

["core.concealer"] = {
    config = {
        icons = {
            ordered = {
                icons = { "item 1.", "[0]", "A.", "a.", "§ 1)", "I.", "i.", "⒈", "⑴", "Ⓐ", "ⓐ" },
            },
        },
    },
},

the icons will be

  • item 1., item 2., ... for level 1
  • [0], [1], ... for level 2
  • A., B., ..., Z., AA., AB., ... for level 3
  • a., b., ..., z., aa., ab., ... for level 4
  • § 1), § 2), ... for level 5
  • I., II., III., IV., V., ..., MMMCMXCIX. for level 6
  • i., ii., iii., iv., v., ..., mmmcmxcix. for level 7
  • , , , ..., for level 8
  • etc

===EDIT===

Now unorderd list also supports multichar inline icon just as ordered list, for example:

["core.concealer"] = {
    config = {
        icons = {
            list= {
                icons = { "*", " +", "  -", "   >" },
            },
        },
    },
},

This emulates indentation=2 for the first four levels of unordered list:

* level-1
  + level-2 (indent=2)
    - level-3 (indent=4)
      > level-4 (indent=6)
       > level-5 (indent=7)
        > level-6 (indent=8)

So this PR should partially resolve https://github.com/nvim-neorg/neorg/issues/569.

champignoom avatar Nov 22 '23 07:11 champignoom

Are we sure doing calculations like these aren't performance intensive? If it's still fast then I think we can go with this configuration approach, sure :+1:

~~Also if you could fix the conflict please that would be great :P~~

vhyrro avatar Jan 06 '24 17:01 vhyrro

Are we sure doing calculations like these aren't performance intensive?

No, it calculates and memoizes the format string only once.

Also if you could fix the conflict please that would be great :P

Done.

champignoom avatar Jan 07 '24 12:01 champignoom