Anchors not working for headers with spaces?

sylvaticus's Avatar

sylvaticus

09 May, 2019 02:55 PM

Hello,

I'm playing in a test file to make sure things are working before I write the next article for our company. Here's the "code" in Multimarkdown:

....TOC
....[Remove Test Participants](#remove-test-participants)
....[Anchor](#anchortest)
....
....a bunch of lorem ipsum
....
....### Remove test participants
....### AnchorTest
....
....When previewing in Marked2, it looks like both will work, but only the "AnchorTest" link works; the same thing when I export to HTML.
....
....I read a response on stackoverflow.com. I appear to be following *those* instructions correctly, but they might be wrong. Here's the URL to the advice: https://stackoverflow.com/questions/6695439/how-to-link-to-a-named-anchor-in-multimarkdown?rq=1

I'm not sure how to direct you to the answer I'm using, but it currently has 19 votes and here's the first part of the answer:
....> 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
....

Am I missing something completely obvious, or has there been some kind of a change so that only headers without spaces can be linked internally? I would like to be able to create the references with MMD Composer so I don't have to go back and add "<a href="#anchor" target="_self">" code by hand.

Thank you for your help!

  1. Support Staff 1 Posted by Fletcher on 09 May, 2019 04:11 PM

    Fletcher's Avatar

    I can't see your code because it gets converted to HTML. Indent with tabs before pasting in order to keep it as a code block so I can actually see what you're doing.

    But based on the SO page, that answer (19 votes) is not correct. The correct one is the accepted answer (125 votes) that cites the MMD documentation, since the question is about MMD. Other Markdown variants may use different approaches.

    Also, if all you want is a TOC, then just use the built-in one {{TOC}}.

    Fletcher

  2. 2 Posted by sylvaticus on 11 May, 2019 06:42 PM

    sylvaticus's Avatar

    Oops! I'm so sorry!

    Let me try that now—though with your answer, it may be unnecessary.

  3. 3 Posted by sylvaticus on 11 May, 2019 06:43 PM

    sylvaticus's Avatar

    oh. looks like i can't edit the origina?

  4. 4 Posted by sylvaticus on 11 May, 2019 06:50 PM

    sylvaticus's Avatar

    got it. edited (couldn't use tabs; pressing the tab key kept taking me out of the text field)

    oh, and TOC isn't really a TOC in my real doc; i just used it as a header here....

    thank you SO much for your help!

  5. Support Staff 5 Posted by Fletcher on 12 May, 2019 02:03 PM

    Fletcher's Avatar

    Glad it's sorted out, and let me know if you need anything else.

    Fletcher

  6. Fletcher closed this discussion on 12 May, 2019 02:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac