links to in-page anchors not working in Marked2's preview.

omneusr's Avatar


17 Oct, 2016 12:59 PM

Hi and good day,

Although footnote links are working in Marked2, intext [links](#1) to an intext anchor are not working, why not?

My Marked editor is Mou, everything working fine there, why not Marked? Please answer this question.

[links](id:1 )with best regards,
Omar K N
Stockholm, Sweden

( The ” repository for Custom Styles on Github” is not helpful.)

  1. Support Staff 1 Posted by Brett on 17 Oct, 2016 04:06 PM

    Brett's Avatar

    I'm not sure what the syntax you're showing is from, but it's not how in-document anchors would work. By default, only headlines get anchors, and in both GFM and MultiMarkdown you can force an anchor ID using syntax (though different between them). If you want to create a custom anchor, you need to use an HTML tag:

     <a id="1">

    Could then be linked to with

    [link title](#1)

    the id:1 syntax is not a Markdown flavor that Marked recognizes.


  2. 2 Posted by ss on 26 Jul, 2019 07:32 PM

    ss's Avatar

    // Please enter a detailed description of the issue // Description of the issue:

    Clicking a content link with href="#anchor" targets incorrectly

    // Please enter a list of steps required to reproduce the issue // Steps to reproduce:

    1. create a "table of contents" w/- label
    2. create content which uses blah
    3. create target anchor
    4. click the content link. It'll go to the toc even though that's wrong...the toc entry does not have name="anchor", it has href="#anchor", it's not a target, it's another link to the same target.

    // If applicable please attach a sample document that causes the issue for you.

    // Configuration (do not edit) Marked 2 974 (Direct)

    macOS Version: 10.13.6

    allowPageBreakInCode: YES
    bookTxtIsLeanpub: NO
    summaryMdIsGitBook: NO
    codeIsPoetry: NO
    codeCanWrap: YES
    collapsibleHeadlines: NO
    convertGithubCheckboxes: YES
    convertYAMLToMMD: NO
    defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
    defaultPreviewStyle: 100
    defaultProcessor: Discount (GFM)
    enableMiniMap: NO
    excludeBlockQuotesFromCounts: NO
    excludeFootnotesFromCounts: NO
    excludeVerbatimFromCounts: NO
    excludeCaptionsFromCounts: NO
    folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
    githubNewlines: NO
    h1IsPageBreak: NO
    h2IsPageBreak: NO
    hrIsPageBreak: NO
    includeMathJax: NO
    includeKatex: NO
    limitTextWidth: YES
    minimalJavaScript: YES
    permissionGranted: NO
    printHeaderFirstPage: NO
    printFooterFirstPage: NO
    processHTMLFiles: YES
    removeMetadataForPreview: NO
    removeYAMLHeaders: NO
    scrollToEdit: YES
    shouldDetectCritic: YES
    shouldHighlightMarkupErrors: YES
    shouldLoadCritic: NO
    syntaxHighlight: NO
    syntaxHighlightOnlyLang: NO
    useCustomMarkdownProcessor: NO
    useCustomPreprocessor: NO
    useFirstH1AsPrintTitle: YES

  3. Support Staff 3 Posted by Brett on 26 Jul, 2019 09:40 PM

    Brett's Avatar

    Try using id=anchor instead of name=anchor (that's been deprecated for
    some time). Let me know if that helps, there may still be issues
    surrounding what Marked does to handle its own table of contents links
    that sometimes overrides manual anchors.


  4. 4 Posted by ss on 26 Jul, 2019 09:45 PM

    ss's Avatar

    Seems slightly better, but the "in-content" link still fails to navigate to the target properly. It seems to go to the top and then move downward a certain amount that I can't determine any pattern for. It no longer navigates back to the link in the toc however... so that's something ;)

  5. Support Staff 5 Posted by Brett on 26 Jul, 2019 09:48 PM

    Brett's Avatar

    Ok, I'm on the road for the weekend so I won't be able to look into this further until next week.  Thanks for your patience.

    - Brett

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


? 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