unison icon indicating copy to clipboard operation
unison copied to clipboard

Single backtick syntax for monospace does not render inside parenthesis

Open rlmark opened this issue 1 year ago • 2 comments

When the first word inside a parenthetical statement is monospaced with the single backtick syntax:

test = {{

  `hi` hi

  (this is a parenthesis `hi` blah)

  (`now` it starts with a backtick, which is not treated as monospace)
}}

The local, share, and website UI does not render the monospace syntax as monospace.

Screenshot 2024-03-
backticksInParens.md
11 at 1 29 54 PM

A transcript is attached, but you will need to open the UI to see the issue. backticksInParens.md

rlmark avatar Mar 11 '24 20:03 rlmark

Yeah looks like a parser issue

    2 | > {{ (`hello` there ) }}
          ⧩
          Paragraph [Word "(`hello`", Word "there", Word ")"]

Notice it's just parsing the opening paren and the subsequent backticked word as a single token.

pchiusano avatar Mar 11 '24 20:03 pchiusano

This part of Lexer.hs seems like the culprit. It gobbles up a word until reaching a non-space character, but it should probably stop if encountering a backtick or double quote.

CleanShot 2024-03-11 at 15 50 44@2x

pchiusano avatar Mar 11 '24 20:03 pchiusano

I think this is the same issue as #4633.

wordy needs to lookAhead for any potential leafy opening sequences (here it says docOpen, but that is just coincidentally the same symbol as the opening for transcludes, but really, a single { suffices, as well as backtick, '', *, ~, @source, etc.). It might need to P.try leafy character by character, as a [ is only the end of wordy if there are later ]( and ), for example.

sellout avatar Jul 04 '24 16:07 sellout

Duplicate of #2483.

sellout avatar Jul 09 '24 06:07 sellout