ford icon indicating copy to clipboard operation
ford copied to clipboard

Is it possible to add links to a section of the same page?

Open ecasglez opened this issue 3 years ago • 4 comments

I am using Ford page_dir feature to add some documentation in a project. I would like to know if it is possible to add links to a section of the same page.

I tried using the information I found here, links are added but they do not work.

I attach example files to this report: ford_links.tar.gz

ecasglez avatar Sep 14 '21 17:09 ecasglez

Hi @ecasglez, you can make this work by adding:

md_extensions: markdown.extensions.toc

to your doc.md configuration file. This uses the table of contents extension which adds the link anchors to each section heading.

Maybe this is an extension we should enable by default?

ZedThree avatar Sep 15 '21 10:09 ZedThree

Hi. Thanks for your quick reply.

I didn't notice that I could manually activate additional markdown extensions. I think the current behaviour is OK unless a lot of people use this feature.

ecasglez avatar Sep 15 '21 17:09 ecasglez

It is buried in the wiki, but it isn't obvious that this extension does what you want.

Github-flavoured markdown does enable this behaviour by default (which is dialect of markdown used in the SO link you posted), so I'm guessing a lot of people will be familiar with that.

ZedThree avatar Sep 16 '21 08:09 ZedThree

If this behaviour is the default in some other tools, then it might be a good idea to have this as default in Ford too.

ecasglez avatar Sep 20 '21 06:09 ecasglez