comment-node
function
rewrite-clj.node/comment-node
(comment-node [s] [prefix s])Create node representing a comment with text `s`.
You may optionally specify a `prefix` of `";"` or `"#!"`, defaults is `";"`.
Argument `s`:
- must not include the `prefix`
- usually includes the trailing newline character, otherwise subsequent nodes will be on the comment line
```Clojure
(require '[rewrite-clj.node :as n])
(-> (n/comment-node "; my comment\n")
n/string)
;; => ";; my comment\n"
(-> (n/comment-node "#!" "/usr/bin/env bb\n")
n/string)
;; => "#!/usr/bin/env bb\n"
```
Examples
No examples yet. Be the first to add one!