fix: watch pymdownx.snippets auto_append files for changes#418
Merged
squidfunk merged 2 commits intozensical:masterfrom Mar 10, 2026
Merged
fix: watch pymdownx.snippets auto_append files for changes#418squidfunk merged 2 commits intozensical:masterfrom
squidfunk merged 2 commits intozensical:masterfrom
Conversation
|
All commits verified and signed off. |
435d18d to
e6bc595
Compare
) Abbreviations and other content added via `pymdownx.snippets` auto_append were not reflected in the served site unless the including `.md` file was also modified, because the included files were neither watched nor factored into the cache key. Collect the files referenced in `pymdownx.snippets.auto_append` (resolved against the configured `base_path` directories) and expose them as `snippet_files` in the project configuration, mirroring the existing `source_files` mechanism used for mkdocstrings. The watcher now monitors these files and triggers a full pipeline restart when any of them change, ensuring all pages that include them are rebuilt with the updated content. Signed-off-by: Pratyush Sharma <56130065+pratyush618@users.noreply.github.com>
e6bc595 to
04a7ddf
Compare
Signed-off-by: squidfunk <martin.donath@squidfunk.com>
40db094 to
44d659d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #148.
Summary
pymdownx.snippetsauto_appendwere not reflected in the served site unless the including.mdfile was also modifiedincludes/abbreviations.md) were neither watched by the file watcher nor factored into the cache key.cachedirectory was the only workaroundChanges
Follows the same pattern as
source_files(used for mkdocstrings):python/zensical/config.py: Added_list_snippet_files()which resolves each entry inpymdownx.snippets.auto_appendagainst the configuredbase_pathdirectories (defaulting to"."), collecting the file paths and their mtimes assnippet_filescrates/zensical/src/config/project.rs: Addedsnippet_files: Vec<(PathBuf, u64)>toProject— becauseProjectderivesHash, a change in mtime automatically invalidates all page cachescrates/zensical/src/watcher.rs: Watch snippet files and trigger a full pipeline restart (Error::Disconnected) when any of them change, so all pages that include them are rebuilt