Summary
When using the programmatic content feature (perron:sync_sources), Perron always
generates files with a .erb extension. There is currently no way to specify that
the generated files should use a different extension, such as .md.
Current behavior
Given a resource class with source_template, running bin/rails perron:sync_sources
always produces .erb files:
app/content/posts/
1.erb
2.erb
3.erb
Even when the template content is pure Markdown (front matter + body), the generated
file is .erb, which bypasses the Markdown parser and feels inconsistent with
manually-created .md resources.
Expected / desired behavior
It would be useful to configure the file extension at the resource level so that
generated files can be .md for Markdown-heavy content (blog posts, documentation
pages, editorial content, etc.).
A possible API could look like:
class Content::Post < Perron::Resource
source :posts, format: :md
def self.source_template(sources)
post = sources.posts
<<~TEMPLATE
---
title: #{post.title}
date: #{post.published_at}
---
#{post.body}
TEMPLATE
end
end
Or alternatively via a dedicated class-level macro:
class Content::Post < Perron::Resource
source :posts
source_format :md
end
Context
- Perron version: 0.18
- Ruby version: 4.0.2
- Rails version: 8.1.2
Summary
When using the programmatic content feature (
perron:sync_sources), Perron alwaysgenerates files with a
.erbextension. There is currently no way to specify thatthe generated files should use a different extension, such as
.md.Current behavior
Given a resource class with
source_template, runningbin/rails perron:sync_sourcesalways produces
.erbfiles:Even when the template content is pure Markdown (front matter + body), the generated
file is
.erb, which bypasses the Markdown parser and feels inconsistent withmanually-created
.mdresources.Expected / desired behavior
It would be useful to configure the file extension at the resource level so that
generated files can be
.mdfor Markdown-heavy content (blog posts, documentationpages, editorial content, etc.).
A possible API could look like:
Or alternatively via a dedicated class-level macro:
Context