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 769 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.
    • Hans van GelderenH
      Hans van Gelderen
      last edited by

      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

      andrecool-68A 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by

        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,

        Hans van GelderenH 1 Reply Last reply Reply Quote 1
        • andrecool-68A
          andrecool-68 @Hans van Gelderen
          last edited by

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

          Imgur

          1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones
            last edited by

            @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
            • Hans van GelderenH
              Hans van Gelderen @PeterJones
              last edited by

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

              PeterJonesP 1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Hans van Gelderen
                last edited by

                @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
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors