diff --git a/cider-clojuredocs.el b/cider-clojuredocs.el index 50e7620a7..c2b10cd1a 100644 --- a/cider-clojuredocs.el +++ b/cider-clojuredocs.el @@ -116,17 +116,22 @@ 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) - (insert-text-button (format "* %s\n" see-also) + (insert "* ") + (insert-text-button see-also 'sym see-also 'action (lambda (btn) (cider-clojuredocs-lookup (button-get btn 'sym))) - 'help-echo (format "Press Enter or middle click to jump to %s" see-also))) + 'help-echo (format "Press Enter or middle click to jump to %s" see-also)) + (insert "\n")) (insert "Not available\n")) (insert "\n== Examples\n\n") (if-let ((examples (nrepl-dict-get dict "examples")))