executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
730 stars 192 forks source link

Emit include-read event #881

Closed sumezulike closed 4 months ago

sumezulike commented 5 months ago

Describe the feature you'd like to request

Sphinx added an include-read event with 7.2.5 that is emitted after an include directive is processed. It would be helpful to implement that for the MyST include directive too.

Describe the solution you'd like

The "include-read" event could be emitted immediately after the file is read like Sphinx does it.

Maybe adding this in MockIncludeDirective is good enough?

# Emit the "include-read" event
arg = [file_content]
self.renderer.sphinx_env.app.events.emit("include-read", path, self.renderer.sphinx_env.docname, arg)
file_content = arg[0]

Describe alternatives you've considered

No response

welcome[bot] commented 5 months ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada: