# Newbie Trouble using Scribble Links

**URL:** <https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237>\
**Category:** Questions & Answers\
**Tags:** scribble\
**Created:** [August 22, 2023, 8:30am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237 "2023-08-22T08:30:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [August 22, 2023, 8:30am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237/1 "2023-08-22T08:30:34Z")

</div>

Hi, Racket Discourse.

I am busy preparing some documentation for a presentation that I have to do this afternoon, but I am banging my head against a wall trying to use Scribble section references and the like.

All I want to do is, include a reference/link to a .scrbl file which is in the same directory as the file from which the file is being referenced. So, for argument's sake I have two files `main.scrbl` and `sub.scrbl` where the sub file contains:

> #lang scribble/base
> 
> @title[#:tag "example"]{Example Title}
> 
> This is some text.

and the main file contains:

> #lang scribble/base
> 
> @seclink["example" #:doc '(lib "sub.scrbl")]

When I include a reference to a file such as shown in this [cheatsheet](https://docs.racket-lang.org/scribble-cheatsheet/index.html#%28part._.Links%29), it works, but when I try and reference my file in the same manner, I get an output similar to

> (part ("(lib mzlib/sub.scrbl)" "example"))

I assume that this implies something about the path not being specified correctly but I don't know.

I have messed around a bit but, honestly, I don't have enough time to troubleshoot this at length and I can't imagine that it would really be that hard--I am obviously missing something trivial. I haven't used the Scribble lang much up until now, but I would really like to get my team to use the tooling for our internal documentation.

If anyone would be so kind as to assist, I would be very grateful.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [August 22, 2023, 8:46am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237/2 "2023-08-22T08:46:47Z")

</div>

Here is an example of how `seclink` is used in the manual of `rosette`.

First there is a main file that includes the other sections:

> <https://github.com/emina/rosette/blob/master/rosette/guide/scribble/rosette-guide.scrbl>

The chapters are given tags that begin with `ch:` (like you "example" tag).  
You can see a seclink in action in:

> <https://github.com/emina/rosette/blob/master/rosette/guide/scribble/welcome/welcome.scrbl>

---

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [August 22, 2023, 8:59am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237/3 "2023-08-22T08:59:13Z")

</div>

Thanks for the quick reply @soegaard, I appreciate it.

When I do this, the rendered (I hope I'm using this term correctly) link is simply a red underlined string, like so:

![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/4/4bec8ee2c525f504bd77f7d5f7656056e99be9a2.png)

I am using DrRacket's `Scribble HTML` button if that makes any difference.

Looking at the HTML, it seems like the generated link is somehow borked, with output:

`<p>Is this correct <font class="badlink">link</font></p>`.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [August 22, 2023, 9:38am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237/4 "2023-08-22T09:38:17Z")

</div>

Here is a full example:

> <https://gist.github.com/soegaard/070a9de04815c3979a431cdcce1597ae>

I don't know whether it makes a difference that you are using the Scribble button in DrRacket.

---

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [August 22, 2023, 9:58am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237/5 "2023-08-22T09:58:12Z")

</div>

Perhaps not important, but at least I could see the following by using the command line instead. When I run the command you provided, I get the following response:

> [Output to main/index.html]  
> Warning: some cross references may be broken due to undefined tags:  
> (part "ch:seclink-example")

Where the output is the same.

What I do notice, however, is that if I include the section as you have done, using

> @include-section{sub.scrbl}

the link works but it does not reference the other file, since it refers to the included section, I assume, which then also appears in the body of the rendered output below the link, instead of just the link to that file. Without the above, the link is "broken".

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [August 22, 2023, 10:06am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237/6 "2023-08-22T10:06:31Z")

</div>

I might be confused about your goal then.

Are `main.scrbl` and `sub.scrbl` part of the same document?  
[In my example they are.]

When `main.scrbl` is rendered should the link be to the raw file `sub.scrbl` or  
to the rendered version of `sub.scrbl`?  
[In my example, the link goes to a section in the rendered version of `sub.scrbl`].

---

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [August 22, 2023, 10:13am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237/7 "2023-08-22T10:13:51Z")

</div>

Oh dear, I see from the output that I should be looking at the `main/index.html` file; I was mistakenly looking at the previously generated (using DrRacket) `main.html`.

Doing exactly as you have done, I apologize, I see that the rendered output is what I expect. This basically solves my issue, thank you.

Is the unexpected output from DrRacket the intended behaviour? See, e.g., the comparative outputs:

Your solution.

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/1/131899a239ac6950aba1574d43b86122076aad69.png)

Using the same sources but DrRacket's `Scribble HTML` button.

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/3/3da3f5569309022abc3870ca51303aadefa0ea10.png)

In any event, thanks for the above.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [August 22, 2023, 10:18am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237/8 "2023-08-22T10:18:34Z")

</div>

Scribble files can be rendered as a single html file or as multiple html files.  
The default is single, the option `--htmls` produces multiple html files.  
I can't remember how the Scribble buttons in DrRacket work.

---

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [August 22, 2023, 10:20am UTC](https://racket.discourse.group/t/newbie-trouble-using-scribble-links/2237/9 "2023-08-22T10:20:29Z")

</div>

Cool, I will have a look at that; perhaps it might be possible to change the behaviour. I will go ahead and mark your reply above as the solution. And if I manage to modify the button, I will just add that here for posterity.

All the best, thanks, @soegaard.
