markuplint icon indicating copy to clipboard operation
markuplint copied to clipboard

Supporting for Thymeleaf

Open ka2jun8 opened this issue 3 years ago • 3 comments

I use Thymeleaf.

Thymeleaf has some tag and attributes started th:, like th:block, th:src etc. These are not permitted in markuplint by default.

Could you support for Thymeleaf?

ka2jun8 avatar Feb 15 '23 04:02 ka2jun8

@ka2jun8 Hi, Thank you for your request.

I just found out Thymeleaf.

I can't promise I will implement that, but I will consider it. It would help me if you provided information that the parser of Thymeleaf is moreover available on Node.js. I think it is too difficult if it doesn't exist.

YusukeHirao avatar Feb 15 '23 09:02 YusukeHirao

Thank you!

It would help me if you provided information that the parser of Thymeleaf is moreover available on Node.js.

I don't know, Sorry. Thymeleaf is the templates for Java Applications, so I have never seen Node.js parser.

But I would be glad with only minimum supports for Thymeleaf. I'm happy just to skip or treats to tags and attributes that start with th (thymeleaf specific).

For examples:

  • th:block tag is skipped parser.
  • th:src is allowed for img instead of src (Allow img if the tag have src or th:src).

ka2jun8 avatar Feb 16 '23 15:02 ka2jun8

@ka2jun8

OK. If that is the case, why don't you use options of the invalid-attr rule?

It allows the th:block attribute is easy.

{
  "rules": {
     "invalid-attr": {
       "options": {
         "th:block": "Any"
       }
     }
  }
}

However, alternating the attribute isn't supported yet. For example, it can't allows th:src while ignoring src. One possible solution is that it disables the invalid-attr rule for some now.

I need the generic feature like alternating attributes the className and the class attributes in JSX.

Let me put this issue on hold. I will improve the parser utilities instead of this.

Let us think about this after this.

YusukeHirao avatar Feb 18 '23 04:02 YusukeHirao