Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alternative .md file extension to detection #2

Closed
wants to merge 1 commit into from
Closed

Add alternative .md file extension to detection #2

wants to merge 1 commit into from

Conversation

dlo
Copy link

@dlo dlo commented Apr 12, 2012

No description provided.

@lucapette
Copy link

This is not enough because the subtype will be md that Vim will not be able to recognize. I tried to make a pull-request but I wasn't sure @tpope would like it because there were some ugly duplication in my code.

Actually, I'd like to know @tpope opinion on that. Is there a good way to have that? It could be nice. Should we extract subtype recognition in a function?

@dlo
Copy link
Author

dlo commented Apr 16, 2012

Bump?

@tpope
Copy link
Owner

tpope commented Apr 16, 2012

Oh, um, @lucapette is right, isn't he? I haven't actually tried.

I'd also be interested to see where you found this .md-as-liquid in the wild.

@dlo
Copy link
Author

dlo commented Apr 16, 2012

Maybe it's just something I made up? Not sure, but I've been using .md as the markdown extension since forever. Didn't think that it would need to change as a result of the subtype (md-as-liquid) as opposed to just markdown.

Jekyll--the software I'm using--parses 4 extensions for markdown: .markdown, .mkd, .mkdn, and .md.

https://github.com/mojombo/jekyll/blob/master/lib/jekyll.rb#L70

@tpope
Copy link
Owner

tpope commented Apr 17, 2012

You didn't invent that extension. GitHub did. Along with the other three you cite.

The problem is that liquid.vim uses the extension to determine a secondary syntax highlighting to activate. If you rename one of those .md files to .markdown, you should see a pretty obvious difference.

Here's one way to fix it:

autocmd BufNewFile,BufRead *.md
      \ if getline(1) == '---' |
      \   let b:liquid_subtype = 'markdown' |
      \   set ft=liquid |
      \ endif

I guess if you were to verify that works and wrap it up into a commit, I'd accept it. But I wish people would just use .markdown. .md already means "modula2" in Vim, and that ain't going away.

@jumoel
Copy link

jumoel commented Sep 4, 2012

I added a pull request for this in #5. It works for *.md files.

@tpope
Copy link
Owner

tpope commented Oct 21, 2012

Resolved.

@tpope tpope closed this Oct 21, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants