~subsetpark/bagatto

ref: HEAD bagatto/test/markdown.janet -rw-r--r-- 1.3 KiB
4fc04b3a — Zach Smith Add render some 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(import testament :prefix "" :exit true)
(import /bagatto)

(setdyn :executable-blacklist {})

(deftest render-nested-md
  (let [nesting ```
                * [one](https://janetdocs.com)
                    * [two](https://janetdocs.com)
                        * [three](https://janetdocs.com)
                            * [four](https://janetdocs.com)
                                * [five](https://janetdocs.com)
                ```
        expected "<ul>\n<li><a href=\"https://janetdocs.com\">one</a>\n<ul>\n<li><a href=\"https://janetdocs.com\">two</a>\n<ul>\n<li><a href=\"https://janetdocs.com\">three</a>\n<ul>\n<li><a href=\"https://janetdocs.com\">four</a>\n<ul>\n<li><a href=\"https://janetdocs.com\">five</a></li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n"
        rendered (bagatto/markdown->html nesting)]
    (is (= expected rendered))))

(deftest render-footnote
  (let [footnote ```
                 foo[^bar]

                 [^bar]: baz
                 ```
        expected "<p>foo<sup class=\"footnote-ref\"><a href=\"#fn1\" id=\"fnref1\">1</a></sup></p>\n<section class=\"footnotes\">\n<ol>\n<li id=\"fn1\">\n<p>baz <a href=\"#fnref1\" class=\"footnote-backref\">\xE2\x86\xA9</a></p>\n</li>\n</ol>\n</section>\n"
        rendered (bagatto/markdown->html footnote)]
    (is (= expected rendered))))

(run-tests!)