I think I've run into this too (but my memory is foggy) and what I did was
have a macro that expands into `code` and also expands into the actual code
but walks over the code and drops things like code:hilite and code:comment.

Robby


On Sun, Aug 23, 2020 at 9:23 AM Éric Tanter <[email protected]> wrote:

> Ok, I “solved” my problem.
>
> The `(define (code:hilite v) v)` is a hack to be able to use `code:hilite`
> in blocks that are executed, not just displayed, but of course that does
> not work when highlighting binders.
>
> The solution is to separate the display from the execution, with a
> separate evaluation in the corresponding evaluator.
>
> The downside is that this forces a duplication of the code (once to
> display with highlight, once to evaluate). I’m still interested in knowing
> if there’s a duplication-free solution to this, but meanwhile I’ll just
> live with it.
>
> — Éric
>
>
>
>
> > On Aug 22, 2020, at 6:25 PM, Éric Tanter <[email protected]> wrote:
> >
> > Just to complement: I’m editing some scribble I wrote years ago and I
> completely forgot why I was doing that, but to be able to use
> `(code:highlight …)` in code blocks, I had to add the following line (where
> `ex-eval` is my base evaluator):
> > ```
> > @interaction-eval[#:eval ex-eval (define (code:hilite v) v) ]
> > ```
> >
> > sorry if that’s confusing, but I’m confused ;-)
> >
> > I just want a way to highlight any bits in a code block, in order to
> bring the reader’s attention to specific places (could be binders, whole
> expressions, etc.).
> >
> > Thanks!
> >
> > — Éric
> >
> >
> >
> >
> >> On Aug 22, 2020, at 6:15 PM, Éric Tanter <[email protected]> wrote:
> >>
> >> Hi,
> >>
> >> From the doc: `(code:hilite datum)` typesets like `datum`, but with a
> background highlight.
> >> However, it does not work to highlight a binder, eg: `(letrec
> ([(code:hilite self) …]) …)`
> >> Is there another way to highlight a binder?
> >>
> >> Thanks,
> >>
> >> — Éric
> >>
> >>
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/32CE30FE-9724-4421-9A8B-63780A403A5A%40dcc.uchile.cl
> .
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/09CDBBC0-8A5B-4573-9CC6-DA41B3DE53C1%40dcc.uchile.cl
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/1BE55C14-6B08-4FFC-85EA-C6590D84C1E0%40dcc.uchile.cl
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdOPLXFp1%2B%2BaqPS3nEbLE3kiF%2BO-%2BVSei2vJcb-8Ju5Mz1g%40mail.gmail.com.

Reply via email to