;; Extension — callout / admonition block.

(st-bootstrap-classes!)
(content/bootstrap!)
(content-bootstrap-markdown!)
(content-bootstrap-text!)
(content-bootstrap-callout!)

(define c (mk-callout "c" "warning" "Be careful"))

;; ── identity ──
(content-test "callout is block" (block? c) true)
(content-test "callout? yes" (callout? c) true)
(content-test "callout type" (blk-type c) "callout")
(content-test "callout kind" (callout-kind c) "warning")

;; ── render ──
(content-test
  "callout html"
  (asHTML c)
  "<aside class=\"callout callout-warning\">Be careful</aside>")
(content-test
  "callout sx"
  (asSx c)
  "(aside :class \"callout callout-warning\" \"Be careful\")")
(content-test "callout text" (asText c) "Be careful")
(content-test "callout markdown" (asMarkdown c) "> **warning:** Be careful")

;; ── html escapes text ──
(content-test
  "callout html escapes"
  (asHTML (mk-callout "c" "note" "a < b"))
  "<aside class=\"callout callout-note\">a &lt; b</aside>")

;; ── in a document ──
(define
  d
  (doc-append
    (doc-append (doc-empty "d") (mk-heading "h" 1 "T"))
    c))
(content-test
  "doc with callout html"
  (asHTML d)
  "<h1>T</h1><aside class=\"callout callout-warning\">Be careful</aside>")

;; ── validation ──
(content-test
  "valid callout"
  (content/valid? (doc-append (doc-empty "d") c))
  true)
(content-test
  "bad callout kind flagged"
  (content/issue-kinds
    (doc-append (doc-empty "d") (mk-callout "c" 5 "x")))
  (list "field"))
