Community
    • Login

    CSS' syntax - grammar editor/corrector

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    30 Posts 5 Posters 12.7k 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.
    • Demetrius PinheiroD
      Demetrius Pinheiro
      last edited by

      Hi @Eko-palypse ,

      First, thank you for your answer and help.

      Yeah, I know jigsaw.
      But I am totally newbie at NP++. So, please, how can I use your UserDefinedCommand entry? Do I need to create a xml file? To be saved where?

      Thank you in advance!

      PS: I am going to edit my original post, in order to be more clear.

      1 Reply Last reply Reply Quote 2
      • Eko palypseE
        Eko palypse
        last edited by

        PS: I am going to edit my original post, in order to be more clear.

        This won’t happen as there is 3 minute time limit ;-)

        You need to edit shortcuts.xml file which is, normally, in the install directory of npp
        or in the %appdata% dir, depending what npp version you use and how you installed it.

        The debug-info from ? menu would help us to see where it should be.

        1 Reply Last reply Reply Quote 3
        • Demetrius PinheiroD
          Demetrius Pinheiro
          last edited by

          EDITING MY POST:

          I am a newbie at NP++.

          I am looking for a CSS’ syntax/grammar validator/editor/corrector for NotePad++. It will be useful any plugin, or a NP++’ internal function etc.
          I did a search, but I failed and found nothing.
          Normally I use online CSS’ validators. Also, I have Stylus (extension/add-on) in my browsers. So, I am looking for something similar for NP++.

          Eko palypseE 1 Reply Last reply Reply Quote 0
          • Eko palypseE
            Eko palypse @Demetrius Pinheiro
            last edited by

            @Demetrius-Pinheiro

            the css-eXplorer from http://docs.notepad-plus-plus.org/index.php/Plugin_Central seems to do what you want.
            I don’t have any experience as I don’t do any html/css coding.

            1 Reply Last reply Reply Quote 2
            • Demetrius PinheiroD
              Demetrius Pinheiro
              last edited by

              @Eko-palypse ,

              I found the “shortcuts.xml” (I am using ver 7.6.3 64-bit).
              When editing this xml file, is any special place where to paste your code?

              At the “Run Menu”, where exactly should appear this “Validate” entry?

              I edited the xml file => selected my CSS script to be validated => went to run menu… and nothing appeared there… I failed. Perhaps I pasted your code in the wrong place?

              Once again, sorry for my ignorance, is my first time with NP++, hope you will be patient with me.
              Thanks a lot

              Eko palypseE 1 Reply Last reply Reply Quote 1
              • Eko palypseE
                Eko palypse @Demetrius Pinheiro
                last edited by

                @Demetrius-Pinheiro

                when you open the shortcuts.xml file you should see a section
                UserDefinedCommands - paste it in there, then you need to restart Npp as
                this file is only read on startup.

                Demetrius PinheiroD 1 Reply Last reply Reply Quote 3
                • Demetrius PinheiroD
                  Demetrius Pinheiro @Eko palypse
                  last edited by

                  @Eko-palypse … yeah, following the logic, this is exactly what I did, but nothing appears at my Run Menu. Below I attach you my entire shortcuts.xml. Any suggestions?

                  Thank you for your link about css-eXplorer. I tried to install but NP++ says that this plugin is incompatible with my NP++ version.

                  <NotepadPlus>
                  <InternalCommands />
                  <Macros>
                  <Macro name=“Trim Trailing Space and Save” Ctrl=“no” Alt=“yes” Shift=“yes” Key=“83”>
                  <Action type=“2” message=“0” wParam=“42024” lParam=“0” sParam=“” />
                  <Action type=“2” message=“0” wParam=“41006” lParam=“0” sParam=“” />
                  </Macro>
                  </Macros>
                  <UserDefinedCommands>
                  <Command name=“Launch in Firefox” Ctrl=“yes” Alt=“yes” Shift=“yes” Key=“88”>firefox “$(FULL_CURRENT_PATH)”</Command>
                  <Command name=“Launch in IE” Ctrl=“yes” Alt=“yes” Shift=“yes” Key=“73”>iexplore “$(FULL_CURRENT_PATH)”</Command>
                  <Command name=“Launch in Chrome” Ctrl=“yes” Alt=“yes” Shift=“yes” Key=“82”>chrome “$(FULL_CURRENT_PATH)”</Command>
                  <Command name=“Launch in Safari” Ctrl=“yes” Alt=“yes” Shift=“yes” Key=“65”>safari “$(FULL_CURRENT_PATH)”</Command>
                  <Command name=“Get PHP help” Ctrl=“no” Alt=“yes” Shift=“no” Key=“112”>http://www.php.net/$(CURRENT_WORD)</Command>
                  <Command name=“Wikipedia Search” Ctrl=“no” Alt=“yes” Shift=“no” Key=“114”>https://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command>
                  <Command name=“Open file in another instance” Ctrl=“no” Alt=“yes” Shift=“no” Key=“117”>$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst</Command>
                  <Command name=“Send via Outlook” Ctrl=“yes” Alt=“yes” Shift=“yes” Key=“79”>outlook /a “$(FULL_CURRENT_PATH)”</Command>
                  <Command name=“Validate CSS” Ctrl=“no” Alt=“no” Shift=“no” Key=“0”>PATH_TO_BROWSER\firefox.exe https://jigsaw.w3.org/css-validator/validator?text=$(CURRENT_WORD)</Command>
                  </UserDefinedCommands>
                  <PluginCommands />
                  <ScintillaKeys />
                  </NotepadPlus>

                  Eko palypseE 1 Reply Last reply Reply Quote 1
                  • Eko palypseE
                    Eko palypse @Demetrius Pinheiro
                    last edited by

                    @Demetrius-Pinheiro said:

                    would you mind posting the debug-info from ? menu?

                    Demetrius PinheiroD 1 Reply Last reply Reply Quote 3
                    • Demetrius PinheiroD
                      Demetrius Pinheiro @Eko palypse
                      last edited by

                      @Eko-palypse , I apologize because you mentioned the “debug-info” but I didn’t know what was it. Now I found it:

                      Notepad++ v7.6.3 (64-bit)
                      Build time : Jan 27 2019 - 17:16:47
                      Path : C:\Program Files\Notepad++\notepad++.exe
                      Admin mode : ON
                      Local Conf mode : OFF
                      OS : Windows 10 (64-bit)
                      Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll PluginManager.dll _CustomizeToolbar.dll

                      Eko palypseE 1 Reply Last reply Reply Quote 2
                      • Eko palypseE
                        Eko palypse @Demetrius Pinheiro
                        last edited by Eko palypse

                        @Demetrius-Pinheiro said:

                        Local Conf mode : OFF

                        this means that your shortcts.xml is used from %appdata%\notepad++
                        and not from install direcotry.
                        Can you double check if this is the file you edited?

                        Demetrius PinheiroD 1 Reply Last reply Reply Quote 2
                        • Demetrius PinheiroD
                          Demetrius Pinheiro @Eko palypse
                          last edited by

                          @Eko-palypse , ok, sorry, my fault!, I found another shortcuts.xml at my %appdata%\notepad++, edited it, and finally the “Validate CSS” entry appeared at my Run Menu. Thank you!

                          However, sadly it didn’t work, the following message appears:
                          “The System cannot find the file specified. An attempt was made to execute the below command”…
                          … “Command: PATH_TO_BROWSER\firefox.exe Arguments: https://jigsaw.w3.org/css-validator/validator?text=”…
                          … “here appears the CSS’ script I selected”…
                          … “Error Code: 2”.

                          Eko palypseE 1 Reply Last reply Reply Quote 3
                          • Eko palypseE
                            Eko palypse @Demetrius Pinheiro
                            last edited by

                            @Demetrius-Pinheiro said:

                            PATH_TO_BROWSER\firefox.exe

                            sorry :-) but I thought it is obvious that you need to modify this
                            PATH_TO_BROWSER\firefox.exe
                            to your real path.
                            If you use an installed browser then it might even be possible using the program exe name alone.

                            1 Reply Last reply Reply Quote 4
                            • Demetrius PinheiroD
                              Demetrius Pinheiro
                              last edited by

                              OK, but please correct me if I am wrong, this “Run Menu” command will open any browser of my preference, where the jigsaw webpage also will be open, and the CSS’ script I select will be there inside this webpage and browser… right?

                              In other words, it is not going to be a CSS’ validator inside NP++, it is outside NP++… right?

                              I ask because I wanted something automatic, inside NP++, something that will validate my CSS’ scripts automatically, while I am writing those scripts inside NP++.

                              1 Reply Last reply Reply Quote 1
                              • Eko palypseE
                                Eko palypse
                                last edited by

                                You are absolutely correct, this will use the browser, open the validator page and providing
                                the data which should be validated.
                                It is NOT a plugin that could be used when you are offline.

                                Demetrius PinheiroD 1 Reply Last reply Reply Quote 2
                                • Demetrius PinheiroD
                                  Demetrius Pinheiro @Eko palypse
                                  last edited by

                                  @Eko-palypse … thanks a lot… and thank you for your time and patience.

                                  I will keep my post open, in the case some one else knows about a plugin or other solution.
                                  If nothing better appears, I will try the css-eXplorer plugin with an older NPP++ version (or perhaps some one can teach me how to use css-eXplorer or similar plugin with my latest NP++ version).

                                  Anyway, thank you once again!

                                  1 Reply Last reply Reply Quote 2
                                  • Eko palypseE
                                    Eko palypse
                                    last edited by

                                    my pleasure - hopefully someone else knows a plugin which could be used to your advantage.

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

                                      I don’t have a plugin … but if you don’t want to have to be online, you could find and download an offline CSS-checker to install on your Windows machine (sorry, I have no recommendations); you could then use the NppExec plugin (or PythonScript, though this seems better suited to NppExec, to me) to launch the external css-checker command on the active file. NppExec (or PythonScript) have ways of putting a command in the menu, so you can bind a keyboard shortcut to it.

                                      For example, if you installed C:\Program Files\SomeCssChecker\somecsschecker.exe, then a possible sequence using NppExec: Plugins > NppExec > Execute:

                                      NPP_SAVE
                                      cd "$(CURRENT_DIRECTORY)"
                                      "C:\Program Files\SomeCssChecker\somecsschecker.exe" "$(FILE_NAME)"
                                      

                                      Then Save…, give it a name like “SomeCssChecker”, Save, and finally OK (to run it right away) or Cancel (if you just wanted to define it, without running immediately). When you do run it, the output will go in a “console” windown inside NPP.

                                      To make a keyboard shortcut, Plugins > NppExec > Advanced Options…, enable Place to the Macros submenu, then go down to Menu Item, set the Item Name: to SomeCssChecker, and Associated Script to SomeCssChecker from the pulldown, then Add/Modify to place it into the list above. Click OK and Notepad++ will tell you that you have to restart Notepad++ in order to see it in the Macro menu: so restart. Now looking at Macro menu, “SomeCssChecker” will appear. Go to Macro > Modify Shortcut / Delete Macro; oddly enough, even though it’s now in the Macro menu, it doesn’t show up on the Macros tab of Shortcut Mapper. Instead, go to the Plugin Comands tab; scroll down (or, in new enough Notepad++, type NppExec in the Filter), click on SomeCssChecker, Modify, and select the keyboard shortcut. If you pick a shortcut that already exists (like Ctrl+C), it will say “CONFLICT FOUND!”, and in the Shortcut Mapper, there will be a box telling what it conflicts with; either Modify again, or go modify the other conflicting shortcut.

                                      Good luck (and sorry I couldn’t recommend a specific instance for SomeCssChecker.exe)

                                      Demetrius PinheiroD 1 Reply Last reply Reply Quote 3
                                      • Demetrius PinheiroD
                                        Demetrius Pinheiro @PeterJones
                                        last edited by

                                        Hi @PeterJones ! Very nice answer. Thank you!

                                        Unfortunately, today I can’t test your suggestion. But I will test it soon. And I will be back to you with the result.

                                        I don’t really care if the CSS’ validator is online or offline. But I would like a solution inside NP++. Yeah, no problem to connect NP++ online, or to bind NP++ to a SomeCssChecker.exe. But in any case, I do prefer something automatic happening inside my NP++, a kind of real-time CSS’ validator (online/offline) checking my CSS’ scripts while I write them at NP++.

                                        Honestly, if I need to open a browser or a SomeCssChecker.exe to validate my CSS’ script (wrote at NP++), and if I need to work in another screen/software… in this case I will prefer to use another solution. In my ignorance, I believe that’s the reason why I was looking for a “NP++ plugin”. If no one here has a plugin to recommend me, perhaps I will try to downgrade my NP++ to an older version, in order to try old plugins.

                                        But in any case, I will test you solution during the next week.

                                        Thanks again!

                                        Alan KilbornA Meta ChuhM 2 Replies Last reply Reply Quote 0
                                        • Alan KilbornA
                                          Alan Kilborn @Demetrius Pinheiro
                                          last edited by

                                          @Demetrius-Pinheiro said:

                                          if I need to open a browser or a SomeCssChecker.exe to validate my CSS’ script (wrote at NP++), and if I need to work in another screen/software… in this case I will prefer to use another solution

                                          If this can be made to work as Peter suggests, I think you will like it and you won’t “prefer to use another solution”.

                                          1 Reply Last reply Reply Quote 3
                                          • Meta ChuhM
                                            Meta Chuh moderator @Demetrius Pinheiro
                                            last edited by Meta Chuh

                                            @Demetrius-Pinheiro

                                            i’ve just played around with customised css validation, using all the information from you, @Eko-palypse and @PeterJones, and i think my test setup looks good enough to hand it over.

                                            it uses notepad++ and an offline tool called “css (cse) html validator” which is very, very powerful, highly configurable, has a lot of integration apis and is completely scriptable and command line capable.

                                            • all css/html test reports will be shown directly inside a notepad++ tab.
                                              displaying your complete validation results, with clear text explanations of every warning, suggestion or error, and most important, a summary at the top 👍
                                              (see last screenshot of this guide)

                                            • all css and html checks will be accompanied by an audible “tadaaaa” result on success, or a “ploinkk” if errors are found (customisable).

                                            • if you wish, you can display the report results graphically and categorised, inside a separate css/cse html validator window.


                                            here’s a short step by step guide:
                                            (including screenshots, so that you can have a look at all the results first, to see whether you like it, or you are still missing some features)

                                            installing css cse html validator:

                                            • go to the CSS HTML Validator for Windows website: https://www.htmlvalidator.com/download/

                                            • scroll down and download the free CSE HTML Validator Standard for Personal Use
                                              (direct link for cse-html-validator-170501personal-setup.exe at download-cnet-com >>> here <<<)

                                            • install cse-html-validator-170501personal-setup.exe using default settings.


                                            notepad++ preparation:

                                            • add the following 2 lines anywhere in your notepad++ shortcuts.xml, at the <UserDefinedCommands> section.
                                              (now that’s simple, as you already know where your’s is, and these paths are already your real paths 😉 so you can use them straight away)
                                            <Command name="Open with CSS CSE HTML Validator" Ctrl="no" Alt="no" Shift="no" Key="0">"%ProgramFiles(x86)%\HTMLValidator170\cmdlineprocessor.exe" -o "$(FULL_CURRENT_PATH)"</Command>
                                            		
                                            <Command name="Validate with CSS CSE HTML Validator" Ctrl="no" Alt="no" Shift="no" Key="0">"%ProgramFiles(x86)%\HTMLValidator170\cmdlineprocessor.exe" -v "$(FULL_CURRENT_PATH)"</Command>
                                            
                                            • your shortcuts.xml should now look like this screenshot (plus the modifications you already have):

                                            Imgur


                                            css/cse html validator preparation:

                                            • restart notepad++ and open any .css file (or html file, etc) for testing.

                                            • go to the menu run > Open with CSS CSE HTML Validator as seen at the screenshot below:

                                            Imgur

                                            • at the css/cse html validator, go to the menu validate options > default validation mode and select fullas seen at the screenshot below:

                                            Imgur

                                            • now hit validate to make a test run on your css.
                                              the categorical result page now looks like this:

                                            Imgur

                                            • now go to the menu validate options > validator engine options as seen here:

                                            Imgur

                                            • at the validator engine options, go to accessibility > classic and set the output viewer by browsing and selecting your notepad++.exe
                                              (in your case it’s C:\Program Files\Notepad++\notepad++.exe, as seen in your log)
                                              screenshot of the validator engine options window:

                                            Imgur

                                            • important: hit save now before you press ok or your settings will be lost.

                                            • close the css/cse html validator window.
                                              we’re done now with the setup.


                                            basic usage:

                                            • open a .css or any other file you want to analyse and go to run > Validate with CSS CSE HTML Validator to run a test on it.

                                            Imgur

                                            • a new notepad++ tab will open, displaying your complete validation results, with clear text explanations of every warning, understandable suggestions on what to corrector, and much more 👍:

                                            Imgur


                                            notes:

                                            currently you have to save your file, before you run a validation test, but this can be done automatically in the future, using the functions @PeterJones posted above, eg. by using macros (one click save and run validate) or nppexec (save and run validate, or, a bit tricky: run validate on every save).

                                            the report results can be colour highlighted in the future by creating a custom user defined language (udl), if you like what you see until now.


                                            sidenote to @Alan-Kilborn

                                            I think you will like it and you won’t “prefer to use another solution”.

                                            i think you’re right again 😂

                                            Demetrius PinheiroD Eko palypseE 2 Replies Last reply Reply Quote 6
                                            • First post
                                              Last post
                                            The Community of users of the Notepad++ text editor.
                                            Powered by NodeBB | Contributors