neorg
neorg copied to clipboard
feat(concealer): simpler config for ordered list icon & multichar icon for unorderd list
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 2A.,B., ...,Z.,AA.,AB., ... for level 3a.,b., ...,z.,aa.,ab., ... for level 4§ 1),§ 2), ... for level 5I.,II.,III.,IV.,V., ...,MMMCMXCIX.for level 6i.,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.
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~~
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.