如何在 Atom 中创建降价代码片段。

How to create markdown snippets in atom.

有人知道怎么做吗?我正在尝试这个,但它不起作用:

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

Atom 中 Markdown 的默认范围是 .source.gfm,而不是 text.html.markdown

您的代码片段如下所示:

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

我必须将 '.source.gfm' 更改为 '.text.md' 才能让它为我工作。

请注意确定这是否有任何影响,但我正在使用这些与 markdown 相关的软件包:language-markdown、markdown-writer、markdown-preview、markdown-scroll-sync

范围取决于您使用的语言(包):

  • 语言降价.text.md
  • 语言-gfm: .source.gfm

您可以组合两个选择器以涵盖这两种情况:

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