I want an optional line-breaking character that is always invisible that works with the word-wrap: break-word;
CSS style.
Here are some specifics. My goal is to break apart long links in reasonable places. These characters are a good place to start: -
, .
, _
, /
, \
. This is not a Rails-specific question, but I wanted to share some code I'm using now:
module ApplicationHelper
def with_optional_line_breaks(text)
text.gsub(%r{([-._/\\])}, '\1­')
end
end
Here's the problem with the code above: when ­
takes effect (in a table with: word-wrap: break-word;
), ­
gets displayed as -
. I don't want to see the -
; I want a line break without any character shown.
tag not work for you in this case? – Christopher Marshall Apr 05 '13 at 18:40
` is not an optional line break – David J. Apr 05 '13 at 19:06