-
Notifications
You must be signed in to change notification settings - Fork 9
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
{#markdown} for Qute #91
Comments
We have most of the different pieces, it's about finding the right way to make them work together with the right amount of coupling with Qute (or not) |
The outcome the way I see it would be to have:
To do it, we need a way to have a processing stack on top of Qute which:
Then a final step which take the output of the stack and create a Route out of it (or just make it available for It seems the only coupling point with any template engine would be: |
I have one project that allows external injection of templates (i.e. the user can define the output format). Quarkus does (already) have some ability to specify a directory to serve static files from. Given transformation plan.. would be nice to be able to transform content without having to put it in a maven structure at all. i.e. we're building a CLI that will run against content on a file system, not within maven (unless you want to change the behavior of the CLI itself). Hugo is a little too opinionated, but if you take a loose example of some combination of existing tools, they have a source directory (site) that usually has some sub-directories with loose conventions: layout or _include, and some way of defining static (copy-as-is) vs. content-to-process (content, posts, assets). I think all of those should be external to the CLI source. If someone wants to add additional processors, they can do that (build their own CLI using these extensions and add custom processors), but the content to be munged should be outside of this structure (i.e. you could use a completely separate project, if you wanted, and use a built artifact or a container to transform your content) |
I guess we could use the Quinoa way where we define a relative directory which doesn't have to be in the resources. |
Here is the plan. We need this:
When quarkusio/quarkus#41386 is done, we can start a new extension (in statiq repo) which:
|
why the need for markdown and asciidoc sections? I get its useful but normally SSG are driven by the extensions of files to know which render gets applied to the output of a certain template. I.e. I wouldn't even expect qute to necessarily not having to know about it as at that time the template rendering is not even involved? |
@maxandersen yes it's just internal logic to make it easier, here the frontmatter layout and the md extension would just be a shortcut to a normal qute template: my-post.md: layout: foo.html
bar: baz
---
## Hello {bar}
==
|
it makes it very easy to deal with and typesafety and all is handled by Qute like any other template.. |
@mkouba in the new builditem, we might need a way to add some data or at least declare it if that's possible (for the frontmatter data)? |
I can help with this one |
@maxandersen we could indeed decouple Qute from markdown, but that would create more coupling with the new tool and Qute because it would mean accessing the templates (for the layout lookup), having some way to type check, and then do partial rendering of the converted markdown to in the end, some way call the layout with the content. |
I think you may want to have a look at what Lume does in terms of processing content through one or more engines: They do this, as an example (replace vto with qute): ---
title: My post
templateEngine: [vto, md]
--- I would rather do something like this than embed markdown or asciidoc syntax in my templates. You can still have asciidoc/markdown rendering engines as build items, but you don't have to put those markers in your content (or your templates) |
or will build time checking still be applied even if the actual template being rendered is dynamically generated? |
I was assuming the example adding #asciidoc/#markdown is generated rather than something user put anywhere. |
how is |
You mean the new build item that will be introduced in quarkusio/quarkus#41386? No, that's not possible and it does not fit the current API. You can add param declarations to the template directly but no data can be attached to a template. |
@ebullient you won't have to put it in your content, from this: layout: foo.html
bar: baz
---
## Hello {bar} we generate this (but you don't have to do it yourself)
|
If we do the processing steps way (what @ebullient suggested), then it means we have to be able to do this: at build time:
at runtime run the processing queue (qute, md):
then render the layout with the content. @mkouba 👆 |
@maxandersen I suppose the processing is defaulted by the file extension and the default template engine |
The solution I suggested (generated Qute templates) is less flexible but easier to implement. Less flexible because the template engine will have to be Qute. But you could also have some kind of processing stack, dealt with as a stack of Qute sections. |
I think we can go with the generated template way, we can always change later if that is needed, the original blog post wouldn't change. |
I meant, no {#markdown} or {#asciidoc} block tags.
Template engine in Lume allows you to change the processing order: markdown first, then template resolution, then html conversion; or markdown to html ahead of qute. etc. |
I think I've got your point, we will probably go this way after the MVP, for now we have an easy way forward, the api would be the same in the user project, so we can move to staged processing in the second phase. In phase 1 (mvp), only the default inferred by the file name (md, asciidoc or html) will be possible and with Qute as the engine. |
@ebullient the suggestion is NOT requiring the user to use those tags - its an implementation detail in this being able to be done with Qute. |
I guess that is the part I don't understand. Why is that necessary at all? I don't get the relationship or understand why it is necessary. In the case that I'm the most used to, I do a lot of content generation with Qute, but I suppose I'm treating a lot as strings, and I'm not relying on type safety very much. |
I agree that a pipeline-way of defining what to do with the file is more flexible, though TBH I'm not sure about use-cases for more than just "what template system to use" and optionally "what content filter to use (md/asciidoc)". I also agree that |
We can divide this issue in two: markdown (this one) and asciidoc.
@ia3andy, could you rename this issue? |
This resolve to write two extensions in this repo to allow using
{#markdown}##hello{/markdown}
and{#asciidoc}==hello{/asciidoc}
There are libraries in Java for conversion.
Before: #91 (comment)
How could we best allow user to provide markdown (or possibly asciidoc) templates with possibly frontmatter?
@mkouba how could we make this fit in the Quarkus/Qute context?
cc @maxandersen @ebullient
I asked AI to explain what is multi-stage processing in this context:
Multi-Stage Processing in Static Site Generation
Multi-stage processing in the context of static site generation (SSG) generally refers to a structured approach where the generation of the final static site output is broken down into several distinct phases or stages. Each stage performs specific tasks on the content and templates, transforming them step-by-step until the final HTML files are produced. Here’s how these stages typically play out:
Content Loading and Parsing:
Template Rendering:
Static Asset Handling:
Content Transformation:
Output Generation:
Build Optimization (Optional):
Example Workflow
Process static assets like CSS and JavaScript=> Web BundlerEach stage builds on the previous one, ensuring that by the end of the process, you have a fully-rendered, optimized static site ready for deployment.
Benefits of Multi-Stage Processing
By breaking down the site generation process into manageable stages, multi-stage processing provides a clear framework for building static sites efficiently and effectively.
The text was updated successfully, but these errors were encountered: