-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Highlight HTML inside of template strings #9
Comments
Of course! It is possible. syn include @XMLSyntax syntax/xml.vim
syn region tsxRegion contains=@XMLSyntax,tsxRegion,typesciptBlock,@typescriptExpression
\ containedin=typescriptTemplate
\ start="\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)"
\ skip="<!--\_.\{-}-->"
\ end="</\z1\_\s\{-}>"
\ end="/>"
\ keepend
\ extend It should work... But it makes error in dtd.vim... I don't know why... |
OK, I make it work. I don't think this code will be merged into master because it is not in typescript's highlighting spec. syn include @htmlsyntax syntax/html.vim
syn region tsxRegion contains=@htmlsyntax,tsxRegion,typescriptTemplateSubstitution
\ containedin=typescriptTemplate
\ start="\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)"
\ skip="<!--\_.\{-}-->"
\ end="</\z1\_\s\{-}>"
\ end="/>"
\ keepend
\ extend |
So I ended up with something like this.
Thanks for the point in the right direction. |
Hi i've also trying to get HTML syntax highlighting working for template strings (angular). It's exactly the same usecase as @mhartington. But after several hours of trying the things described in this ticket i'm getting nowhere. Things probably must have changed internally. Can you point me in the right direction? @mhartington do you still have this working with the latest revision of yats? |
Ok, I've figured it out that the custom configuration was set to early when just dumped in
|
Hey @michel 👋 . Did you end up getting it to work. I tried your solution but it breaks with nested elements: |
Would it be possible to properly add syntax highlighting to template strings? Similar to this issue for atom-typescript
TypeStrong/atom-typescript#948
Looking into it, it doesn't seem impossible, this tsx.vim plugin loads the xml syntax file and then targets the proper files for jsx-style code.
Could be possible to do the same for this plugin and match atom.
The text was updated successfully, but these errors were encountered: