MarkdownUtil { public static void replaceCodeBlock(@NotNull List<String> lines) { new CodeBlockProcessor(lines).process(); } private  MarkdownUtil(); static void replaceHeaders(@NotNull List<String> lines); static void removeImages(@NotNull List<String> lines); static void replaceCodeBlock(@NotNull List<String> lines); static void generateLists(@NotNull List<String> lines);  }
@Test public void testReplaceCodeBlocks2() throws Exception { List<String> markdown = Arrays.asList( " text", " code block", "```", " code block too", "```", "simple text", " $ code", "\t$ code continues", "code done" ); MarkdownUtil.replaceCodeBlock(markdown); Assert.assertEquals( Arrays.asList( " text", "<pre><code>code block</code></pre>", "<pre><code>", " code block too", "</code></pre>", "simple text", "<pre><code>$ code", "$ code continues</code></pre>", "code done" ), markdown ); }
@Test public void testReplaceCodeBlocks() throws Exception { List<String> markdown = Arrays.asList(" Create the app:", "", " $ npm install -g express", " $ express /tmp/foo && cd /tmp/foo"); MarkdownUtil.replaceCodeBlock(markdown); Assert.assertEquals(Arrays.asList(" Create the app:", "", "<pre><code>$ npm install -g express", "$ express /tmp/foo && cd /tmp/foo</code></pre>"), markdown); }