-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
Milestone
Description
So, me implementing #14025 was triggered by this tweet: https://x.com/tobi/status/1973397055969104109
While the above should now be both possible and practical, it got me thinking:
- What if the outputs are defined as
[html, markdown]
- Subsequent output format renderings have access to the
io.Reader
of any previously rendered output format. Aio.Reader
for performance, but it should also be possible to turn into a string once with{{ $s := $myreader | string }}
With the transform.HTMLToMarkdown
as an example in layouts/all.markdown
:
{{ witn .Site.Published "html" }}
{{ transform.HTMLToMarkdown . | safeHTML }}
{{ end }}
The above assumes that transform.HTMLToMarkdown
gets rid of any irrelevant markup.
Note that I'm not totally sure how useful this is, but 'm jotting it down while it's fresh.
The only real challenge with the above that I can think of is with templates.Defer
, but is sounds doable. We have already an issue with the output minifier
being run before we do defer replacements, so a cleanup in this department should be done anyway.