MarkBind / markbind

MarkBind is a tool for generating content-heavy websites from source files in Markdown format
https://markbind.org/
MIT License
134 stars 123 forks source link

text-icons of lists: give a way to auto-increment #2490

Closed damithc closed 2 months ago

damithc commented 3 months ago

Current: The text value need to be specified for each list item.

e.g.,

* item 1 { text="(a)" }
* item 1 { text="(b)" }
* item 1 { text="(c)" }

Suggestion: provide a shorter syntax that auto-increments the text.

A simple approach:

* item 1 { texts="(a),(b),(c)" }
* item 1
* item 1
yucheng11122017 commented 3 months ago

Hmm should it be split by ,? What if the text itself has , inside or other seperators? Is it possible to use an array instead for this attribute?

Does this need to be applied for other things as well like icons?

Also, if the user only specifies 2 things, but there are 3 in the list, it should inherit from the last item right.

damithc commented 3 months ago

Thanks for the follow up @yucheng11122017

Hmm should it be split by ,? What if the text itself has , inside or other seperators?

, is an example. Can use something else. Also, can use \, to escape.

Is it possible to use an array instead for this attribute?

Yes, that might work as well.

Does this need to be applied for other things as well like icons?

Icons already follow a 'repeat until changed' logic. Text doesn't have any such logic.

Also, if the user only specifies 2 things, but there are 3 in the list, it should inherit from the last item right.

I think it should stop after 2 items. Text doesn't inherit (i.e., repeat until changed), like the way icons do.

yucheng11122017 commented 3 months ago

Icons already follow a 'repeat until changed' logic. Text doesn't have any such logic.

@damithc text also has the same logic as icons! It will be repeated until it is changed. Same for other text attributes.

I think probably the best way going forward is

will make the bullet points for item 1, 2, 3 (a), (b) and (c) respectively. sub level's bullet will be non customised.

damithc commented 3 months ago

@damithc text also has the same logic as icons! It will be repeated until it is changed.

Oh, I didn't realize that.

  • texts is an array eg. ["a", "b", "c"]

What's the exact syntax?

  • The last item will be used to continue if there is insufficient items
  • It will only apply to the same level (similiar logic to currently)

Yes, that works.

yucheng11122017 commented 3 months ago

What's the exact syntax?

yiwen101 commented 2 months ago
  • ["a", "b", "c"]

Hi yucheng, thank you for proposing this; IMAGE 2024-04-15 14:10:40

However, it seems the not easy to parse an array of string correctly. How do you find the idea of just make do with using "," as separator? eg: { texts="(a),(b),(c)" } as prof's initial proposal. This makes parsing much simpler