title: Formatting Javascript sub strings using Jade
body: <p>I have a javascript string that I need to split by format type written inside the string so that I can output bold and italic text in jade such that</p>
  
  <pre><code>"Hello {b World b}{i and everyone i} else! And {i hello to you i}. 1 &lt; 5."
  </code></pre>
  
  <p>would output:</p>
  
  <p>Hello <strong>World</strong> <em>and everyone</em> else! And <em>hello to you</em>. 1 &lt; 5</p>
  
  <p>The string contains an indeterminate amount of these tags (0+) in any order, but I only care about "i" and "b" tags.  I've tried a simple string.replace and tried injecting html:</p>
  
  <pre><code>- line = line.replace("{b ", "&lt;b&gt;");
  - line = line.replace(" b}", "&lt;/b&gt;");
  - line = line.replace("{i ", "&lt;i&gt;");
  - line = line.replace(" i}", "&lt;/i&gt;");
  | #{line}
  </code></pre>
  
  <p>But the jade template tries to be smart and outputs:</p>
  
  <pre><code>"Hello &lt;b&gt;World&lt;/b&gt;&lt;i&gt;and everyone&lt;/i&gt; else! And &lt;i&gt;hello to you&lt;/i&gt;. 1 &lt; 5"
  </code></pre>
  
  <p>because it converts each to</p>
  
  <pre><code>&amp;lt; and &amp;gt;
  </code></pre>
  
  <p>Note that the string may contain &lt; or > inside. I'm totally stuck.</p>