Skip to content

Working with multiple syntax files #42

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

Open
fncll opened this issue Jan 21, 2012 · 5 comments
Open

Working with multiple syntax files #42

fncll opened this issue Jan 21, 2012 · 5 comments

Comments

@fncll
Copy link

fncll commented Jan 21, 2012

I don't know if this is possible with vim-pandoc, but some syntax files can work alongside others, for instance set ft=php.html, and properly highlight the embedded code. It would be nice if Pandoc could do that too... often I work with code destined to be HTML but which has PHP code embedded. However, it seems I have to choose one syntax file or the other because, with both, only the first listed has any effect.

I guess this is really a feature suggestion. Sorry if this is not where such things go...

@dsanson
Copy link

dsanson commented Jan 22, 2012

The existing syntax/pandoc.vim file does support embedded HTML, using the HTML syntax file. One thing it does not support currently is highlighting of code blocks based on the {.lang} attribute.

But maybe I'm not understanding what you are after. Is it that you want to embed pandoc into php, with something like php.pandoc?

@fncll
Copy link
Author

fncll commented Jan 22, 2012

Yes: I work on my web pages in Markdown, but as it is destined ultimately to be converted to HTML, it also has PHP code in the same file. So being able to use ft=php.pandoc would be very useful.

@fncll
Copy link
Author

fncll commented Jan 22, 2012

Also, I'm not sure what I am doing wrong (if I understand your comment about embedded html) because set ft=pandoc.html doesn't do anything to give syntax coloring to HTML in my markdown document and the reverse only colors the html sections.

@dsanson
Copy link

dsanson commented Jan 22, 2012

Hmm.

Looks like embedded HTML sort of works for me, but not really. Embedded LaTeX highlight is working fine, though. Neither requires adding a suffix to the filetype. Embedded HTML highlighting will be disabled if you set g:pandoc_no_spans = 1 for performance reasons.

Here's the bug: the only time HTML gets highlighted is when it occurs on a new line, proceeded by whitespace. So in the following example, the tag gets highlighted on the first line, but nothing else works.

  <a href="test">test</a>
<a href="test">test</a>
A link <a href="test">test</a>

So that clearly needs to be fixed. I looked at the syntax file and honestly I'm not sure what is going wrong. The regex seems to match tags that occur anywhere on a line. But maybe Felipe will have more insight.

I'm not sure what would need to be done to make the pandoc filetype "compatible" with other filetypes. I take it that goes beyond just syntax highlighting, and relates to snippets and autocompletion and all the rest. But if it can be done it sounds like a good idea.

@dsanson
Copy link

dsanson commented Jan 22, 2012

Okay. Just verified that the embedded HTML works both with the included markdown syntax file and with plasticboy's markdown mode.

The obvious difference between standard markdown and pandoc markdown is that pandoc allows markdown within html tags, e.g., <a href="test">*test*</a>. Perhaps that is the root of the problem here.

@ghost ghost assigned fmoralesc Nov 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants