I would like to implement a css inline directly in the single markdown file (in content) for example as a shortcode {{< css style=”—– “ >}}or whatever.
For the time being, I have the following way in the single layout (extract)
Then you’re out of luck. Not to mention that your approach does not even need a shortcode: You could equally well test for .HasShortcode in, e.g., your footer partial and include the CSS there, if needed.
The reason is to avoid having a partial or whatever but having the possibility for any md file to include something like <style> background : #fff</style>
If I want to create a module that provides a shortcode (e.g., “gallery.html”), I would typically have to instruct site authors to (a) import the module in site config, and (b) add code to the base template to include module-specific CSS.
If I can somehow include the CSS in the shortcode itself, site authors don’t have to do the second part.
If it were me, I’d use JavaScript to inject a name-spaced style element into the head element. For example:
git clone --single-branch -b hugo-forum-topic-56102 https://github.com/jmooring/hugo-testing hugo-forum-topic-56102
cd hugo-forum-topic-56102
hugo server