web-accessibility icon indicating copy to clipboard operation
web-accessibility copied to clipboard

Support for HTML-like languages

Open davletbaev opened this issue 6 years ago • 11 comments

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.

davletbaev avatar Jul 06 '19 09:07 davletbaev

@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 :)

mvdschee avatar Jul 16 '19 07:07 mvdschee

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 avatar Aug 20 '20 13:08 tylerkilburn

@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 :)

tylerkilburn avatar Sep 03 '20 18:09 tylerkilburn

@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 :)

mvdschee avatar Sep 04 '20 01:09 mvdschee

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 avatar Sep 04 '20 01:09 tylerkilburn

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 avatar Sep 04 '20 01:09 tylerkilburn

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.

tylerkilburn avatar Sep 23 '20 23:09 tylerkilburn

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 avatar Sep 24 '20 13:09 mvdschee

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

mvdschee avatar Sep 30 '20 20:09 mvdschee

Hi, any chance to support .erb templates?

martindrzka avatar Jan 18 '22 17:01 martindrzka

What about html files with Twig

robisadev avatar Aug 30 '22 00:08 robisadev