edheltzel / better-nunjucks-for-visual-studio-code

🦾 Better Nunjucks for Visual Studio Code with Snippets
https://marketplace.visualstudio.com/items?itemName=ginfuru.better-nunjucks
MIT License
22 stars 1 forks source link

Syntax Highlighting #4

Closed michael-proulx closed 2 years ago

michael-proulx commented 2 years ago

Very good plugin, I found an issue for specific file configuration with 11ty.

I'm using the before callback for a specific file, because I need to filter my variable for localisation, normally I do not need that, because I do create page in every languages.

But using ---js broke syntax highlighting but it is required for 11ty (https://www.11ty.dev/docs/pagination/#the-before-callback)

https://user-images.githubusercontent.com/23478544/173084613-3f14d43d-a957-4af3-8cc7-f7249d63f604.mp4

edheltzel commented 2 years ago

@michael-proulx That's interesting... I'm assuming the file extension is either html or njk ?

michael-proulx commented 2 years ago

Yes it's index.njk

edheltzel commented 2 years ago

@michael-proulx

I have a working modification that extends the YAML support so the highlighting does not break.

As of right now, this is more of a workaround, since I just included some regex to accommodate 11ty's custom frontmatter.

https://user-images.githubusercontent.com/402910/173114602-33f28c24-2f09-4257-9110-4d3f449ad8a2.mp4

edheltzel commented 2 years ago

@michael-proulx I'll do some more research on how to add additional syntax highlighting for embedded grammars like json/toml/js but right now I don't know if there is a way to do this inside of frontmatter.

michael-proulx commented 2 years ago

Nice thank you !! :)

munael commented 2 years ago

As of the current version, I see something like this: image

When the specified language is HTML: Only the frontmatter has syntax highlighting. (It's a monochrome theme, but still.)

When the specified language is Nunjucks: Highlighting more broken. image

Plus tooltips for HTML tags no longer work. I've added the emmet configs mentioned in multiple extensions but can't be sure this's even meant to re0enable tooltips or something else entirely.

edheltzel commented 2 years ago

As of the current version, I see something like this: image

When the specified language is HTML: Only the frontmatter has syntax highlighting. (It's a monochrome theme, but still.)

When the specified language is Nunjucks: Highlighting more broken. image

Plus tooltips for HTML tags no longer work. I've added the emmet configs mentioned in multiple extensions but can't be sure this's even meant to re0enable tooltips or something else entirely.

@munael Could you provide me a little more context or the file you're trying to get syntax highlighting working from the looks of it you're trying to use XML and change the grammar to Nunjucks, is that accurate?

Also, your YAML is not valid from the screenshots:

it should be:

---
title: Giffleball
images:
  - ???.jpg
  - ,,,.jpg
  - parrot.gif
---