markdown-tools icon indicating copy to clipboard operation
markdown-tools copied to clipboard

make numbers start at 1 not zero?

Open gingerling opened this issue 4 years ago • 6 comments

Hi the heading numbers start with 0 not a 1, which is confusing for me. Is it possible to make them start with a 1?

gingerling avatar Mar 26 '20 20:03 gingerling

They start with 1 not 0. I am unable to replicate the problem you are seeing, can you give me more information. Make sure you are also using the current version.

You can see at line 146 I declare the tracking array for the heading levels. They are initialized at zero with: 146: var numbers = [0,0,0,0,0,0,0];

Then at line 173 the heading level is incremented before it used: 173: numbers[headerlevel]++;

You may try to uninstall and reinstall to make sure you have the current version from the G Suite Marketplace: https://gsuite.google.com/marketplace/app/markdown_tools/788541604518

jordan2175 avatar Mar 26 '20 21:03 jordan2175

Hi I made a video: https://greencloud.gn.apc.org/index.php/s/YmPa5WXaLSjxscP Reinstall didn't change the issue

The only other thing I noted is that my h2's (3 of them) began with an "I" and the "I" (i) is removed when I use the "clear heading numbers issue"

gingerling avatar Mar 27 '20 14:03 gingerling

That is by design because you do not have an H1 heading, you started with H2. For example:

H2 Test H2 Fun H1 Title Section

Would give you

0.1 Test 0.2 Fun 1 Title Section

If you add an H1 before your H2s, then everything works. Do most of your documents usually start without an H1? Like you start with H2s or H3s?

jordan2175 avatar Mar 27 '20 16:03 jordan2175

Yes, that worked, thanks! So in order to get each section to be 1, 2, 3 I have to use H1 for the sections?

I usually use Title and then H2, mostly the font size is more reasonable, I've never wanted to get into changing the formatting etc, I only really use them this way so I can get a content table with links, but because many subheadings are the same in this case I thought it would be better to have numbers.

So, regarding the I being deleted when numbers are removed - can you replicate that?

gingerling avatar Mar 27 '20 19:03 gingerling

Yeah, that is a known issue with needing to support letters. I have wondered if I should remove support for heading numbers by letters.

jordan2175 avatar Mar 28 '20 20:03 jordan2175

Ah, okay. I guess it's up to you - it seems like either just numbers or a number letter combo is most useful, but as you can tell I am no expert. Maybe if you knew how much it was being used for letters that would be helpful. And an amazing feature would be to "refresh heading numbers".

Thanks for your help and a super useful plugin, it really solved a big issue for me.

Btw, did you notice that the only other plugin for this is no longer functional? I think it's abandoned. So it's all down to you now ;)

gingerling avatar Mar 28 '20 21:03 gingerling