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.
This is a 🙋 feature or enhancement.
Summary
Adds a new
:pre_convert
hook that is triggered immediately after a page, post or document is processed for Liquid tags, but before it is sent to the converter to generate HTML. This allows the final Markdown to be modified or read by a plugin before it is converted.Context
Modifying or reading the file's Markdown content may be useful or essential for different kinds of plugins.
Although the Markdown content can be accessed from
:pre_render
, this is prior to Liquid tags being evaluated, and consequently thecontent
may contain both Markdown and Liquid tags at this point. For instance:In this case, the plugin author wishes to work with the final string of "This site was last updated on: 25 July 2024".
There are a number of reasons why modifying or reading the final Markdown, as opposed to modifying or reading the final HTML (using
:post_convert
), may be preferable to the plugin author. One reason might be that it is closer to a plain text string, which may simplify parsing or pattern matching to achieve the plugin's goals. Another might be that the plugin author wishes to write a plugin that assumes the format of the input (e.g. Markdown) but not the output of the converter (which may vary across Jekyll installations).The new hook is fully tested and documented, although I haven't referred to a Jekyll version number in which the new hook would be available.