dev-resources.site
for different kinds of informations.
Tell GitHub to Render Markdown Pages with .gitattributes
Articles on Hearthside are written in Markdown (GitHub-flavored), but the file extension is .md.yaml
as they also make use of Jekyll-style front matter. My Frontmatter gem requires that files it handles end in .yaml
or .yml
, so this is necessary.
Because of the file extension, GitHub until this week did not render the Markdown correctly. Instead articles have been highlighted if they were written in YAML completely, which really messes up the Syntax highlighting even beyond not giving a rendered preview.
I’m not sure why I never thought to look into it in the last several years of writing this way, but it turns out that you can tell GitHub’s Linguist tool what type of language a file type should match, so to do that I added this to my project’s .gitattributes
:
*.md.y*ml linguist-language=markdown
Featured ones: