-1

I have a function in python 3.x

def foo():
"""Lorem ipsum for more info, see here""

I want to add a hyperlink to 'here' to point to a website. How can I do that without installing external plugin?

James Z
  • 12,209
  • 10
  • 24
  • 44

2 Answers2

3

Just add the link as a string into the docstring, like so:

def foo():
    """Lorem ipsum for more info, see here: www.myfancydocu.com""

The doctring is just a string, so there is no Hyperlink. But anyone that wants to look at the website can just copy the link.

There are automatic documentation-builders that build a documentation out of your code and docstrings in e.g. html. Those can probably add hyperlinks to the documentation with a specific syntax, but that syntax then depends on which documentation-builder you use. If you only have your code, then just adding the url as a string is all you can do.

MangoNrFive
  • 1,541
  • 1
  • 10
  • 23
3

If you're using sphinx to generate your documentation

""" 

`here <url>`__

"""

in your docstrings should be parsed properly.