tdemin/gmnhg

List of links should be formatted as links

Closed this issue · 2 comments

Markdown:

* [Gemini specification](https://gemini.circumlunar.space/docs/specification.gmi)
* [Gemtext markup specification](https://gemini.circumlunar.space/docs/gemtext.gmi)

Output:

* Gemini specification
* Gemtext markup specification

Proposed output:

=> https://gemini.circumlunar.space/docs/specification.gmi Gemini specification
=> https://gemini.circumlunar.space/docs/gemtext.gmi Gemtext markup specification

My suggestion if a list contains both link-only and non-link items is to split the list up. Not perfect, but at least no information is lost. Example:

Markdown:

* Additional info [TBD]
* [Gemini specification](https://gemini.circumlunar.space/docs/specification.gmi)
* [Gemtext markup specification](https://gemini.circumlunar.space/docs/gemtext.gmi)
* Item with [inline link](https://www.example.com)
* Even more links coming soon...

Proposed output:

* Additional info [TBD]

=> https://gemini.circumlunar.space/docs/specification.gmi Gemini specification
=> https://gemini.circumlunar.space/docs/gemtext.gmi Gemtext markup specification

* Item with inline link

=> https://www.example.com inline link

* Even more links coming soon...

From glancing at the list/link code, I think it's supposed to work this way already, but there's a bug somewhere. I'll dig into it more when I have time.

It is one of the things that was initially hard to tackle in the renderer, and therefore I reused the existing heuristic of (Renderer).paragraph() instead in my own site to write Gemini-specific lists of links like this:

# List of links

[Link 1](gemini://somewhere.tld)
[Link 2](gemini://somewhereelse.tld)

that would render like this:

# List of links

=> gemini://somewhere.tld Link 1
=> gemini://somewhereelse.tld Link 2

I agree this is not how you'd probably expect the thing to work (and this hardly covers use cases aside for index pages), so will probably write another heuristic specifically for this case.

Looks like the fix to this is easier brought along with the solution to #16...