racket / scribble

Other
194 stars 90 forks source link

Double underscore renders as single underscore #369

Closed countvajhula closed 1 year ago

countvajhula commented 1 year ago

Example: Qi uses a single underscore to capture a single input value:

(~> (2 3) (~a "The numbers are " _ " and " _)) ; => "The numbers are 2 and 3"

and double underscore to capture all input values:

(~> (2 3) (~a "The numbers are " __)) ; => "The numbers are 23"

In the docs, __ always appears as _. For example, see Templates and Partial Application. This also happens with the default (rather than manual) CSS style, as we see in Templates and Partial Application.

soegaard commented 1 year ago

I took a look at the Scribble file. I can see you are using examples. I think, you are running into this:

image

See the last sentence in the docs for racketblock.

countvajhula commented 1 year ago

Oh wow, can't believe it was that simple. It's been in the docs confusing newbies all this time 😆 Adding an extra underscore works:

@racket[___]

I will fix this soon. Thanks @soegaard !

countvajhula commented 1 year ago

Hmm, looks like I spoke too soon. It fixes it in places where we simply refer to the form, like @racket[___], but it still breaks in examples because of course there's no identifier called ___. Might there be a way to escape the escape?

sorawee commented 1 year ago

This works for me:

@(define my-__ @racketidfont{__})

@examples[
  (eval:alts #, @racket[(quote #,my-__)]  (quote __))
]

which produces:

Example:      
> '__      
'__

Read more about eval:alts at the documentation of examples.

countvajhula commented 1 year ago

This is great. Thank you @sorawee!