Skip to content

Commit 161ceb8

Browse files
committed
Allow to use unqualified symbols to link to current ns
1 parent b53c5c6 commit 161ceb8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/nextjournal/clerk/viewer.cljc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,13 @@
724724
(when-some [var (try (requiring-resolve sym)
725725
(catch Exception _ nil))]
726726
(merge {:var var} (resolve-internal-link (-> var symbol namespace))))
727-
(when-some [ns (try (require sym)
728-
(find-ns sym)
729-
(catch Exception _ nil))]
727+
(if-some [ns (try (require sym)
728+
(find-ns sym)
729+
(catch Exception _ nil))]
730730
(cond-> {:ns ns}
731731
(fs/exists? (analyzer/ns->file sym))
732-
(assoc :path (analyzer/ns->file sym)))))))))
732+
(assoc :path (analyzer/ns->file sym)))
733+
(resolve-internal-link (str (ns-name *ns*) "/" link))))))))
733734

734735
#_(resolve-internal-link "notebooks/hello.clj")
735736
#_(resolve-internal-link "nextjournal.clerk.tap")

0 commit comments

Comments
 (0)