Language: EN

como-usar-enlaces-en-markdown

How to use links in Markdown

In Markdown, links are a key tool to facilitate navigation, provide references, and enrich the reader’s experience.

Links can be

  • Internal, directing to other sections within the same document (or the same website)
  • External, taking the reader to external websites or resources

External links allow readers to access resources outside the document, such as relevant websites, articles, or databases.

To create an external link in Markdown, the following syntax is used:

[Link Text](URL-of-the-link)

For example, this Markdown fragment,

[www.luisllamas.es](https://www.luisllamas.es)

renders as:

Sometimes, it is useful to provide additional context for the link. You can do this by adding an optional title in quotes after the URL.

[www.luisllamas.es](https://www.luisllamas.es "Complete Markdown Guide")

This renders as:

When the reader hovers over the link, they will see the descriptive text provided.

Internal links are useful for navigating between different sections within the same document.

Markdown does not natively support internal links in all engines, but it is possible to do so in many environments, especially on platforms like GitHub and GitLab.

To create an internal link, the following syntax is used:

[Link Text](URL-of-the-link/#anchor-name)

Where #anchor-name corresponds to the identifier of the section you want to link to. This identifier is based on the text of the heading you are linking to, converted to lowercase and with spaces replaced by hyphens.

For example

[Internal Links](/how-to-use-links-in-markdown/#internal-links)

This renders as:

If you click on it, it will take you to the top of the “Internal Links” section on this same page.

Finally, we can also underline or highlight a fragment of text. To do this, we must indicate the beginning and the end of the text we want to highlight, for example like this:

[Highlighted Internal Link](/#internal-links:~:text=Internal%20links,Github%20and%20Gitlab)

Which renders as:

If you press it, it will take you to the top of the “Internal Links” section, with the first paragraph selected.

Best Practices Tips

Clarity in Link Text: Use clear and descriptive text so that the reader understands the purpose of the link before clicking.

Personally, I do not use the floating tooltip part, as it causes issues on some platforms. But the text does.

External Links: External links may stop working because they do not depend on you. Ensure that external links are relevant and provide additional value to the content. If not, do not add them.