A method for redacting an electronic document (ED) having a file format, including: obtaining a request to redact a sensitive data item in the ED; identifying a first and a second instance of the sensitive data item in a markup of the ED, where the second instance of the sensitive data item is not visible in a rendered version of the ED; and generating a redacted ED having the file format by replacing the first and the second instance of the sensitive data item with a neutral data item.