-
-
Notifications
You must be signed in to change notification settings - Fork 859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to redact text #4511
Comments
Isn't something like this already doing the job? // simple redaction
#let redact(body, color: black) = box(hide(body), fill: color)
// redaction as in the issue
#let redactre(body, color: black) = {
show regex("[^\s]"): it => redact(it, color: color)
body
} |
That does not hide the size of redacted words |
Then I do not understand what the intent is. By using |
The regex approach still leaks information in the PDF output because the boxes contain information about the size of the glyphs or words. See https://www.wired.com/story/redact-pdf-online-privacy/
The code below shows the several issues. The first paragraph shows how #hide properly spaces, but does not communicate that there was a redaction. The second shows #box breaks the line if the selected overlaps into the next line. The third paragraph shows how #regex leaks the size of the glyphs in letters or words into the PDF file (even if it appears as all black that runs together). // simple redaction
#let redact(body, color: black) = box(hide(body), fill: white, stroke: red)
// redaction as in the issue
#let redactre(body, color: black) = {
show regex("."): it => redact(it, color: color)
body
}
#box(stroke: black, inset: 1em)[#lorem(10) #lorem(10) #lorem(5)]
`#hide`
#box(stroke: black, inset: 1em)[#lorem(10) #hide(lorem(10)) #lorem(5)]
`#box`
#box(stroke: black, inset: 1em)[#lorem(10) #redact(lorem(10)) #lorem(5)]
`#regex`
#box(stroke: black, inset: 1em)[#lorem(10) #redactre(lorem(10)) #lorem(5)] |
Well I guess one could create a broken/bad implementation by start & end point, text height, content size and line spacing measurements, but a good solution seems not possible to me with the current typst version. |
How about something like this?
I also tried to measure how much space is left on the current line (with #set page(paper: "a6")
#let redact-box(width) = {
box(rect(height: 1em, width: width, fill: black, stroke: none))
}
#let redact(size: none, body) = context {
if size != none {
redact-box(size)
} else {
let redact_size = measure(body) // size of the text that is to be redacted
let redacted = int(redact_size.width.mm()) // width in number of mm's
// create a 1mm-box for each mm
for i in range(redacted) {
redact-box(1mm)
}
}
}
Pursuant to Federal Circuit Rule 47.4, counsel for Petitioner certifies
the following:
1. The full name of the party represented by me: #redact[Public Co.], Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim aeque doleamus animo, cum corpore #redact(size: 2cm)[dolemus], fieri tamen permagna accessio potest, si aliquod aeternum et infinitum impendere malum nobis opinemur.
2. Quod idem licet transferre in voluptatem, #redact[ut postea variari voluptas distinguique possit, augeri amplificarique non possit. At etiam Athenis, ut e patre audiebam] facete et urbane Stoicos irridente, statua est in quo a nobis philosophia defensa et collaudata est, cum id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et. |
Description
In some documents, especially legal documents, it is important to redact information with the content removed from the output pipeline so it can not be recovered. At the same time, it is important to provide a visual indication of the redacted information, and to do so in various formats. The most basic redaction is a black line that starts within a text paragraph to the end of the line. There is no indication of word length within the redacted text.
Some prior solutions tried to use the
highlight
function, but it does not hide the content (and does not work well withhide
presently) and also does not hide the size of the redacted words, like here:Use Case
The
hide
function seems to do exactly what is required, but its content is literally hidden and does not provide a visual indication of a deliberate redaction. It would be important for legal text ifhide
includes afill
argument that is customizable to provide this.#hide(fill: black, content)
is the minimum needed, and should be easy to implement.The text was updated successfully, but these errors were encountered: