mvdschee / web-accessibility

A Visual Studio Extension for Web accessibility
https://marketplace.visualstudio.com/items?itemName=MaxvanderSchee.web-accessibility
MIT License
70 stars 12 forks source link

Support for HTML-like languages #22

Open davletbaev opened 5 years ago

davletbaev commented 5 years ago

Is your feature request related to a problem? Please describe. Plugin don't work with HTML-like languages, e.g. Nunjucks, Handlebars, etc. It doesn't work even if extension of file is .html.

Describe the solution you'd like Added the ability to select extensions in plugin settings.

Describe alternatives you've considered Default support for all html-like languages.

mvdschee commented 5 years ago

@davletbaev Thank you for your suggestions, I had it on my personal list of features I should add when I’m done rewriting the handling of accessibility errors.

So why my extension is not working when you change the file extension from .something to .html is because in the down right corner of VS code they specify which language type it is (language mode), if you change that to html it will start working, but you lose the advantages you have for the correct language mode.

Back to your feature request, there is one big problem with those HTML like languages, for example, twig it’s common to use {% include 'metadata.twig' %} to make your code more modular. For example:

<head>
  {% block head %}
    {% include 'metadata.twig' %}
  {% endblock %}
</head>

Which means the extension is unable to lint if there is a title in the <head> element because it’s not able to process those includes. Those includes I believe is the power of those languages, but they come with great challenges when you need to lint them based on the context of HTML structure.

Btw I have never used one of those HTML-like languages you describe, so if you find any more, drop a comment with ones you like in this issue and will try to add them as well :)

tylerkilburn commented 4 years ago

Max, thank you for all your hard work on this extension, it rocks and definitely makes me more accessibility minded. Is there any chance we could sneak Handlebars (HBS) / Mustanche in? I don't know what the lift is, but I am hoping it is minimal as HBS doesn't let you do very much in HTML outside of dropping {{var}} tags in. Thanks again!

tylerkilburn commented 4 years ago

@mvdschee Mr Max, any insights? I would be down to help out if you are strapped for time. Just want your blessing before attempting any PRs :)

mvdschee commented 4 years ago

@tylerkilburn I'm happy to hear you like the extension :) I can for sure add support for Handlebars (HBS) / Mustache. I will have to check it against a project, so if you have any for me, drop them here, and I can take a look, will look into HBS and if it's indeed just some {{var}} big chance It will be added with the next release!

PS Sorry for the late reply :)

tylerkilburn commented 4 years ago

Cool, I will throw together a cute hello world HBS project with partials, expressions and a few more bells and whistles and share the repo here. Sadly, I can share any of my work things... you know how that goes... 🤷‍♂️.

tylerkilburn commented 4 years ago

Hi Mr Max, I threw together a repo for you here https://gitlab.com/tkil/hbs-example. Just clone and go to town. Please let me know if you have any issues.

tylerkilburn commented 4 years ago

Mr Max, would you be open to me lending a hand if you are slammed with work / life? I don't want to step on your toes, but don't want to pressure you if life is busy either.

mvdschee commented 4 years ago

He @tylerkilburn I did not get any notifications of your reply! :O

Thanks for the repo I will use it to test it! No adding it is not the hard part, just de validation and checking can take sometime. Mid next week I have time to add HBS for you, and do a little update/upgrade. Don't worry about you being involved, It's a good thing and makes this project feel more alive :)

Will keep you posted!

mvdschee commented 4 years ago

@tylerkilburn I have added support for HBS, hope it helps you :)

martindrzka commented 2 years ago

Hi, any chance to support .erb templates?

robisadev commented 2 years ago

What about html files with Twig