How do I prevent auto-generated links in the GitHub wiki?

前端 未结 5 1388
轻奢々
轻奢々 2021-02-01 12:29

On a GitHub wiki page, if I type:

www.foobar.com

GitHub automatically assumes this is a URL and makes the text a hyperlink to http://www.foobar

相关标签:
5条回答
  • 2021-02-01 13:06

    This isn't limited to wiki page, and is part of the GFM (GitHub Flavored Markdown) url autolinking feature.

    Putting them in `` can work but display the url as a code: foo http://example.com bar.

    foo `http://example.com` bar
    

    Another trick (mentioned in this gist) is

    ht<span>tp://</span>example.com 
    

    That will display http://example.com as regular text.

    In your case (without the http://)

    w<span>ww.</span>foobar.com
    

    That would also display www.foobar.com as regular text.

    geekley adds in the comments:

    For emails, you can use foo<span>@</span>example.com

    0 讨论(0)
  • 2021-02-01 13:11

    Also, if you are having a issue with something other than a URL auto-linking I found escaping the . works as well.

    Example:

    foobar.web -> foobar&#46;web
    
    0 讨论(0)
  • 2021-02-01 13:14

    Would suggest to use zero-width no-break space.
    In HTML could be used as Unicode char reference: &#xfeff; or &#65279;

    Benefits are:

    • prevents autolinks (obviously)
    • invisible
    • no unexpected line breaks
    • readable in source

    Examples

    For urls insert between http and :
    https​&#65279;://example.com/ → https​://example.com/

    For emails insert after @:
    user@&#65279;example.com → user@example.com

    0 讨论(0)
  • 2021-02-01 13:26

    You can use a zero-width space to prevent most auto-linkers from interpreting characters as a URL

    Here's an example with a zero width space inserted between https and :

    https​://example.com/

    To insert one, you can copy from the url above or this page

    See also this thread on twitter

    0 讨论(0)
  • 2021-02-01 13:28

    You can also just apply a backslash escape to the colon (or any of the other punctuation, apparently), like this:

    http\://www.foobar.com
    
    0 讨论(0)
提交回复
热议问题