How to link to a named anchor in Multimarkdown?

后端 未结 7 1591
醉酒成梦
醉酒成梦 2020-11-28 17:21

I have come across a number of mentions of MultiMarkdown\'s support for internal links / named anchors but I am unable to find a single example of how to actually do it.

7条回答
  •  北海茫月
    2020-11-28 17:31

    The best way to create internal links (related with sections) is create list but instead of link, put #section or #section-title if the header includes spaces.

    Markdown

    Go to section
    * [Hello](#hello)  
    * [Hello World](#hello-world)
    * [Another section](#new-section) <-- it's called 'Another section' in this list but refers to 'New section'
    
    
    ## Hello
    ### Hello World
    ## New section
    

    List preview

    Go to section
    Hello           <-- [Hello](#hello)                 -- go to `Hello` section
    Hello World     <-- [Hello World](#hello world)     -- go to `Hello World` section
    Another section <-- [Another section](#new-section) -- go to `New section`
    

    HTML

    Go to section

    Hello

    Hello World

    New section

    It doesn't matter whether it's h1, h2, h3, etc. header, you always refer to it using just one #.
    All references in section list should be converted to lowercase text as it is shown in the example above.

    The link to the section should be lowercase. It won't work otherwise. This technique works very well for all Markdown variants, also MultiMarkdown.

    Currently I'm using the Pandoc to convert documents format. It's much better than MultiMarkdown.
    Test Pandoc here

提交回复
热议问题