Barney
August 9, 2025, 3:21pm
1
Hi!
I recently noticed that .ecr
files are read as HTML
by github’s linguist , and subsequently by Go-Enry , which is based on linguist.
This results in pure crystal projects with config files using embedded crystal listing HTML on code forges.
I opened an issue to change ecr
recognition to crystal, but I’m curious what you think.
1 Like
I’d say Crystal would be more accurate. But my 2 cents on this is ideally naming the files like some_page.ecr.html
if it’s HTML, or README.ecr.md
if it’s Markdown, etc. Mainly so it both shows it’s ECR based, but also is properly attributed based on the resulting generated file.
3 Likes
Barney
August 9, 2025, 3:25pm
3
That’s a great suggestion that I’m definitely going to use in my projects!
The underlying issue still stands, as .ecr
is classified as HTML.
.erb
is basically the same thing and also classifies as HTML.
Interestingly, other template languages such as jinja or liquid do not.
It should be the other way around, right? .html.ecr since after processing the ecr part you will be left with an html.
3 Likes
Dunno, I always just made it so the last extension was the one the file is so editors pick up the right type for highlighting and such. Otherwise as it stands .*.ecr
would always be picked up as HTML even if it’s markdown or what have you.
Barney
August 9, 2025, 5:33pm
7
That would be my personal preferred solution, and the one I proposed in the linguist
issue as well.
zw963
August 10, 2025, 12:52pm
8
Blacksmoke16:
I’d say Crystal would be more accurate. But my 2 cents on this is ideally naming the files like some_page.ecr.html
if it’s HTML, or README.ecr.md
if it’s Markdown, etc. Mainly so it both shows it’s ECR based, but also is properly attributed based on the resulting generated file.
Should we use same_page.html.ecr
instead? we need parse the embedded
at first, then parse as html, right?
Oops, You answer to that in your next comment.
zw963
August 10, 2025, 12:57pm
9
I prefer to use this solution, you only need setting new extend name (e.g. *.html.erb or .md.erb ) to open use correct editor mode.
Anyway, you probably won’t need to use ERB with every format.
1 Like