Skip to content

Commit 89ad170

Browse files
authored
🐛 FIX: Ensure parent files are re-built if include file changes (#451)
1 parent 4c8aebe commit 89ad170

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

myst_parser/mocking.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,15 @@ def run(self) -> List[nodes.Element]:
357357
# i.e. relative to source directory
358358
try:
359359
sphinx_env = self.document.settings.env
360-
_, include_arg = sphinx_env.relfn2path(self.arguments[0])
361-
sphinx_env.note_included(include_arg)
362360
except AttributeError:
363361
pass
362+
else:
363+
_, include_arg = sphinx_env.relfn2path(self.arguments[0])
364+
sphinx_env.note_included(include_arg)
364365
path = Path(include_arg)
365366
path = source_dir.joinpath(path)
367+
# this ensures that the parent file is rebuilt if the included file changes
368+
self.document.settings.record_dependencies.add(str(path))
366369

367370
# read file
368371
encoding = self.options.get("encoding", self.document.settings.input_encoding)

0 commit comments

Comments
 (0)