Attribute "srcset" not recognized as valid/standard attribute of the HTML tag "img"
-
Notepad++ V7.8.2 does not recognize the attribute “srcset” as a valid/standard attribute of the HTML tag “img”. Its color is different from the other attributes, see screenshot.
-
Indeed.
Unfortunately, the HTML lexer/styler inherited from Scintilla does not have the user-defined keyword optoin (which would be the easiest way to add that in).
Fortunately, it appears if you are willing to edit a config file, we should be able to make it work.
Don’t edit any Notepad++ configuration settings until after the end of this sequence
- Close Notepad++ (all instances)
- Open a single instance of Notepad++.
- Open the file
%appdata%\langs.xml
(for a normal installation; for a portable, it would be<install_dir>\langs.xml
) - turn on line-wrapping (View > Word wrap, if it’s not already enabled)
- search down to
<Language name="html" ...
, and changesrc srcdoc standby
tosrc srcdoc srcset standby
. (If that’s not your list of keywords in the HTML language entry, placesrcset
properly alphabetized in the list.) - save
- exit Notepad++
- reload Notepad++ and look at your file: srcset should now match the highlighting of other recognized attributes
If you want, you could follow the FAQ about feature requests to ask the developers to add the
srcset
attribute into the defaultlangs.xml
, and if it gets implemented, it will be in the next release of Notepad++ after it is implemented. If you do add the feature request, be sure to add a link to that request in this thread.Good luck,
-
@Hans-van-Gelderen For each language you can add your own keywords.
-
@andrecool-68 said in Attribute "srcset" not recognized as valid/standard attribute of the HTML tag "img":
For each language you can add your own keywords.
For some languages, you can add your own keywords – but not for all languages. As I explicitly said, for HTML (which is what the OP was asking about), you cannot: “does not have the user-defined keyword [option]”
Want proof? Look at the Style Configurator for the HTML language, not the CSS language. You literally just had to click 12 lines down in your screenshot to see that HTML does not have those boxes, whereas CSS does.
-
@PeterJones Your suggestion works. I have requested the fix for a future release by [issue#18769]
-
@Hans-van-Gelderen said in Attribute "srcset" not recognized as valid/standard attribute of the HTML tag "img":
@PeterJones Your suggestion works. I have requested the fix for a future release by [issue#18769]
That issue doesn’t exist: the highest numbered issue at the official Notepad++ issue tracker is #7858.
Where did you make this feature request? (please provide full URL)