• Login
Community
  • Login

Attribute "srcset" not recognized as valid/standard attribute of the HTML tag "img"

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
6 Posts 3 Posters 774 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H
    Hans van Gelderen
    last edited by Jan 13, 2020, 12:03 PM

    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.

    notepad.png

    A 1 Reply Last reply Jan 15, 2020, 4:47 PM Reply Quote 0
    • P
      PeterJones
      last edited by Jan 13, 2020, 4:58 PM

      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

      1. Close Notepad++ (all instances)
      2. Open a single instance of Notepad++.
      3. Open the file %appdata%\langs.xml (for a normal installation; for a portable, it would be <install_dir>\langs.xml)
      4. turn on line-wrapping (View > Word wrap, if it’s not already enabled)
      5. search down to <Language name="html" ..., and change src srcdoc standby to src srcdoc srcset standby. (If that’s not your list of keywords in the HTML language entry, place srcset properly alphabetized in the list.)
      6. save
      7. exit Notepad++
      8. 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 default langs.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,

      H 1 Reply Last reply Jan 15, 2020, 7:20 PM Reply Quote 1
      • A
        andrecool-68 @Hans van Gelderen
        last edited by Jan 15, 2020, 4:47 PM

        @Hans-van-Gelderen For each language you can add your own keywords.

        Imgur

        1 Reply Last reply Reply Quote 0
        • P
          PeterJones
          last edited by Jan 15, 2020, 4:54 PM

          @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.

          37438513-6f80-4001-ba6f-69f908af5adb-image.png
          673ae590-141f-4613-bad3-97b2fa561c2e-image.png
          89e9431a-1b05-4da7-83b3-d743d789413d-image.png
          74b8d63f-16d8-454a-aa83-151d8bce05bb-image.png
          5f47682a-8653-411c-80df-82fe57f0910e-image.png
          0cc36466-b126-4567-b02d-365e74857470-image.png
          957c100a-5b0b-40a0-9491-b8f36a8f02cd-image.png
          bbc074d7-84cf-4c91-b1e6-fec8b4321f83-image.png
          f4e8edda-bc68-4b46-831f-323c0dfdaaeb-image.png
          f4bdd70e-5925-40a4-bbc2-68fa6892214a-image.png
          c96af91c-31fa-4b18-83fc-0f89b7c8be9d-image.png
          b6c1d44f-d4ea-4354-ac13-f57f9400484a-image.png
          70eeaaac-a168-4486-97c1-08030d640623-image.png
          2d0ac0e3-3b94-4c03-893c-5d6b0f8ee9a2-image.png

          1 Reply Last reply Reply Quote 0
          • H
            Hans van Gelderen @PeterJones
            last edited by Jan 15, 2020, 7:20 PM

            @PeterJones Your suggestion works. I have requested the fix for a future release by [issue#18769]

            P 1 Reply Last reply Jan 15, 2020, 7:45 PM Reply Quote 0
            • P
              PeterJones @Hans van Gelderen
              last edited by Jan 15, 2020, 7:45 PM

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

              1 Reply Last reply Reply Quote 0
              2 out of 6
              • First post
                2/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors