Source

atlassian-markdown / atlassian-markdown-core / src / test / java / com / atlassian / labs / markdown / TestPageDownInBrowser.html

Full commit
<html>
<head>
    <script type="text/javascript"
            src="http://code.jquery.com/jquery-1.7.2.min.js"></script>

    <script type="text/javascript"
            src="../../../../../../../src/main/resources/pagedown/js/Markdown.Converter.js"></script>
    <script type="text/javascript"
            src="../../../../../../../src/main/resources/pagedown/js/Markdown.Sanitizer.js"></script>
    <script type="text/javascript"
            src="../../../../../../../src/main/resources/pagedown/js/Markdown.SharedSecret.js"></script>


    <script>
        // Testing in a browser gives us a debugger so we can work out whats going on?
        convertFunc = function () {

            converter = Markdown.getSharedSecretConverter();

            var markdownText = document.getElementById('markdownText');
            var testarea = document.getElementById('testarea');

            testarea.innerHTML = converter.makeHtml(markdownText.value);

        };

        $(function () {


            $('#convertButton').bind('click', function() {
                convertFunc();
            });

            var asItypeFunc = function () {
                if ($("#asitype:checked").length > 0) {
                    window.setTimeout(convertFunc,0);
                }
            };
            $('#markdownText').bind('keypress', asItypeFunc);
            $('#markdownText').bind('keydown', asItypeFunc);
        })

    </script>
</head>
<body onload="convertFunc()">
<p>Testing Markdown library</p>
<textarea id="markdownText" rows="15" cols="200">

term
 : definithion

Table
-----------------

|a |b |c
|--|--|--
|1 |2 |3

or

a |b |c
--|--|--
1 |2 |3

alignment

  rigt|left  | center
-----:|:-----|------
 0001 | 2    | 003
   4  | 0005 |  6


A First Level Header
====================


And this comes to the second level

Here
----

    public String markdown(final String text, final IssueRenderContext issueRenderContext)
    {
    // PageDown invocation
    String markdown = new PageDownMarkdown().markdown(text);

    markdown = JiraKeyUtils.linkBugKeys(markdown);
    markdown = replaceMentionsWithNames(markdown, issueRenderContext);

    return markdown;
    }

and then some images like ![Alt text](http://images.wikia.com/disney/images/0/00/Captain_Hook.png)

This is [an example](http://example.com/ "Title") inline link.

[This link](http://example.net/) has no title attribute.

And then there is a [link like this][1] that has used reference notation

[1]: http://reference.notation.com

</textarea>
<input type="checkbox" id="asitype" checked="checked"/>
<button id="convertButton">Convert</button>

<div>
    Generated Markdown Below
</div>
<hr/>
<div id="testarea">
</div>

</body>
</html>