Skip to content

Commit c8c4381

Browse files
katomusobbatsov
authored andcommitted
Change how docstring is formatted in ClojureDocs buffer
1 parent 0916372 commit c8c4381

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cider-clojuredocs.el

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,12 @@ opposite of what that option dictates."
116116
(let ((arglists (nrepl-dict-get dict "arglists")))
117117
(dolist (arglist arglists)
118118
(insert (format " [%s]\n" arglist)))
119-
(insert "\n")
120-
(insert (nrepl-dict-get dict "doc"))
121-
(insert "\n"))
119+
(when-let* ((doc (nrepl-dict-get dict "doc"))
120+
;; As this is a literal docstring from the source code and
121+
;; there are two spaces at the beginning of lines in docstrings,
122+
;; we remove them to make it align nicely in ClojureDocs buffer.
123+
(doc (replace-regexp-in-string "\n " "\n" doc)))
124+
(insert "\n" doc "\n")))
122125
(insert "\n== See Also\n\n")
123126
(if-let ((see-alsos (nrepl-dict-get dict "see-alsos")))
124127
(dolist (see-also see-alsos)

0 commit comments

Comments
 (0)