Templates depending on file extension name?


#1

Is there a way to automatically generate text, whenever a specific file type is created?

For instance, I make a *.md markdown file called test.md.

This snippet needs to be automatically generated at the top of file:

<link rel="stylesheet" href="my-url.com/style.css">

For reference, this is how I normally create files


#2

Are you using the core package language-gfm or the community package language-markdown?


#3

language markdown


#4
###  
init.coffee 
###
atom.workspace.observeTextEditors (editor) ->
  if editor.isEmpty() & (editor.getGrammar().name == "Markdown")
    editor.setText("""
    <link rel="stylesheet" href="my-url.com/style.css">
    """)