Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ jobs:
- name: 🧪 Run tests
shell: bash
run: |
bb test:bb
# temporarily using dev build because of https://github.com/babashka/sci/issues/1011
bash <(curl https://raw.githubusercontent.com/babashka/babashka/master/install) --dev-build --dir /tmp
/tmp/bb test:bb

static-build:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
weavejester/dependency {:mvn/version "0.2.1"}
com.nextjournal/beholder {:mvn/version "1.0.3"}
org.flatland/ordered {:mvn/version "1.15.12"}
io.github.nextjournal/markdown {:mvn/version "0.7.189"}
io.github.nextjournal/markdown {:mvn/version "0.7.213"}
babashka/process {:mvn/version "0.4.16"}
io.github.nextjournal/dejavu {:git/sha "7276cd9cec1bad001d595b52cee9e83a60d43bf0"}
io.github.babashka/sci.nrepl {:mvn/version "0.0.2"}
Expand Down
9 changes: 5 additions & 4 deletions src/nextjournal/clerk/parser.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@
([{:as opts :keys [skip-doc?]} initial-state s]
(binding [*ns* (:ns initial-state *ns*)]
(loop [{:as state :keys [nodes blocks block-settings add-comment-on-line? add-block-id]}

(assoc initial-state
:nodes (:children (try (p/parse-string-all s)
(catch Exception e
Expand Down Expand Up @@ -471,16 +470,18 @@
:settings (merge-settings next-block-settings (parse-local-block-settings form))
:text nstring
:form (add-loc opts loc form)
:loc loc}]
(when (ns? form)
:loc loc}
ns? (ns? form)]
(when ns?
(eval form))
(cond-> (-> state
(assoc :add-comment-on-line? true)
(update :nodes rest)
(assoc :block-settings next-block-settings)
(update :blocks conj (add-block-id code-block)))
(not (contains? state :ns))
(assoc :ns *ns*)))
(assoc :ns *ns*)
ns? (update :md-context merge (:nextjournal.clerk/markdown (meta *ns*)))))
(and add-comment-on-line? (whitespace-on-line-tags (n/tag node)))
(-> state
(assoc :add-comment-on-line? (not (n/comment? node)))
Expand Down
7 changes: 6 additions & 1 deletion test/nextjournal/clerk/parser_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ line\""}]
(testing "reading a bad block shows block and file info in raised exception"
(is (thrown-match? clojure.lang.ExceptionInfo
{:file string?}
(parser/parse-clojure-string {:doc? true :file "foo.clj"} "##boom")))))
(parser/parse-clojure-string {:doc? true :file "foo.clj"} "##boom"))))
(testing "markdown settings"
(is (= "$1 + $2 = $3"
(-> (parser/parse-clojure-string "(ns foo {:nextjournal.clerk/markdown {:disable-inline-formulas true}})
;; $1 + $2 = $3")
:blocks second :doc :content first :content first :text)))))

(deftest parse-inline-comments
(is (match? {:blocks [{:doc {:content [{:content [{:text "text before"}]}]}}
Expand Down
Loading