zig icon indicating copy to clipboard operation
zig copied to clipboard

std docs: bare urls are not linkified

Open nektro opened this issue 3 months ago • 4 comments

Zig Version

0.12.0-dev.3212+40e64245f

Steps to Reproduce and Observed Behavior

https://ziglang.org/documentation/master/std/#std.ascii

image

Expected Behavior

https://en.wikipedia.org/wiki/ASCII#Character_set should be clickable.

nektro avatar Mar 12 '24 03:03 nektro

  • The file seems to be here: https://github.com/ziglang/zig/blob/master/lib/std/ascii.zig
  • Zig seems to use commonmark: https://github.com/ziglang/zig/commit/d3eaa75c07aaac09d9dd74aa2a175ba799159faa
  • The docs are here: https://spec.commonmark.org/0.31.2/#autolinks
  • The syntax is: <http://foo.bar.baz>

geon avatar Mar 15 '24 16:03 geon

that implementation was deleted and replaced

edit: it seems that syntax is more widely supported anyway so we should update both the docs and the new parser

nektro avatar Mar 15 '24 19:03 nektro

The new Autodoc Markdown implementation isn't Commonmark, it's a custom implementation that lives here: https://github.com/ziglang/zig/tree/master/lib/docs/wasm/markdown The syntax using < should not be very hard to implement; the "raw URL" syntax probably isn't either, but there are some more questions about how to avoid ambiguity with trailing punctuation and parentheses. The GitHub flavored Markdown spec specifies this: https://github.github.com/gfm/#autolinks-extension- However, in my opinion, this is overcomplicated.

Personally, I think the < syntax is probably fine, and it's sufficiently minimal while still being explicit and not accidentally linkifying things that shouldn't be. I should have some time later this weekend to try implementing that, unless someone else would like to do it first.

ianprime0509 avatar Mar 15 '24 20:03 ianprime0509

Upon further consideration (and considering the existing standard library doc comments as examples of what doc authors want), I decided to implement the "plain text" style as well in #19402.

ianprime0509 avatar Mar 23 '24 01:03 ianprime0509