One of my goals for the new year is to write more. I would like to both publish my writing as well as be completely honest. I’d like to write for myself for therapeutic reasons, but only carefully—not fully—expose myself.

In order to free myself to write more openly, I wrote a little plugin to redact portions of what I write from publication. This strategy works well with static site generation since the original content contains the unredacted text, but it can be completely stripped from the copy at publication time. You can view source, but all you’ll see is little blocks (unicode U+2588).

That means I am free to write what I think, such as ███████████████████ ██████████████████████████████████████, without fear that █████████ will see it and ████████████████████████████████.

Plugin:

class Redacted < Liquid::Block
  def initialize(tag_name, markup, tokens)
     super
  end

  def render(context)
    "<span class=\"redacted\">#{super.gsub(/./, '█')}</span>"
  end
end

Liquid::Template.register_tag('redact', Redacted)

Styling:

.redacted {
    color: black;
    background-color: black;
    word-break: break-all;
}

Usage:

{% redact %}
This is a redacted paragraph.
{% endredact %}
You can also redact {% redact %}specific portions{% endredact %} of paragraphs.