atom-dbt icon indicating copy to clipboard operation
atom-dbt copied to clipboard

Markdown Preview doesn't work with atom-dbt

Open MartinGuindon opened this issue 6 years ago • 3 comments

The package seems to break the Markdown Preview feature. It doesn't work (eg. using the keyboard shortcut of going to Packages -> Markdown Preview -> Toggle Preview) when the Markdown file is detected as Markdown (Jinja Templates) within the Atom project, but it will if manually switched back to regular Markdown.

I'm using (in case it's environment specific): Atom: 1.34.0 x64 Electron: 2.0.16 OS: Mac OS X 10.14.3

MartinGuindon avatar Feb 15 '19 00:02 MartinGuindon

Hey @MartinGuindon! Thanks for the issue :) So I think this is expected behaviour – as @tconbeer pointed out, this package sets .md files to use the (source.gfm.jinja) language as their default here

That's definitely the desired behaviour for me – I mainly work with Markdown in dbt, so want my Markdown files to always be Jinja-flavored, so I'm unwilling to change that.

I think there's two options here then:

  1. Change the default on your Atom installation to use non-jinja-flavoured (source.gfm) markdown for md files. To do this, go to your config.cson file (cmd + shft + p and then type in config, and choose Application: Open Your Config), and add this to it:
"*":
  core:
    customFileTypes:
      "source.gfm": [
        "md"
      ]

OR (my preferred approach) 2. Change your markdown-preview package to include jinja-flavoured-markdown. Again, go to your config.cson file, and add:

"*":
  "markdown-preview":
    grammars: [
      "source.gfm",
      "source.litcoffee",
      "text.html.basic",
      "text.md",
      "text.plain",
      "text.plain.null-grammar",
      "source.gfm.jinja"
    ]

clrcrl avatar Feb 15 '19 14:02 clrcrl

Solution 2 works great. Thanks, @clrcrl !

tconbeer avatar Feb 15 '19 15:02 tconbeer

Changed my mind – going to keep this open. There's probably a better way to handle this in the package to be honest, but I don't expect to look into this for quite some time!

clrcrl avatar Feb 15 '19 15:02 clrcrl