stelcodes / nuzzle

A functional static site generator so smol you won't even notice it's there 🐈
Eclipse Public License 2.0
17 stars 1 forks source link

Consider adding `nuzzle.api/transform-content` function #132

Closed stelcodes closed 2 years ago

stelcodes commented 2 years ago

I just had an interesting thought. Currently it's difficult to visualize the rendering process for Markdown content files. It goes:

raw markdown -> Hiccup-like Markdown IR -> HTML Hiccup -> HTML

I want to provide the users with ways to transform the two intermediary steps. But it's hard to visualize the process! I could make a function called transform-content that takes a content file and produces a map with :step-1/markdown, :step-2/markdown-hiccup, :step-3/hiccup and :step-4/html keys with values of that content file at each stage. Then the user could use Portal or whatever else to look through the values and see how it works.

For completeness, the HTML file processing currently goes:

HTML (that's it, no steps involved)

but ideally I want it to go

HTML -> HTML Hiccup -> HTML

and the keys could be :step-1/html :step-2/hiccup and :step-3/html

Note: Think about renaming :nuzzle/custom-elements to :nuzzle/transform-hiccup and then eventually create a :nuzzle/transform-markdown option too

stelcodes commented 2 years ago

I'm going to close this because I want to move in a direction where users create their own render-content functions and know exactly what's happening because they are writing them!