question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support internal links in markdown long_descriptions

See original GitHub issue

What’s the problem this feature will solve? I want to set internal links/anchors in my README.md/long_description in markdown format (for example See [the documentation](#documentation) for more information which links to a ## Documentation heading or an explicit <a name="documentation"></a> anchor). Ideally I’d like to use the same internally linked Markdown source for both GitHub and PyPI.

Describe the solution you’d like Explicit link creation via <a name> and <a id> should be supported (maybe only <a name>, depending on the potential to disturb any Javascript code).

Ideally GitHub-compatible automatic anchor generation for headings should also be supported.

Additional context A GitHub README.md supports two ways of setting anchors:

  • Implicitly, by generating an anchor from a heading (an <a id="lower-case-with-some-chars-replaced-by-hyphens">)
  • Explicitly, by placing <a id="..."> or <a name="..."> tags.

Warehouse does not automatically generate anchors for headings. It also strips id and name attributes from HTML embedded in the Markdown file. This leaves no possibility of linking to another location within the description (without using an absolute link to PyPI.org, which is undesirable since the README is typically used in other places like GitHub too).

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:18
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
vgavrocommented, Mar 26, 2021

My two cents: For now pypi doesn’t strip <a id="xxx"></a> tag, recommended way to create anchors for both github and pypi:

### Title<a id="title"></a>

(Note - no space between title and tag, otherwise you’ll have self-link 🔗 pointing “title-” instead of “title”)

BUT - it would be awesome if pypi would automatically create anchors same way as github do.

andrewtaviscommented, Mar 17, 2021

Not sure if there have been fixes in regards to all this - maybe id tags aren’t being stripped anymore, or you simply need to add them explicitly - but the following works on both GitHub and PyPI now:

Contents:<a id="contents"></a> [Section Header](#section-header)

# Section Header [`↩`](#contents) <a id="section-header"></a>

Using ↩ in single quotes creates what to me is an intuitive/appealing back button (although it’s rendered differently on PyPI). See any of my projects for an example of how it looks/functions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating Links in Markdown - The AnVIL
Internal Links. For internal links (links to other AnVIL portal pages) we need to follow a few rules: Use the "relative path" to...
Read more >
How to link to part of the same document in Markdown?
So you can do the following: [Custom foo description](#foo) # Foo. In the above case, the Foo header has generated an anchor tag...
Read more >
Markdown Syntax Documentation - Daring Fireball
Markdown supports two style of links: inline and reference. In both styles, the link text is delimited by [square brackets]. To create an...
Read more >
Support internal/anchor links in rendered Markdown
Thanks for letting us know. To get links to headers working you need to add the prefix markdown-header-. i.e. markdown-header-document-organization. I've fixed ...
Read more >
Handbook Markdown Guide - GitLab
Don't take it as a restrictive rule, but avoid using meaningless text for links as "this article" or "read here." The link text...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found