Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

Convincible
Copy link
Contributor

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 the content may contain both Markdown and Liquid tags at this point. For instance:

This site was last updated on: {{ site.time | date_to_string }}

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.