Skip to content

New exclude_docs config: gitignore-like patterns of files to exclude#3224

Merged
oprypin merged 9 commits intomasterfrom
ignore
Jun 11, 2023
Merged

New exclude_docs config: gitignore-like patterns of files to exclude#3224
oprypin merged 9 commits intomasterfrom
ignore

Conversation

@oprypin
Copy link
Copy Markdown

@oprypin oprypin commented May 19, 2023

These files will not be picked up into the Files collection and as such, also the final built site.

Also adds the ability to un-ignore the files that MkDocs forcibly ignores.

@oprypin

This comment was marked as abuse.

@oprypin

This comment was marked as abuse.

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented May 20, 2023

That would be really useful indeed. I wonder if the corresponding nav entry for a given excluded file/page should also be removed when building, because when I write something for my blog I have to comment/uncomment the post in the nav until it's ready.

Oleh Prypin added 7 commits May 28, 2023 23:08
These files will not be picked up into the `Files` collection and as such, also the final built site.

Also adds the ability to *un*-ignore the files that MkDocs forcibly ignores.
* Docs that match any of the `not_in_nav` patterns will not produce warnings about never being included into the nav.

* Files that are excluded by `exclude_docs` will now be preserved in the `Files` collection and will even be rendered but only in `mkdocs serve` mode - such files will have a `DRAFT` notice prepended to the content.
…then serve

Also rename `--dirtyreload` flag to `--dirty` (keep the old name working)
@oprypin

This comment was marked as abuse.

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Jun 1, 2023

Seems to be working fine, thanks @oprypin 🙂
I'd still love not to have to comment items in the nav while they're being worked on, though this is probably another feature and could be implemented in a plugin.

What's the reason for multiline strings instead of arrays for the config settings?

@oprypin

This comment was marked as abuse.

@oprypin

This comment was marked as abuse.

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Jun 1, 2023

Could you provide arguments for your case?

Hmmm I think my main argument would be that such a feature would allow me to exclude a file and remove the corresponding nav entry automatically, until I'm ready to publish it, and in which case I either move the file around or stop excluding it. In short: exclude it once when you start working on it, re-include it once when you're ready. Without such a feature, I constantly have to comment/uncomment the nav entry in mkdocs.yml, at least if I publish other things while working on the draft. This is annoying but not critical. It's probably possible to write a plugin that does that.

@oprypin

This comment was marked as abuse.

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Jun 1, 2023

Hmm but you could just not add it to the nav until it's ready?

Yeah true, I guess I'm lazy and don't want to type the URL myself instead of clicking 🤔
Your counter argument is a good one, silently doing things will be create confusion.

I remember Jekyll had some first-class support for drafts. I'll check again how it works to see if there's something we can improve in MkDocs 🙂

@oprypin

This comment was marked as abuse.

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Jun 1, 2023

That would be nice yes :)

Oleh Prypin added 2 commits June 3, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants