New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hook to modify rendered content without layout #4752
Conversation
Renderer is handled by more than "posts", I like the premise but I think the name should be more generic, especially since it will be tapped by more than one type of document at the end of the day. |
The "post" in |
|
Good point. I like |
LGTM. /cc @jekyll/core @jekyll/stability @jekyll/build |
What do you think about |
@parkr I like that too, even if it deviates from what we already have (but I think it fits.) Considering we could have potentially dozens of hooks that aren't exactly pre/post and just a single action it makes a lot of sense. |
I don't mind what it's called. Is everyone happy with |
I'm 👍 on it. |
@johnkhughes |
Slaps forehead |
@@ -67,6 +67,10 @@ def run | |||
output = convert(output) | |||
document.content = output | |||
|
|||
# Hook to modify converted content before layout is applied | |||
document.trigger_hooks(:post_convert, output) | |||
output = document.content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will do what you think it will do.
Can you write a test for this? In features/hooks.feature
is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur, we shouldn't assume users are destructive and should instead encourage them to return their modified content, especially since we've an open ticket to start freezing all our strings, this will certainly impede that and delay it much further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@parkr Possibly a stupid question, but how do I write a test?
I'm still interested in sorting this out if anyone can help get me started with writing a test for it. |
@johnkhughes Did you take a look at https://github.com/jekyll/jekyll/blob/master/features/hooks.feature ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This comment has been minimized.
This comment has been minimized.
I'm interested in this feature. Is it waiting for anything before being merged in? |
It has an approved review, but does not have tests, so I am not sure what the status is. |
@johnkhughes Are you still willing to ship that feature and add the missing tests? |
I think it would be helpful to have this! |
Lets you modify the content as HTML without affecting the HTML of the rest of the page. Addresses issue #4714.