• Login
Community
  • Login

How To Keep Text Highlighting After closing the document?

Scheduled Pinned Locked Moved General Discussion
18 Posts 7 Posters 7.6k 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.
  • P
    Paul Wormer @Pika714444
    last edited by Paul Wormer Jul 3, 2023, 8:56 AM Jul 3, 2023, 8:55 AM

    @Pika714444 No there is not. You must understand that to keep highlights in a file, the file must contain metadata (data that are only meant for the computer and are invisible to the user). Saving metadata is against the philosophy of text editors like Notepad++. Text editors work with readable text (with a few exceptions like end of line and tab characters). Word processors, like MS-Word, save lots of metadata in their files. These metadata contain info about the page layout, fonts (roman, bold, italic, …), text highlights, etc.

    However, when your highlighting is systematic (programmable), there are some advanced N++ ways to reintroduce your highlighting whenever you reopen your file.

    P 1 Reply Last reply Jul 4, 2023, 12:48 AM Reply Quote 0
    • R
      rdipardo @Pika714444
      last edited by Jul 3, 2023, 11:09 AM

      You can export a file’s content and styling as HTML (with the syntax highlighting embedded as CSS rules), or as an RTF file. You only need the NppExport plugin, which is already installed as long as you don’t have one of the “minimal” Notepad++ releases:

      npp-export-to-html.png

      Be aware that this will not preserve the appearance of the actively selected lines (assuming that’s what you meant by “highlighting”). But every other style will be faithfully preserved:

      npp-html-exported.png

      If you choose the HTML export, you can always edit the CSS to add the appearance of an active selection yourself:

      npp-html-customized.png

      P 1 Reply Last reply Jul 4, 2023, 12:52 AM Reply Quote 1
      • A
        Alan Kilborn @Pika714444
        last edited by Jul 3, 2023, 11:26 AM

        @Pika714444 said in How To Keep Text Highlighting After closing the document?:

        Is there anyway to keep the text highlight after closing the document ? because when i save and re-open the document , the highlighting is not there.

        Is your screenshot even from Notepad++?

        P P 2 Replies Last reply Jul 3, 2023, 1:31 PM Reply Quote 1
        • P
          Paul Wormer @Alan Kilborn
          last edited by Jul 3, 2023, 1:31 PM

          @Alan-Kilborn S/He could have piped the Unix output to an Ascii file and brought it over to a Windows environment. @rdipardo How likely do you think it is that somebody will make an HTML+CSS file out of something as volatile as a Unix directory listing? @Pika714444 I said that metadata is invisible to the user. However, Markup Languages (such as LaTex, HTML, Troff) make the markup information visible to the user, in contrast to word processors as WordPerfect and MS-Word that keep this info invisible.

          A 1 Reply Last reply Jul 3, 2023, 1:43 PM Reply Quote 0
          • A
            Alan Kilborn @Paul Wormer
            last edited by Jul 3, 2023, 1:43 PM

            @Paul-Wormer

            I’m trying to get to the root of where the “highlighting” that the user has shown is coming from. Is it style #1 thru #5 in a dark mode context?

            P 1 Reply Last reply Jul 4, 2023, 12:58 AM Reply Quote 1
            • M
              mkupper @Pika714444
              last edited by mkupper Jul 3, 2023, 4:39 PM Jul 3, 2023, 4:38 PM

              @Pika714444 said in How To Keep Text Highlighting After closing the document?:

              Is there anyway to keep the text highlight after closing the document

              In summary, the answer is “no, you can’t keep text highlighting.”

              The problem is that the highlighting we see is something that Notepad++ shows while we are editing a file. The highlighting is not part of the file itself but rather is extra “decoration” that is available within Notepad++.

              While it would be possible for Notepad++ to save the highlighting and other decorations somewhere and to restore them when the file is re-opened that would create two problems.

              1. People would start making the assumption that the highlighting and decorations are part of the file itself and are shocked/surprised/upset/etc. should they copy the file somewhere else, e-mail it to someone, etc. and there are no highlighting and decorations.
              2. If the file is modified or changed by someone or something outside of Notepad++ then the file will be out of sync with Notepad++'s idea of how the file should be decorated.

              One solution would be for the developers of Notepad++ to invent a new file format that contains a mix of the text and the decorations to use with that text. In the interest of portability let’s use the .docx file extension and use the same internal file format as Microsoft Word. People would then want to Notepad++ to do all of the things Word does. (hint: OpenOffice died and LibreOffice is still is not popular)

              Becoming unpopular is a path that Notepad++'s developers have chosen not to take which is why highlighting is not saved/restored.

              L P 2 Replies Last reply Jul 3, 2023, 7:11 PM Reply Quote 4
              • L
                Lycan Thrope @mkupper
                last edited by Lycan Thrope Jul 3, 2023, 7:16 PM Jul 3, 2023, 7:11 PM

                @mkupper said in How To Keep Text Highlighting After closing the document?:

                (hint: OpenOffice died and LibreOffice is still is not popular)

                Although I agree with your answer that NPP does not do what the OP seems to want to do, please define what you mean by died, as I haven’t read of the demise of either, which I use. I don’t use Word, nor any Microsoft products other than the OS, by choice, so the alternatives suit me just fine, and last I looked, they still exist.

                It almost sounds like what the OP wants is to be able to keep highlights in the text, somewhat similar to what you can do with Adobe Acrobat in a .pdf. Since NPP does not save the file with that actual highlighting, as does a .pdf, it’s not possible for the OP to achieve what it sounds like he wants, without a better English translation, and additional information like his version, etc.

                Everyone here sounds like they’ve done their best to mind read, but that’s not how this forum is supposed to work, especially since they never seem to return to actually supply that information. Supposition should end without more work on the OP’s part.

                P 1 Reply Last reply Jul 4, 2023, 12:58 AM Reply Quote 1
                • P
                  Pika714444 @Paul Wormer
                  last edited by Jul 4, 2023, 12:48 AM

                  @Paul-Wormer

                  Okay thanks for letting me know that it’s not possible.

                  1 Reply Last reply Reply Quote 0
                  • P
                    Pika714444 @rdipardo
                    last edited by Jul 4, 2023, 12:52 AM

                    @rdipardo

                    Thanks a lot , i just wanted to highlight some important parts of the commands output in Linux / Networking , it will make my life easier when i open the document and find for Example where to look for a specific part of the output when Entering the command so it will be a lot of time saving , also during studying it will be helpful to highlight some output of the commands to make clear this is an important part of the output and that’s what we are looking for to look like, but unfortunately it’s not possible in NotePad++ as mentioned.

                    1 Reply Last reply Reply Quote 0
                    • P
                      Pika714444 @Alan Kilborn
                      last edited by Jul 4, 2023, 12:54 AM

                      @Alan-Kilborn

                      Yes it’s.

                      1 Reply Last reply Reply Quote 0
                      • P
                        Pika714444 @mkupper
                        last edited by Jul 4, 2023, 12:56 AM

                        @mkupper

                        Thanks for elaborating ,i just wanted to highlight some important parts of the commands output in Linux / Networking , it will make my life easier when i open the document and find for Example where to look for a specific part of the output when Entering the command so it will be a lot of time saving , also during studying it will be helpful to highlight some output of the commands to make clear this is an important part of the output and that’s what we are looking for to look like, but unfortunately it’s not possible in NotePad++ as mentioned.

                        M 1 Reply Last reply Jul 4, 2023, 4:05 PM Reply Quote 0
                        • P
                          Pika714444 @Alan Kilborn
                          last edited by Jul 4, 2023, 12:58 AM

                          @Alan-Kilborn

                          Yes it’s style #1 thru #5.

                          A 1 Reply Last reply Jul 4, 2023, 10:54 AM Reply Quote 0
                          • P
                            Pika714444 @Lycan Thrope
                            last edited by Pika714444 Jul 4, 2023, 12:59 AM Jul 4, 2023, 12:58 AM

                            @Lycan-Thrope said in How To Keep Text Highlighting After closing the document?:

                            It almost sounds like what the OP wants is to be able to keep highlights in the text, somewhat similar to what you can do with Adobe Acrobat in a .pdf. Since NPP does not save the file with that actual highlighting, as does a .pdf, it’s not possible for the OP to achieve what it sounds like he wants

                            Yes that’s what i wanted to achieve.

                            mpheathM 1 Reply Last reply Jul 4, 2023, 3:58 AM Reply Quote 1
                            • mpheathM
                              mpheath @Pika714444
                              last edited by Jul 4, 2023, 3:58 AM

                              @Pika714444
                              Your highlighting appears to be line based. Instead of highlighting lines, perhaps bookmarks might be an alternative option as bookmarks are saved in session.xml.

                              Press Ctrl+F2 to bookmark a line.
                              Press Shift+F2 to goto previous bookmark.
                              Press F2 to goto next bookmark.

                              If you close the file in Notepad++, then the bookmarks and other saved settings for the file will be removed from session.xml.

                              More information about bookmarks can be found in the manual within the searching page

                              1 Reply Last reply Reply Quote 2
                              • A
                                Alan Kilborn @Pika714444
                                last edited by Jul 4, 2023, 10:54 AM

                                @Pika714444 said in How To Keep Text Highlighting After closing the document?:

                                Yes it’s style #1 thru #5.

                                The author of Notepad++ hinted that remembering such styling in a session file could become a feature someday: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/12684

                                P 1 Reply Last reply Jul 12, 2023, 3:04 PM Reply Quote 3
                                • M
                                  mkupper @Pika714444
                                  last edited by Jul 4, 2023, 4:05 PM

                                  @Pika714444 said in How To Keep Text Highlighting After closing the document?:

                                  @mkupper

                                  Thanks for elaborating ,i just wanted to highlight some important parts of the commands output in Linux / Networking , it will make my life easier when i open the document and find for Example where to look for a specific part of the output when Entering the command so it will be a lot of time saving , also during studying it will be helpful to highlight some output of the commands to make clear this is an important part of the output and that’s what we are looking for to look like, but unfortunately it’s not possible in NotePad++ as mentioned.

                                  It looks like you want something where you can quickly and easily mark up text as you are reading it. Notepad++ won’t be a good fit. While there are ways to get Notepad++ to color code text they involve a considerable amount of extra work each time you style something and often, there is no easy way to then search for things styled in a certain way.

                                  Some of my friends are happy with Microsoft OneNote. It seems to be available for free now and may be a better fit for keeping color coded notes.

                                  I myself have moved in a direction of always using plain text and tend to use indention to separate or “highlight” command results from the command. For example:

                                  some command
                                      results
                                      or notes about the results
                                  

                                  That allows me to use plain Notepad++ plus other tools that deal with plain text files.

                                  1 Reply Last reply Reply Quote 1
                                  • P
                                    Pika714444 @Alan Kilborn
                                    last edited by Jul 12, 2023, 3:04 PM

                                    @Alan-Kilborn

                                    I hope they do it ASAP because it will be a very beneficial feature for highlighting a specific important words/sentences/line in a large text output file , this is the feature i needed actually from the purpose of this post.

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