4

I have tried following code statements to show a URL:

#lang scribble/base

@title{Testing Hyperlinks}

@section{URLs}

Getting started: @hyperlink["https://docs.racket-lang.org/scribble/getting-started.html"]

Getting started: @hyperlink{"https://docs.racket-lang.org/scribble/getting-started.html"}

Getting started: @(hyperlink "https://docs.racket-lang.org/scribble/getting-started.html")

The html page is generating without any error with command "$ scribble hyperlinks.scrbl" but it is not displaying the URLs with any of the hyperlink statement:

Testing Hyperlinks

1 URLs
Getting started:

Getting started:

Getting started:

The generated html file contains following link:

<p>Getting started:</p><p><a href="&quot;https://docs.racket-lang.org/scribble/getting-started.html&quot;"></a></p>

Where is the problem and how can I correct this error?

rnso
  • 23,686
  • 25
  • 112
  • 234

1 Answers1

4

The hyperlink function expects the actual textual content to be supplied separately from the link itself. That is, you’re supposed to use it like this:

@hyperlink["http://example.com"]{some link}

And the rendered HTML will look like this:

<a href="http://example.com">some link</a>

If you want to typeset a literal URL, which links to its own content, use the url function instead.

Alexis King
  • 43,109
  • 15
  • 131
  • 205
  • 1
    Yes, it works. Somehow the documentation is very technical and does not have simple examples. – rnso Jul 31 '16 at 05:22
  • Yes, the scribble documentation in particular is missing a lot of examples, and it's even weirder because they have to present each function is s-expression notation, but you would normally use them with at-expression notation – Alex Knauth Jul 31 '16 at 11:11