racket / scribble

Other
199 stars 91 forks source link

Inconsistent href #382

Open sorawee opened 10 months ago

sorawee commented 10 months ago

tl;dr: generated href could be inconsistent depending on several factors. Here are some of the possible values:

The second and third variation seem OK, but the first variation contains an absolute path, which is not portable to other systems.

First variation

Consider test/scribblings/test.scrbl

#lang scribble/base

@section{foo}

foo content

Make sure to install test as a package with the following info.rkt:

#lang info
(define collection "test")
(define scribblings '(("scribblings/test.scrbl" ())))

Then, in the directory test/scribblings, run scribble +m test.scrbl.

The generated HTML contains:

<a href="file:///Users/sorawee/playground/test/scribblings/test.html#%28part._foo%29" class="tocviewlink" data-pltdoc="x">foo</a>

Second variation

Now, run scribble +m --dest . test.scrbl.

The generated HTML contains:

<a href="test.html#%28part._foo%29" class="tocviewlink" data-pltdoc="x">foo</a>

Third variation

Now, run raco pkg remove test and re-run scribble +m test.scrbl.

The generated HTML contains:

<a href="#%28part._foo%29" class="tocviewlink" data-pltdoc="x">foo</a>