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.
Plugin rationale
When using other static content generating platforms, I found that I often used available constructs to generate thumbnail links to full size images on-the-fly from within posts. The facility for generating thumbnails in Hyde via
ImageThumbnailsPlugin
is quite static in that it must be defined in the configuration files external from the blog posts. Also, to generate a linked thumbnail pointing towards a full size image, one would at first need to define the thumbnail generating configuration in themeta.yaml
, with file name matching and hard-coded dimensions, and then write something like:in the markup to generate the link, remembering the specific prefix.
Plugin description
ImageThumblinksPlugin
(notelinks
vsnails
) enables a direct syntax for generating thumbnails from within the document. After the plugin is enabled in the site configuration, a line like this in the markup:will automatically generate the thumbnail itself during site generation using existing functions (parameters in the above example will be: width undefined, height 300 pixels; see the existing
ImageThumbnailsPlugin.thumb()
for information on the parameters) and create the link of the earlier mentioned form.It does not clash with any existing functions to my knowledge. It needs to be loaded before
TextlinksPlugin
to work, though.The code is almost over-the-top documented with inline comments, since I find that looking at the code is of great use until the Hyde documentation in general gets major updates.
Lingering issues
I get error messages like
from
hyde -v serve
when loading any of the thumbnails generated from this plugin. However, the images load fine in the browser. The thumbnail creation is handled fully by the functions in the existingImageThumbnailsPlugin
class, and those images do not give the error message. I have not been able to find the problem. As it does not affect the actual generation or the serving, I'm guessing it is some meta registration of resources that is not done correctly, for some reason.I do not know if the markup syntax clashes with other plugins, or if there is a more natural syntax that should be followed by convention.
This plugin must be loaded before
TextlinksPlugin
in order for that plugin to post-process the generated syntax. Perhaps this could be solved by explicitly calling that plugin from within this one, but enforcing a plugin load order as right now might be clearer.Possible enhancements
ImageThumbnailsPlugin
, and is perhaps not an actual issue. Cleaning out the thumbnail folder manually solves this in a simple way. There might be use cases where one would not want to remove the thumbnail even if it is not referenced in any local posts, e.g. for external hotlinking purposes. This would be easily solved by moving the image from the.thumbnail
folder to themedia
path, though.ImageThumblinksPlugin
syntax. They could be added without problem, but I personally can not really see a use case for them, and if they were to be added, it would be good to know if the current parameter syntax was OK beforehand.