0

I am trying to go to a second part in the below mentioned .md file. The file is Myfile.md. its contents are:

    ## First part
    (an image)

    ## Second part
    (an image)

I am trying to access it from a html file by using the command

    <a href="some-url/Myfile#second-part">Second part</a>.

However, it is not pointing to the second part but pointing somewhere below that. Can anyone tell me how to correct it?

Clint
  • 201
  • 5
  • 11

1 Answers1

0

Experimenting, I found a solution using <div…/> but an obvious solution is to place your own anchor point in the page wherever you like, thus:

<a name="abcde"/>

before and

</a>

after the line you want to 'link' to. Then a markdown link like:

[link text](#abcde)

anywhere in the document takes you there.

The <div…/> solution inserts a "dummy" division just to add the id property, and this is potentially disruptive to the page structure, but the <a name="abcde"/> solution ought to be quite innocuous.

(PS: It might be OK to put the anchor in the line you wish to link to, as follows:

## <a name="head1"/>Heading One</a>

Please refer another question : How to link to part of the same document in Markdown?

Community
  • 1
  • 1
Tính Ngô Quang
  • 4,400
  • 1
  • 33
  • 33
  • this works if i want to move to a certain point in the same page, but i need to go from a different page. It's not working if I want to go from the first page to some point in the second page. – Clint Aug 24 '16 at 06:34
  • Please try : [a relative link](other_file.md#abcde) – Tính Ngô Quang Aug 24 '16 at 06:41
  • Same as before. It works if I am in the same page but not in a different page. – Clint Aug 24 '16 at 06:54