RSSAmplifier

Hearthside by Caleb Hearth · Nov 22, 2024

Tell GitHub to Render Markdown Pages with .gitattributes

0
Sign in to vote or save

Hearthside

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

As a bonus, GitHub usually sets Markdown files as documentation and excluded from the language statistics of the repository. To fix that you can also add these few more lines to really specify how Linguist should categorize file types that match the pattern:

*.md.y*ml linguist-vendored=false
*.md.y*ml linguist-generated=false
*.md.y*ml linguist-documentation=false
*.md.y*ml linguist-detectable=true

/nablopomo-2024

Read the original on calebhearth.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.