Community
    • Login

    Plugin Request: Markdown navigation panel

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 1.3k 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.
    • xamountX
      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
        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
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors