Jwan622
Jwan622

Reputation: 11639

How to create markdown snippets in atom.

Anyone know how? I am trying this but it doesn't work:

'text.html.markdown':
  'Bash':
    'prefix': '`B'
    'body': '```Bash\n\n```'
  'rubyonrails':
    'prefix': '`r'
    'body': '```rubyonrails\n\n($1)```'

Upvotes: 14

Views: 3409

Answers (3)

Rene Knop
Rene Knop

Reputation: 1836

The scope depends on the language (package) you are using:

  • language-markdown: .text.md
  • language-gfm: .source.gfm

You can combine both selectors to cover both cases:

'.text.md, .source.gfm':
  'Bash':
    'prefix': '`B'
    'body': '```Bash\n\n```'
  'rubyonrails':
    'prefix': '`r'
    'body': '```rubyonrails\n\n($1)```'

Upvotes: 3

afontaine
afontaine

Reputation: 1059

The default scope for Markdown in Atom is .source.gfm, not text.html.markdown.

Your snippets would look like:

'.source.gfm':
  'Bash':
    'prefix': '`B'
    'body': '```Bash\n\n```'
  'rubyonrails':
    'prefix': '`r'
    'body': '```rubyonrails\n\n($1)```'

Upvotes: 29

Richard Buff
Richard Buff

Reputation: 379

I had to change '.source.gfm' to '.text.md' in order to get this to work for me.

Note sure if this had any bearing on it but I'm using these markdown-related packages: language-markdown, markdown-writer, markdown-preview, markdown-scroll-sync

Upvotes: 0

Related Questions