odoc icon indicating copy to clipboard operation
odoc copied to clipboard

Cross-references and links are not allowed in headers

Open dbuenzli opened this issue 6 years ago • 9 comments

ocamldoc was fine with them. Currently this also drops the reference text which is annoying.

I don't exactly see what's the problem with having xrefs in headings.

Example:

https://b0-system.github.io/odig/doc/fpath/Fpath/index.html#ex_append https://erratique.ch/software/fpath/doc/Fpath.html#ex_append https://github.com/dbuenzli/fpath/blob/f679f231ee994e30ca2f5f2b327b3750e9bdf82d/src/fpath.mli#L612

opam install fpath odig
odig odoc -v fpath
[...]
File "src/fpath.mli", line 599, characters 18-28:
'{!...}' (cross-reference) is not allowed in '{2 ...}' (section heading).

dbuenzli avatar Mar 27 '19 23:03 dbuenzli

Also it seems links ({{:link}link}) are no longer allowed which are then bizzarely turned into em and in the toc aswell (?!).

This is a significant usability issue for tsdl's documentation since we were linking in the documentation of the corresponding C library.

Basically I get lines and lines of:

File "tsdl.mli", line 108, character 12 to line 109, character 41:
'{{:...} ...}' (external link) is not allowed in '{2 ...}' (section heading).

on these kind of heading. A rendering can be consulted here.

I think it would be nice if we could get rid of all these new useless restrictions.

dbuenzli avatar Jul 19 '19 14:07 dbuenzli

How should a link to a section be rendered, when there is a link inside the link?

aantron avatar Jul 19 '19 14:07 aantron

If we have:

{1:sec-id {{:https://foo.bar}Foo bar lol}}

blabla blabla see {!sec-id}

then I would suggest render emitting {!sec-id} as <a href="#sec-id>Foo bar lol</a>.

trefis avatar Jul 19 '19 15:07 trefis

Similarly, the section should become: <h1><a href="https://foo.bar">Foo bar lol</a></h1>

trefis avatar Jul 19 '19 15:07 trefis

So, to confirm, we allow and retain the nested link for the section itself, but unwrap it for the toc and references?

aantron avatar Jul 19 '19 17:07 aantron

Yes, that's the way it used to be done.

dbuenzli avatar Jul 19 '19 18:07 dbuenzli

Any news on this?

trefis avatar Nov 25 '19 09:11 trefis

@trefis the news is that it's still an (annoying) issue.

dbuenzli avatar Feb 28 '21 21:02 dbuenzli

Three years laters this still significantly degrades the documentation user experience of tsdl's documentation which provides:

> git grep "{[^{]:.* {{" | wc -l 
      23

direct links to SDL's subsystems documentation and which currently go unrendered.

dbuenzli avatar May 31 '22 12:05 dbuenzli

Fixed by #942

panglesd avatar May 15 '24 14:05 panglesd