import { parse_md_to_html } from './makoto'; import { test_assert_equal, total_tests, failed_tests, passed_tests } from './endosulfan'; /* Quirks - Headings are given automatically generated ids ('header-0', 'header-1' etc) so url anchors (https://example.com/blog#header-1) are possible - Will only put newlines after headings, paragraphs, and horizontal rules, all others will not be in final output (exception is it will not put a newline on the last line, and also it will leave in newlines in code blocks) - */ //tests test_assert_equal(parse_md_to_html("a\n\n\nb"), "

a

\n

b

", "new line test 1"); test_assert_equal(parse_md_to_html("a\n\n\nb\n"), "

a

\n

b

", "new line test 2"); test_assert_equal(parse_md_to_html("a\n\n\nb\n\n"), "

a

\n

b

", "new line test 3"); test_assert_equal(parse_md_to_html("# testing\n## Heading#\n# Chee see\nlorem ipsum"), "

testing

\n

Heading#

\n

Chee see

\n

lorem ipsum

", "heading test 1"); test_assert_equal(parse_md_to_html("in the sam#e way# bricks don't\n# Yay\n#a# b"), "

in the sam#e way# bricks don't

\n

Yay

\n

#a# b

", "heading test 2"); test_assert_equal(parse_md_to_html("# "), "

<script>a<bc</script>

", "sanitize test"); test_assert_equal(parse_md_to_html("# tet offensive\n"), "

tet offensive

", "heading test 3"); test_assert_equal(parse_md_to_html("**test abc** *a*\n## **ch*ch**"), "

test abc a

\n

ch*ch

", "bold italic test 1"); test_assert_equal(parse_md_to_html("****a*"), "

a*

", "bold italic test 2"); test_assert_equal(parse_md_to_html("---\n--\n----\n--a-\n---"), "
\n

--

\n
\n

--a-

\n
", "horizontal rule test"); test_assert_equal(parse_md_to_html("\\*\\*cheese\\*\\*\n*\\*cheese\\*\\*"), "

**cheese**

\n

*cheese*

", "backslash test"); test_assert_equal(parse_md_to_html("asdf![alt text](/images/ming-dynasty.png)\n![(burger!)](https://burger.com/burger.png)"), "

asdf\"alt

\n\"(burger!)\"", "image test"); test_assert_equal(parse_md_to_html("asdf![alt text(/images/ming-dynasty.png)\n![burgeerr](wee.pong\n)"), "

asdf![alt text(/images/ming-dynasty.png)

\n

![burgeerr](wee.pong

\n

)

", "invalid image test"); test_assert_equal(parse_md_to_html("Yo quiero [cheeseburger](https://wendys.org/burger).\n[Con cheerios.](/cheerios)"), "

Yo quiero cheeseburger.

\n

Con cheerios.

", "link test 1"); test_assert_equal(parse_md_to_html("[a](b)\n[fake link](oops"), "

a

\n

[fake link](oops

", "link test 2"); test_assert_equal(parse_md_to_html("`e\n\\`testing `console.log('*koala*');`"), "

`e

\n

`testing console.log('*koala*');

", "code snippet test"); test_assert_equal(parse_md_to_html("## testing\n```markdown\n# title\n i like **cheeseburgers** and `code`\n```\n```"), "

testing

\n
\n# title\n i like **cheeseburgers** and `code`\n
\n

`

", "code block test"); //todo: blockquotes, ordered lists, unordered lists, table, code block console.log(`Total Passed: \x1B[32m${passed_tests}/${total_tests}\x1B[m\nTotal Failed: \x1B[31m${failed_tests}/${total_tests}\x1B[m`);