branch: elpa/cider commit c8c43815c1d3f9559db72e3dca35c05724f50e8f Author: Kato Muso <m...@katomuso.io> Commit: Bozhidar Batsov <bozhi...@batsov.dev>
Change how docstring is formatted in ClojureDocs buffer --- cider-clojuredocs.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cider-clojuredocs.el b/cider-clojuredocs.el index 50e7620a7a..3ce5594ce5 100644 --- a/cider-clojuredocs.el +++ b/cider-clojuredocs.el @@ -116,9 +116,12 @@ opposite of what that option dictates." (let ((arglists (nrepl-dict-get dict "arglists"))) (dolist (arglist arglists) (insert (format " [%s]\n" arglist))) - (insert "\n") - (insert (nrepl-dict-get dict "doc")) - (insert "\n")) + (when-let* ((doc (nrepl-dict-get dict "doc")) + ;; As this is a literal docstring from the source code and + ;; there are two spaces at the beginning of lines in docstrings, + ;; we remove them to make it align nicely in ClojureDocs buffer. + (doc (replace-regexp-in-string "\n " "\n" doc))) + (insert "\n" doc "\n"))) (insert "\n== See Also\n\n") (if-let ((see-alsos (nrepl-dict-get dict "see-alsos"))) (dolist (see-also see-alsos)