Marked Preview not following url-encoded intradocument hyperlinks

n8henrie's Avatar

n8henrie

14 Jul, 2013 06:00 PM

An issue I ran into today:

`[hello](#hello)` links to `<a id="hello"></a>` without any trouble, but `[hello there](#hello%20there)` won't link to `<a id="hello%20there"></a>` *in Marked.*

However, both links work just fine in the HTML generated by Marked; it's just in the Marked preview window that the url-encoded ones aren't followed.

  1. Support Staff 1 Posted by Brett on 14 Jul, 2013 06:16 PM

    Brett's Avatar

    It's quite likely something in the way the javascript handles intercepting link clicks, but before I spend any time on it can you explain in what situation percent-encoded internal links would be necessary?

  2. 2 Posted by n8henrie on 14 Jul, 2013 06:33 PM

    n8henrie's Avatar

    Fair enough.
    I've been using a TextExpander snippet to speed up creating Table of Contents for my blog posts. I use `,toc` and fill in the name of the section ("Intro", "Background", "Conclusion", etc.) and it spits out something like

    TOC
    * [Intro](#Intro)
    * [Background](#Background)
    * [Conclusion](#Conclusion)

    #### Intro<a id="Intro"></a>
    #### Background<a id="Background"></a>
    #### Conclusion<a id="Conclusion"></a>

    Today I tried using a multiword header and it obviously failed due to spaces, so I wrote a quick Python script to URL-encode the fragments.

    Like I said, the HTML output works, I just appreciate being able to check my fragment hyperlinks in Marked (which I can for the single-word fragments).

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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