/** Tests {@link Markdowns#clean(java.lang.String, java.lang.String)} for data XSS. */
  @Test
  public void clean() {
    final String md =
        "<a href='data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K'>a link</a>";

    final String html = Markdowns.toHTML(md);
    final String securedHTML = Markdowns.clean(html, "");

    Assert.assertFalse(securedHTML.contains("href"));
  }
  /** Tests {@link Markdowns#toHTML(java.lang.String)}. */
  @Test
  public void toHTML() {
    String md = "[b3log](http://b3log.org)";
    String html = Markdowns.toHTML(md);
    Assert.assertTrue(html.contains("href"));

    md = "[b3log](b3log.org)";
    html = Markdowns.toHTML(md);
    Assert.assertTrue(html.contains("href"));
  }
  /**
   * Tests {@link Markdowns#toHTML(java.lang.String)}.
   *
   * @throws java.lang.Exception exception
   */
  @Test
  public void toHtml0() throws Exception {
    final URL mdResource = MarkdownsTestCase.class.getResource("/markdown_syntax.text");
    final String md = IOUtils.toString(new FileReader(mdResource.getPath()));
    final String html = Markdowns.toHTML(md);

    // System.out.println(html);
  }
  /**
   * Test method for {@linkplain Markdowns#toHTML(java.lang.String)}.
   *
   * @throws Exception exception
   */
  @Test
  public void toHTML() throws Exception {
    String markdownText = "";
    String html = Markdowns.toHTML(markdownText);

    Assert.assertNull(html);

    markdownText = "# Solo Markdown Editor";
    html = Markdowns.toHTML(markdownText);

    System.out.println(html);

    System.out.println(MarkdownsTestCase.class.getResource("/"));
    final URL testFile = MarkdownsTestCase.class.getResource("/markdown_syntax.text");
    final String path = URLDecoder.decode(testFile.getPath(), "UTF-8");
    System.out.println(path);

    final StringBuilder markdownTextBuilder = new StringBuilder();
    @SuppressWarnings("unchecked")
    final List<String> lines = IOUtils.readLines(new FileInputStream(path));

    for (final String line : lines) {
      markdownTextBuilder.append(line).append(Strings.LINE_SEPARATOR);
    }

    markdownText = markdownTextBuilder.toString();
    System.out.println(markdownText);

    Stopwatchs.start("Markdowning");
    html = Markdowns.toHTML(markdownText);
    Stopwatchs.end();

    System.out.println(html);

    System.out.println("Stopwatch: ");
    System.out.println(Stopwatchs.getTimingStat());

    // HTML entity test
    markdownText = "The first: &#39; <br/> The second: &AElig;";
    html = Markdowns.toHTML(markdownText);

    System.out.println(html);
  }