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

Option to turn of folding for headline tags mark with --- #3

Open
wikimatze opened this issue Dec 4, 2012 · 10 comments
Open

Option to turn of folding for headline tags mark with --- #3

wikimatze opened this issue Dec 4, 2012 · 10 comments

Comments

@wikimatze
Copy link

Hi Drew I really love your plugin and I'm using it on my daily basis for writing articles in markdown. Since I'm using Jekyll for running my blog, I'm also using the YAML settings at the beginning of each markdown file.


---
layout: post
title: here goes the article of a new post
meta-description: <---- Here begins the first fold level because of the special headline marks 

---


## The kitchen timer <-- here should be the first level of the folding level

...

If you have problems with following the example above, please consult the example below:

  1 ---
  2 layout: post
  3 title: On My Way On Becoming a Self-Certified Pomodoro Master
  4 ## meta-description: Motivation for the ongoing series of becoming a Self-Certiefied Pomodoro Master [12 lines]-----------
 17 ## Why? [22 lines]--------------------------------------------------------------------------------------------------------
 40 ## The First Pomodoro [36 lines]------------------------------------------------------------------------------------------
 77 ## Following the six objectives [17 lines]--------------------------------------------------------------------------------
 95 ## Conclusion [9 lines]---------------------------------------------------------------------------------------------------

Cheers

Matthias

@nelstrom
Copy link
Collaborator

nelstrom commented Dec 4, 2012

If the vim-markdown syntax highlighting could identify the YAML front matter, then this problem would be easy to fix. It doesn't just now, but @PProvost's vim-markdown-jekyll plugin adds this functionality.

@nelstrom
Copy link
Collaborator

nelstrom commented Dec 4, 2012

So, I just tried installing vim-markdown-jekyll, and it doesn't play nicely with some features in vim-markdown. Specifically, the jekyll plugin overrides the handling of fenced code blocks in markdown. The vim-markdown-folding plugin dependes on recognising fenced code blocks to solve issue 1.

@wikimatze
Copy link
Author

I see. I watched into the jekyll file https://github.com/PProvost/vim-markdown-jekyll/blob/master/after/syntax/markdown.vim and found this:

" YAML front matter
syntax match Comment /\%^---\_.\{-}---$/ contains=@Spell

" My unfinished attempt at getting YAML syntax in the front matter
" NOT WORKING
" syntax include @yaml $VIMRUNTIME/syntax/yaml.vim
" syntax region jekyllFrontMatter start=/\%^---/ end=/^---/ contains=@yaml

What we need is a function like checkJekyllFrontMatter() which does the job in your script. Since you have tests, I may try to build it as a training for myself. What do you think?

@nelstrom
Copy link
Collaborator

nelstrom commented Dec 4, 2012

Knock yourself out! I wrote a test already. Check out the jekyll-front-matter branch.

@wikimatze
Copy link
Author

Wow, very fast indeed.

@greduan
Copy link

greduan commented Sep 6, 2013

So to fix this issue I should switch to the jekyll-front-matter branch?

@wikimatze
Copy link
Author

Hi Drew, I have thought about the problem and it isn't a problem anymore. Every time I'm editing a blog post with a YAML front matter I am unfolding the whole markdown file to have an overall feeling of the document.

What help me more was detecting the YAML front matter information at the beginning of a document as a comment with the following line in my vimrc:

autocmd BufNewFile,BufRead */_posts/*.md syntax match Comment /\%^---\_.\{-}---$/

If you agree with me, I will close this issue.

Thanks for your help so far.

@nelstrom
Copy link
Collaborator

That's an interesting workaround!

Leave the issue open for now. You're not the only person who wants this, so it makes sense to provide some solution in this plugin.

@wikimatze
Copy link
Author

I will track this issue further on.

@greduan
Copy link

greduan commented Dec 13, 2013

Cool workaround @matthias-guenther! I'll be using it. :)

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

No branches or pull requests

3 participants