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

mdbook serve creates files linked from summary if they do not exist #1246

Closed
acheronfail opened this issue Jun 7, 2020 · 4 comments · Fixed by #1548
Closed

mdbook serve creates files linked from summary if they do not exist #1246

acheronfail opened this issue Jun 7, 2020 · 4 comments · Fixed by #1548
Labels
A-Documentation Area: Documentation E-Easy Experience: Easy

Comments

@acheronfail
Copy link

I'm relatively sure that this is a "feature" and not a bug, but the behaviour surprised me.

I created a SUMMARY.md like the following:

# Summary

- [Chapter 1](./chapter_1.md)
- [Chapter 2](#)

With the # uri as a placeholder since I hadn't yet created the file.
When I ran mdbook serve I was surprised to discover that the src/# file existed!

I guess this may be the behaviour described in the User Guide here:

When a SUMMARY.md file already exists, the init command will first parse it and generate the missing files according to the paths used in the SUMMARY.md. This allows you to think and create the whole structure of your book and then let mdBook generate it for you.

Should this also happen when running mdbook serve?

  • If so, it should probably be documented.
  • If not, should the behaviour be toggle-able via a CLI flag?
@acheronfail
Copy link
Author

This also adds an unfortunate side effect that if I run mdbook serve, and delete the file src/chapter_1.md, then when mdbook reloads it recreates the file I just deleted.

Which is another thing that seems counter-intuitive to me, since if I want to remove a note/delete a file, then I must remove it first from the SUMMARY.md and then delete the file itself...

@ehuss
Copy link
Contributor

ehuss commented Jun 7, 2020

Yea, that's intentional. It could probably be documented better.

As for the #, that's a little odd. It could probably detect fragment-only urls and reject them.

Also, FYI, the next release will support "draft" chapters, which allow you to add entries that won't automatically create new files (#1153).

@bikeshedder
Copy link
Contributor

The "draft" chapters feature has landed in 0.4.0. I think this issue can be closed.

@ehuss
Copy link
Contributor

ehuss commented Jul 21, 2020

Probably should still update the build, serve, and watch documentation to mention that missing files in the SUMMARY are auto-generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Documentation Area: Documentation E-Easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants