atom-community / markdown-preview-plus

Markdown Preview + Community Features
https://atom.io/packages/markdown-preview-plus
Other
370 stars 85 forks source link

Links don't seem to be working (for example contents section) #477

Closed ChrisHastieIW closed 4 years ago

ChrisHastieIW commented 4 years ago

Hi,

When I include links in my .md file and preview it, clicking those links does not seem to take any action. For example the below code should link from the contents page to each section, yet it does not do anything when I select "Active Projects" on the preview.

## Contents

- [Ideas](#ideas)
    - [Idea 1](#idea-1)
- [Active Projects](#active-projects)

## Ideas

### Idea 1

## Active Projects

Thank you

lierdakil commented 4 years ago

And what do you expect those to do, exactly?

For one, if you're using markdown-it parser (the default), then it doesn't auto-generate anchors on headers, you need to add those yourself (or enable toc plug-in in the settings)

For two, the only thing that is supposed to happen is the linked anchor should scroll into view. On such short documents, it's very probable that all contents is already in view as is, so there's nothing to scroll. So...

Here's more or less what to expect here: mpp-toc

I've also enabled scroll synchronization in MPP settings here. Note that scroll synchronization only works well with markdown-it really.

Here's the relevant snippet from my config.cson:

"markdown-preview-plus":
    markdownItConfig:
      tocDepth: 3
      useToc: true
    syncConfig:
      syncEditorOnPreviewScroll: true
      syncPreviewOnEditorScroll: true
    syntaxThemeName: "one-light-syntax"
    useGitHubStyle: true
ChrisHastieIW commented 4 years ago

This has perfectly explained what I want to do. I'm new to .md and didn't realise I needed to add anchors myself using . Thank you for explaining how [[TOC]] works, I'll be using that as well.

Thanks