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

Add failing test for toc in file with no headings #288

Merged
merged 1 commit into from
Sep 1, 2020

Conversation

claremacrae
Copy link
Contributor

From https://twitter.com/ClareMacraeUK/status/1300386326852915200

A tiny comment - I added a toc line to a file with no headings, so if headings are ever added the toc will appear... mdsnippets deleted the toc line, to the change got lost...

This adds a test case for that scenario.

In the verified file, I opted for leaving this text in place if there are no headings present:

<!-- toc -->
<!-- endToc -->

@SimonCropp SimonCropp merged commit a3a7424 into SimonCropp:master Sep 1, 2020
@SimonCropp
Copy link
Owner

@claremacrae thanks for the PR. can u try 21.0.1

@SimonCropp SimonCropp added this to the 21.0.1 milestone Sep 1, 2020
@SimonCropp SimonCropp added the Bug label Sep 1, 2020
@claremacrae
Copy link
Contributor Author

@claremacrae thanks for the PR. can u try 21.0.1

I can confirm that 21.0.1 does put the placeholder text in place when there are no headings.

And also, if I later add a heading and rerun, that heading does correctly get inserted inside the placeholder toc tags!

I'm using this in a private GitHub wiki repo, to add tables of contents, now that inplace generation is supported.

Great stuff! Thanks @SimonCropp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants