#redacted text

18 messages · Page 1 of 1 (latest)

gleaming bough
#

I'm finding myself in need to react various words and sentences for a document sent to different audiences.

I initially thought this would be pretty easy - measure the content, draw an inline rect as a black box instead of the actual text, etc.

In practice, this is more complicated than I expected (of course). Sentences wrapping lines, etc.

I want to make it clear the text is present, but intentionally unreadable, and easy to toggle for the audience it's going out to. #redact[sekrit info]

Any ideas on this one?

rugged breach
#

would highlight work?

#

?r

#let redact(content) = {
  show regex("[^\s]"): it => highlight(fill: black, text(fill: black, it))
  content
}

#redact[Jackdaws love my sphinx of quartz]

#redact(lorem(100))
quick stratus
#

?r

#let redact(body) = context {
  let size = measure(body)
  let xx = size.width
  let yy = size.height
  [#line(length: xx, stroke: 10pt + gradient.linear(..color.map.rainbow))]
}


If you combine bingo with jackpot you get #redact([bingpot!]) Cool cool cool cool cool cool cool. 

An alternative is the strike function 

This is #strike(stroke: 14pt + gradient.linear(..color.map.rainbow))[redacted text that you want to be kind of hidden]. It may not be the best solution. But it’s a solution. 

quick stratus
#

It’s not amazing. But it might help you out. The problem is when you have line breaks. I think this is what you were saying before. If you pair this with an unnamed function you might be able to replace instances of a single word. This isn’t as easy to solve as you suggested.

tired coyote
#

?r

#let redact(content) = {
  show par: it => context block(fill: text.fill, hide(it))
  content
}

#redact[Jackdaws love my sphinx of quartz]

#redact(lorem(100))
gleaming bough
#

Whoa! Y'all were quick. Both the highlight (probably coupled with a replace) and the block+hide look like they'll work great. Thanks! 👍

late holly
#

note that hide will prevent viewers from selecting the text in a PDF, while highlighting will not. On paper, it doesn't matter of course

mortal kite
#

is it possible to react one small part of code in a larger code figure?

late holly
#

I don't think so, in code you can't easily add markup to do that. But if you use a monospace font for code, it would be relatively easy to replace a section of the text with spaces, though.

mortal kite
#

thank for that answer 🙂

finite pilot
#

Hide is definitely important for actual redaction

high willow
#

?r ````#let _redact = true

#let redact(content) = {
if _redact {
box(fill: text.fill, hide(content))
} else {
content
}
}

#show "et ": it => redact(it)
#show "doleamus ": it => redact(it)

#lorem(200) With LinearAlgebra

#figure(caption: "My Code")[
#show "LinearAlgebra": it => redact(it)

using LinearAlgebra
x = rand(100,100)\rand(100)

]````

spare plazaBOT
high willow
#

I just realized I don't know how to nest code chunks in Discord for the renderer. Above is using a show method w/ redaction in a figure code block. To me, using show makes for sense than literally wrapping each text in a function call. You can also make _redact and CLI input by using

#let _redact = if sys.inputs.keys().contains("redact") {
  lower(sys.inputs.at("redact")) in ("1", "true")
} else {
  false
}

and

 typst compile --input redact=true main.typ