Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README about the header parsing policy for markdown ToC #5

Closed
ryul1206 opened this issue Jun 17, 2021 · 1 comment · Fixed by #6
Closed

Update README about the header parsing policy for markdown ToC #5

ryul1206 opened this issue Jun 17, 2021 · 1 comment · Fixed by #6
Labels
documentation Improvements or additions to documentation

Comments

@ryul1206
Copy link
Owner

The current code doesn't care about a neighborhood level but only cares about the level difference.
It means ### may be possible to appear after #.

# single_gen.py
.... 
92:    def append_toc(self, head, level):
93:        # if (self.prev_level + 1) == level:  # new child
94:        if self.prev_level < level:  # new child
95:            pass
...

However, the README only describes the strict rules below:

...
(Note) If you skip the title level of the markdown marked with #, an error will occur. In other words, the subtitle of ## must be ###.
...

Soft examples like below are much more flexible, so we need to test this.

# Title
### Subtitle1
### Subtitle2
@ryul1206 ryul1206 added the documentation Improvements or additions to documentation label Jun 17, 2021
@ryul1206
Copy link
Owner Author

ryul1206 commented Jul 2, 2021

On second thought, this example below doesn't make sense because it will crash an indentation of ToC.

# Title
### Subtitle1
### Subtitle2

So I revert the code from self.prev_level < level to (self.prev_level + 1) == level and close this issue.

ryul1206 added a commit that referenced this issue Jul 2, 2021
@ryul1206 ryul1206 linked a pull request Jul 2, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant