unison
unison copied to clipboard
Docs: Roundtrip issue with inlined code
A doc containing inlined code examples will sometimes be expanded into an invalid transcluded snippet.
Mini example (also in attached transcript):
doc = {{ `` 1 + 2 + 3`` inline }}
turns into:
doc : Doc
doc = {{ {{ docExample 1 (_ + -> 1 + 2 + 3) }} }}
Simple inline snippets like ``1+2`` or literals like ``"Hi"`` are fine, and more complicated inline snippets are also okay, like ``List.map (n -> n + 1) [1,2]``.
This is actually unrelated to #4660 it's caused by quirks with the `` syntax, which is special-cased to interpret ``foo x y`` as docExample 2 do x y -> foo x y, that is, to automatically interpret x and y as free variables.
Probably some special handling of operator chains would be good.