Community
    • Login

    Plugin Request: Markdown navigation panel

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 1.9k Views 1 Watching
    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.
    • xamountX Offline
      xamount
      last edited by

      VS Code has a plugin that would be a great idea for Notepad++ as well.
      It is called markdown-navigation, available at https://marketplace.visualstudio.com/items?itemName=AlanWalk.markdown-navigation

      Upon every file save it creates a TOC tree in a panel. As well helping navigate large documents easily, it lets you use your editor as an outliner.

      markdown-navigation screenshot

      1 Reply Last reply Reply Quote 0
      • Michael VincentM Online
        Michael Vincent
        last edited by

        N++ “has” that. It’s built-in and called the “Function List” (View => Function List). Of course, you’ll need to do a little work to get it to “work”.

        Discussion
        Solution

        Summary below:
        In your functionList.xml in the N++ install directory, in the “<associationMap>” section at the top, add:

        <association id="markdown" userDefinedLangName="Markdown"/>
        <association id="markdown" ext=".md"/>
        

        And then at the bottom, in the <parsers> section, add:

            <!-- ==================================================== [ Markdown ] -->
        
            <parser
            displayName="Markdown"
            id   ="markdown"
            commentExpr="(?x)             # free-spacing (see `RegEx - Pattern Modifiers`)
              (?ms:               # Code block
                ^               # ...at start-of-line a
                (?'BLOCK'\x7E{3}(?!\x7E)|\x60{3}(?!\x60))     #  block-start indicator
                \w*\h*$             #
                .*?             # ...whatever,
                ^\x20{0,3}            # ...optional indentation for a
                \k'BLOCK'             #  block-end indicator
                \h*$            #  with trailing white-space only
              )
              "
            >
            <function
              mainExpr="(?x)            # free-spacing (see `RegEx - Pattern Modifiers`)
                (?m-s)            # ^ and $ match at line-breaks, dot does not
                ^               # at start-of-line
                (?'NOCODE_INDENT'
                \x20{0,3}(?!\x20)         # indent of 3 spaces max, otherwise it's code
                )
                (?:             # ATX-style heading
                (?'LEVEL'\x23{1,6}(?!\x23))       # nr. of hashes indicate level
                \h*             # whitespace?  ( use '+' instead of '*' for at least one white-space)
                \K            # discard text matched so far
                (?:
                  [^\r\n\x5C]
                |   \x5C.           # backslash escape sequence
                )+
                (?:             # closing sequence
                  \h+           # ...starts w/ at least one white-space
                  \x23+           # ...contains only hashes, amount arbitrary
                )?            # ...is optional
                \h*$            # trailing white-space up till line-break
                |               # Setext-style heading
                \K            # discard text matched so far
                [^\r\n]+          # whatever,
                (?=             # ...up till
                  \h*(?:\r?\n|\n?\r)        # ...any trailing white-space and a line-break,
                  (?&amp;NOCODE_INDENT)       # ...indent for header indicator
                  (?:={3,}|-{3,})         # ...H1- or H2-header indicator resp.,
                  \h*$          # ...trailing white-space up till line-break
                )
                )
              "
            >
              <functionName>
              <nameExpr expr="(?x)
                (?|
                  (?:\h+\x23+\h*$)
                  [^\r\n]+
                  (?=
                  \h+\x23
                  )
                |   .*
                )
                "
              />
              </functionName>
            </function>
            </parser>
        

        Cheers.

        1 Reply Last reply Reply Quote 3

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors