Enable different syntax highlighter than the default for extension

I have some files with the extension .md which are actually YAML, and not Markdown (e.g. Hugo uses this).

I do not want to reassign .md to YAML as file type, as I have other ,md files which are actually Markdown.

Is there a way to assign files with .md extension under a certain directory only to be of type Yaml, instead of all the files?

Comment actions Permalink

No; but you can add exact name patterns to YAML file type, like myYamlFile.md so that the specific files will be highlighted as YAML while the other .md files will still be treated as Markdown files

Comment actions Permalink

That's not possible in my project (web pages names depend on the name of the .md file).

This is surprising. Could I please suggest that Webstorm allows patterns for file types to also include directories, not just filenames? Instead of "*.md" i'd like to specify "content/*.md" to be yaml, and "*.md" to be Markdown.

Alternatively. just allow the user to change the file type of the current file. Most basic editors out there allow this. I'm surprised Webstorm doesn't.


Please sign in to leave a comment.