/
example.cljc
64 lines (43 loc) · 1.36 KB
/
example.cljc
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(ns example
"Cljdoc supports CommonMark in docstrings.
Test doc block will scan docstrings for CommonMark Clojure code blocks and generate tests for them.
Test doc blocks currently ONLY looks at doc strings, so if your code block need specific requires,
you'll have to include in your at least your first block.
In this namespace doc string we'll include 2 blocks:
```Clojure
(+ 1 2 3)
;; => 6
```
Escape chars hinder readability a bit in plain text, but should look good under cljdoc.
```Clojure
(require '[clojure.string :as string])
(string/replace \"what,what\" \"what\" \"who\")
;; => \"who,who\"
```")
(defn fn1
"No code blocks so will be skipped" [])
(defn fn2
"This code block will be found:
```Clojure
user=> (* 8 8)
64
```"
[])
(defn fn3
"All the test-doc-block inline options are available, let's try one:
<!-- :test-doc-blocks/skip -->
```Clojure
(brace yourself
```
If the block were not skipped it would not parse and cause a failure."
[])
(defn fn4
"Let's try and use that `string` alias that we required in the namespace docstring.
Escaped embedded quotes are not pretty in plain text, they are handled.
```Clojure
(string/upper-case \"all \\\"good\\\"?\")
=> \"ALL \\\"GOOD\\\"?\"
```" [_x _y _z])
(comment
(println "\"hey\\\" dude\"")
)