Community
    • Login

    How do i configure markdown (.md) display style?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    17 Posts 7 Posters 7.2k 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.
    • Zaflis_npZ
      Zaflis_np
      last edited by

      .md is something special, clearly it’s defined somewhere. If i change file extension to something stupid like .azaz the style will use global default that is easily readable because it’s configured by me. But i can’t find md style config. The way i see it now is dark background and dark blue text, i can only barely make out any characters of it.

      And yes i prefer dark themes in NP++ and all things.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • Zaflis_npZ
        Zaflis_np
        last edited by Zaflis_np

        Ok there’s more than just dark blue text.

        “# These lines are orange”
        “* These lines are dark blue”
        “These lines are almost exactly the same dark gray as background color”

        (without “”)

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

          @Zaflis_np ,

          Markdown file (.md) syntax highligting is defined in the User Defined Languages’ Markdown entry. Go to Language > User Defined > Define your language… to change the colors

          1 Reply Last reply Reply Quote 1
          • Zaflis_npZ
            Zaflis_np
            last edited by

            Seems very confusing, i can hardly understand what i’m looking at with those styling menus. There doesn’t seem to be a way to save the default style file apart from manually editing
            userDefineLangs\userDefinedLang-markdown.default.modern.xml

            Oh well, i hope i get colors right with hex codes…

            1 Reply Last reply Reply Quote 0
            • Zaflis_npZ
              Zaflis_np
              last edited by

              Why is there “global override” color if it’s not used?

              1 Reply Last reply Reply Quote 0
              • Zaflis_npZ
                Zaflis_np
                last edited by

                Oh i figured it out, just deleted the userDefinedLang-markdown.default.modern.xml file so now it uses global.

                1 Reply Last reply Reply Quote 0
                • Suuper WS
                  Suuper W
                  last edited by

                  I have just encountered the same issue. I found a simple solution, which is to select Language -> Markdown (preinstalled dark mode). It seems Notepad++ just doesn’t automatically choose the correct “user defined language” style based on dark mode.

                  1 Reply Last reply Reply Quote 0
                  • notdodgeballN
                    notdodgeball
                    last edited by

                    Yeah, I wish I knew why markdown is treated differently than all the other languages

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

                      @notdodgeball said in How do i configure markdown (.md) display style?:

                      I wish I knew why markdown is treated differently than all the other languages

                      Because there were enough deficiencies in the Lexilla Markdown lexer that the Notepad++ developer decided to turn off the Lexilla Markdown lexer and instead ship Notepad++ with a UDL definition.

                      Then, when Dark Mode was added, a second UDL definition was added so that you could choose whether you wanted the Dark Mode UDL for Markdown or the Light Mode UDL for Markdown.

                      Moreover, the “Markdown (preinstalled dark mode)” UDL has an extra attribute in its definition file, darkModeTheme="yes". And when you change from Light Mode to Dark mode, then when you open a markdown (.md or .markdown) file , it will automatically pick the new Dark Mode UDL instead of the Light Mode UDL.

                      So, the only difference in behavior for Dark Mode / Light Mode on Markdown files is that if you happened to have one open when you switched modes, you have to close it and re-open it, whereas with a file of a different type, it applies the Dark Mode immediately. That’s simple enough to do with Ctrl+W, Ctrl+Shift+T; and if that’s too onerous for you, you could even record it as a macro with a single keystroke instead of two.

                      —

                      BTW, @Suuper-W ,

                      the post you replied to was from 4 years ago, before there was a Dark Mode at all, let alone a predefined UDL for Dark Mode Markdown.

                      In v8.0, Dark Mode was introduced, and in v8.1.3 (a few months later), the Markdown (preinstalled dark mode) UDL started shipping with Notepad++.

                      So your instructions are helpful for anyone after v8.1.3.

                      I found a simple solution, which is to select Language -> Markdown (preinstalled dark mode). It seems Notepad++ just doesn’t automatically choose the correct “user defined language” style based on dark mode.

                      As I just posted, Notepad++ automatically picks the right UDL for a markdown file, based on whether Notepad++ is in Dark Mode or Light Mode when the file is loaded. So you don’t have to manually select anything.

                      In Summary

                      You only need to manually select the Dark Mode UDL if you change to Dark Mode while the Markdown file is open. And you can get around that by having Notepad++ close and re-open the file using Ctrl+W, Ctrl+Shift+T

                      So even if you are someone who frequently toggles between Dark and Light mode, all you have to do is close/open any open Markdown files, and the right UDL will be used.

                      notdodgeballN 2 Replies Last reply Reply Quote 2
                      • notdodgeballN
                        notdodgeball @PeterJones
                        last edited by

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • notdodgeballN
                          notdodgeball @PeterJones
                          last edited by

                          @PeterJones

                          Unfortunately, that doesn’t work for me currently, here’s why:

                          I don’t use dark mode per se, I use a dark theme (Bespin or DarkModeDefault, both customized) with the dark mode turn off, so it always defaults to the light mode UDL no matter what.

                          I understand I am in the minority, but it’s how I always used npp, even before dark mode was implemented.

                          It’s only a problem when dealing with markdown files. All other languages have styles defined the normal way and, I should also stress, can be tweaked in the Style Configurator.

                          PeterJonesP 1 Reply Last reply Reply Quote 0
                          • notdodgeballN
                            notdodgeball
                            last edited by

                            As I was typing above reply I remember one can delete the “light mode” markdown UDL, leaving only a dark one. It’ll be automatically picked.

                            I have more than one dark style UDL, for different themes of course (from this repository).

                            It still bothers me the markdown language is not neatly inside the language submenu, I can’t make changes on they fly using the style configurator (and save them) and also by switching themes, I still have to select the right one or manually edit the xml.

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

                              @notdodgeball,

                              I remember one can delete the “light mode” markdown UDL, leaving only a dark one. It’ll be automatically picked.

                              Alternately, you could have just removed md markdown from the Light Mode UDL. But deleting the XML works, too.

                              All other languages have styles defined the normal way and, I should also stress, can be tweaked in the Style Configurator.

                              Apparently, you did not understand me. All UDL behave the same way. Comparing the Markdown UDL to a builtin lexer is comparing apples to oranges – I understand that the comparison might have been reasonable for someone who didn’t know to make before they were told that the differences were for technical reasons, but after I had already informed you of this, it reflects poorly on you to continue whining about it.

                              It still bothers me the markdown language is not neatly inside the language submenu,

                              It’s neatly inside the Language menu, but below a little horizontal line instead of above it. I’m sorry that position bothers you.

                              I can’t make changes on they fly

                              Wrong. Language > User Defined Language > Define Your Language

                              using the style configurator

                              No UDL uses the Style Configurator. Hence, it’s no different than every other UDL.

                              also by switching themes

                              UDLs have never been influenced by themes. The expectation was that you’d pick one theme and stick with it, then choose the colors for your UDL to match that theme.

                              I still have to select the right one or manually edit the xml.

                              Using the GUI, that is quite simple. Literally selecting the md markdown in the Light Mode UDL’s “file ext” box, and deleting it. From then on, no more changes need to be done. QED.

                              You can dislike it as much as you like, but it’s working as designed, and the Developer has shown no inclination to change how UDL works. And he’s been asked multiple times to change Markdown from UDL to builtin lexer, and declined every time for technical reasons. At this point, it’s beating a dead horse.

                              CoisesC 1 Reply Last reply Reply Quote 1
                              • CoisesC
                                Coises @PeterJones
                                last edited by

                                @PeterJones said in How do i configure markdown (.md) display style?:

                                the Developer has […] been asked multiple times to change Markdown from UDL to builtin lexer, and declined every time

                                I’m asking this (without having studied it myself) only because you might know the answer off the top of your head:

                                Can a plugin implement a lexer that behaves like a built-in lexer? Or would it always be a “second class citizen” among languages?

                                PeterJonesP EkopalypseE 2 Replies Last reply Reply Quote 0
                                • PeterJonesP
                                  PeterJones @Coises
                                  last edited by PeterJones

                                  @Coises said in How do i configure markdown (.md) display style?:

                                  Can a plugin implement a lexer that behaves like a built-in lexer? Or would it always be a “second class citizen” among languages?

                                  https://npp-user-manual.org/docs/plugins/#building-a-lexer-plugin

                                  As far as I know, a lexer plugin is not a “second class citizen”, and behaves like any other built-in lexer (though maybe they don’t use stylers.xml or the active theme unless you manually parse that file; I’m not sure). The GEDCOM Lexer Plugin is a long-time example of a publicly-available lexer-plugin, in Plugins Admin.

                                  And @Ekopalypse was the one who initiated the User Manual section for lexer-plugins, so he would be better qualified to comment on how first-class or second-class a lexer-plugin is treated.

                                  –

                                  update: right, per this section, lexer plugins use an external XML file in the plugins\config directory. But given that it’s the same XML structure as the styler/theme files, maybe the definitions could reside in those instead of the standalone file (I don’t know, and I don’t know if anyone’s tried it).

                                  1 Reply Last reply Reply Quote 0
                                  • EkopalypseE
                                    Ekopalypse @Coises
                                    last edited by

                                    @Coises said in How do i configure markdown (.md) display style?:

                                    Can a plugin implement a lexer that behaves like a built-in lexer? Or would it always be a “second class citizen” among languages?

                                    It depends. When it comes to how Scintilla uses it, then they are like built-in lexers, but when it comes to Npp, then they are definitely second-class citizens because, as @PeterJones said, they need their own styler.xml, which as far as I can remember was enforced by Npp and also can’t be configured for functionlist and api.xml, but I have to admit that I haven’t tested/checked that with newer Npp versions to see if that’s still the case. But … I’d be surprised if it wasn’t.

                                    1 Reply Last reply Reply Quote 2
                                    • Mark OlsonM
                                      Mark Olson
                                      last edited by

                                      If you can read C# code, you might look at the CSVLint CSV lexer, which may give you some insight into any differences between user-defined lexers and normal ones.

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