How to negate / escape a show rule?

Heya,

I’m trying to implement a custom function where the function does not follow of any previous #show implementation. Something as follows:

// This makes all links to have underlines in the document
#show link: underline

#let hiddenlink = (url, body) => {
  // I want this link to not have any underlines!
  #link(url)[#body]
}

Preferably without any state management / counters, what’s the best way of doing this?

Thanks a lot!

Hello @Xyy,

Welcome to the forum.

The answer is not really to cancel the show rule (as this is not as easy to do) but you will find a solution to your question in How do I underline URLs with display texts containing more than one character? - #3 by bluss

1 Like

The answer of @bluss is pretty well, but if u dont’t want to call the function nonunderline() every where, try:

#show link: it => {
  let b = it.body.text
  if b.at(-1) == "-" {
    show underline: u => u.body
    link(it.dest, b.slice(0,-1))}
  else {
    underline(it)}}

#link("https://www.a.com")[Web A]
#link("https://www.b.com")[Web B-]

As for general show/set rule escaping, see: