Skip to content
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

Break up the walls of text on non-home pages #123

Open
2 tasks
oubiwann opened this issue Dec 24, 2023 · 7 comments
Open
2 tasks

Break up the walls of text on non-home pages #123

oubiwann opened this issue Dec 24, 2023 · 7 comments
Milestone

Comments

@oubiwann
Copy link
Member

oubiwann commented Dec 24, 2023

TailwindCSS has some nice content separators, callouts, etc., than can be used on the following pages to break up the text and make the read experience a little better:

Resources:

@oubiwann oubiwann added this to the v4 milestone Dec 24, 2023
@oubiwann
Copy link
Member Author

Hrm. This is going to be tricky:

  • In order to format our section data in templates that use the above-linked preline examples, we need more control over in-page, heading-level data
  • Zola (and Hugo, for that matter) don't seem to have an abstraction for content finer-grained than page
  • There doesn't seem to be a way to iterate through headings (in a page)
  • There doesn't seem to be a way to iterate through the content under headings (in a page)

There is a Rust markdown library that has an alpha version capable of parsing markdown to an AST:

Perhaps it would be possible to override the Zola parser? Get the mdast as a Rust data structure, walk the AST, convert each heading and its content to HTML, put those in Tera variables and make the available to Zola templates?

Yikes, that sounds like a doozy of a project.

@oubiwann
Copy link
Member Author

Gonna stop poking now, but should be possible to (with a Zola fork):

  • update the Page struct in components/content/src/page.rs to include a new field like ast
  • parse the raw content using the Rust markdown parser and converting to mdast instead of HTML
  • walk the children of markdown::mdast::Root and generate a new data structure that uses headings + depth
  • make this data structure available to Zola/Tera templates off the Page data

@oubiwann
Copy link
Member Author

I've done a little cleanup of the /learn page that should help us limp along until a better/cleaner solution is ready.

@oubiwann
Copy link
Member Author

Moving the longer-term solution for this to the backlog ...

@oubiwann oubiwann modified the milestones: v4, Backlog Dec 25, 2023
@oubiwann
Copy link
Member Author

Let's see where the work here goes:

If that pans out, we can switch the LFE site to using poise instead of zola, and we can update the templates to use the markdown AST to do the specialised rendering setups to avoid walls of text from straight markdown ...

@oubiwann
Copy link
Member Author

Working on a tool that the poise static generator will need in order for all of this to be possible (extracting selective chunks of a parsed Markdown file for rendering in specific locations in a page template).

That tool is here, and I'm making good progress on it :-D

The usage examples in the README are all currently working (v0.1.0, unreleased). I think this tool will be most useful when shell support has landed, which will allow poise to run it in a supervisor and write commands to its stdin to generate the desired output (thus avoiding the bad pattern of shelling out to the system for every markdown file that needs to be processed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant