Skip to content

Expose post content rendering helper in PostExtension #175

Open

Description

@halostatue

I've got a couple of extensions, TableauExcerptExtension and an as-yet-unpublished revisions tracking extension where I've got meta-content in frontmatter that should be written in the same format as the main content.

Right now, that only works reasonably well for markdown posts because Tableau.markdown/2 exists. However, if each post has a render_content/1 function included (similar to the renderer function attribute), this could be handled for extended content types without special handling‡.

Tableau.PostExtension.post() would need to be updated to include a render_content, function, and Tableau.Page.t() would need to be updated so the same function is exposed for use just like page.template.

This would allow post rendering to do something like this (Temple example in a index page):

div do
  post.render_content.(post.excerpt)
end

‡ There is special handling in an upcoming version of TableauExcerptExtension because it has to do some processing of the content, but that's something separate.

Activity

  1. halostatue commented on Feb 9, 2026

    @halostatue
    ContributorAuthor

    Similarly -- and I've needed this in a couple of extensions -- adding ext to the post and/or page type would reduce instances of:

        "." <> ext = Path.extname(filename)
        ext_atom = String.to_atom(ext)
        Map.fetch!(processors, ext_atom)

    or anything similar.

  2. evantravers commented on Mar 8, 2026

    @evantravers
    Contributor

    I'm wondering… would this strategy mitigate the problem I'm seeing in #176? (escaping issues when using heex)

  3. halostatue commented on Mar 13, 2026

    @halostatue
    ContributorAuthor

    @evantravers probably not directly.

    This feature definitely affects TableauExcerptExtension, which grabs text from the post and puts it into the excerpt key of post frontmatter — it's going to be the same format as the post is written in.

    In my site, I also have a revisions block in my frontmatter, which looks something like:

    revisions:
      - rev: |
          description of the change
        date: '2026-03-12T22:02:23Z'

    It's assumed that any text written in the rev entry of the frontmatter is using the same content format, so if you've written it with a Djot converter, you should also use the Djot converter for this text.

  4. mhanberg commented on Oct 11, 2026

    @mhanberg
    Collaborator

    I think #193 will close this.

    It introduces a Tableau.Converter.convert/2 function that Post and Page extension use internally to render content. You can do Tableau.Converter.convert(content, ext: :md) (substitute :md for the extension configured for the converter you want to use.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions