I'm writing a text which has a lot of long Redis keys and camel cased text (like class names). This could be extended to long keywords and namespaces too. I want to accentuate these in way, so I'm using \texttt for this. The problem is that these are regularly overflowing out of the margin.
For example, the following snippet:
I'm having the issue that my Redis keys are overflowing, e.g. \texttt{Key:SubKey:SubSubKey:SubSubKey}.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Results in:
I have solved this with my custom \rediskey command:
\usepackage{xstring}
\newcommand{\rediskey}[1]{\texttt{\StrSubstitute{#1}{:}{:\allowbreak{}}}}
Which results in:
I'm having the issue that my Redis keys are overflowing, e.g. \rediskey{Key:SubKey:SubSubKey:SubSubKey}.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
However, is their a better alternative to \texttt that might not have this problem?
Is there a better way to implement \rediskey?
Could someone help with the implementation of a \camelcase command that would allow breaks before a capital for example? (One caveat is that some of these are prefixed with 'I' to designate that it's an interface, and it would be weird to allow a break after one character.)

