naokazuterada / MarkdownTOC

SublimeText3 plugin which generate a table of contents (TOC) in a markdown document.
https://packagecontrol.io/packages/MarkdownTOC
MIT License
301 stars 48 forks source link

Removed automatic zero-indenting for first item in generated list for TOC, not respecting the actual Markdown header formatting. #65

Closed jonasbn closed 8 years ago

jonasbn commented 8 years ago

I know this might be considered a regression, but it bothers me that the rendered TOC does not respect the actual Markdown headers.

Currently a markdown list like:

a

b

Would render:

Because the first element would have indentation reset.

This change allows you to do:

TOC

a

b

And have it rendered:

TOC

More intuitively.

Some users might find this problematic depending on their use case, but I prefer to have the Markdown shape the decision on the actual indentation.

Thanks for a marvellous plugin btw.


This change is Reviewable

naokazuterada commented 8 years ago

Thank you for your PR!!

I'm sorry but I can't remember why this line was needed.

I also checked this markdown correctly rendered, then I merge your PR.

<!-- MarkdownTOC -->

  - a
- b

<!-- /MarkdownTOC -->

## a

# b
jonasbn commented 8 years ago

Hi,

Well my assumption is that you would like to have an ordered and nicely looking TOC. The fix/removal makes it more literal. So if you have heading you do not want displayed in the TOC, place them above the TOC section. Well that is the use-case for me.

naokazuterada commented 8 years ago

Ummm sorry, I cannot understand what you mean exactly...

In fact I couldn't find the behavior you mentioned.

Currently a markdown list like:

a

b

Would render:

  • a
    • b

Is it like below in your environment?

<!-- MarkdownTOC -->

- a
    - b

<!-- /MarkdownTOC -->

### a

### b

But it is like below in my environment. (of-course before merging PR)

<!-- MarkdownTOC -->

- a
- b

<!-- /MarkdownTOC -->

### a

### b

It's caused by this lines, I fix the shallowest depth to no indent.

Sorry for my bad english. 😵 Please explain your wish more easy to understand, If you don't mind.