-
Notifications
You must be signed in to change notification settings - Fork 80
-
Just like turning
Heading 1......
Heading 1 1......
Heading 2......
Heading 2 1......
Heading 2 1 1......
Heading 2 1 2......
Heading 2 2......
Heading 2 2 1......
into the following format
1 Heading 1......
1.1 Heading 1 1......
2 Heading 2......
2.1 Heading 2 1......
2.1.1 Heading 2 1 1......
2.1.2 Heading 2 1 2......
2.2 Heading 2 2......
2.2.1 Heading 2 2 1......
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
Yes, you can. The heading.icons value can be defined as a function that returns a string, that returned value is what we'll render for the icon. In that function you have access to a sections property which is a list of integers indicating that index information.
Based on your example here's what you would do:
require('render-markdown').setup({ heading = { icons = function(ctx) return table.concat(ctx.sections, '.') .. ' ' end, }, })
You're free to change this however you feel, maybe adding an icon in some cases, changing how the values are joined together, changing the suffix, it's all completely up to you.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you so much! It works perfectly!
Beta Was this translation helpful? Give feedback.