diff --git a/deps.edn b/deps.edn index b836179..5d62fb5 100644 --- a/deps.edn +++ b/deps.edn @@ -1,18 +1,31 @@ {:paths ["src" "resources" "classes"] + :mvn/repos {"jitpack.io" {:url "https://jitpack.io"}} :deps {applied-science/js-interop {:mvn/version "0.3.3"} org.clojure/data.json {:mvn/version "2.4.0"} org.graalvm.js/js {:mvn/version "21.3.2.1"} ;; commonmark - ;; org.commonmark/commonmark {:mvn/version "0.22.0"} - ;; use temporary jitpack commit until release - ;; com.github.commonmark/commonmark-java {:mvn/version "3733963"} - com.github.commonmark/commonmark-java {:local/root "./jars/commonmark-0.22.1-SNAPSHOT.jar"} - org.commonmark/commonmark-ext-task-list-items {:local/root "./jars/commonmark-ext-task-list-items-0.22.1-SNAPSHOT.jar"} - org.commonmark/commonmark-ext-footnotes {:local/root "./jars/commonmark-ext-footnotes-0.22.1-SNAPSHOT.jar"} - } + ;;org.commonmark/commonmark {:mvn/version "0.22.0"} + ;;org.commonmark/commonmark-ext-task-list-items {:mvn/version "0.22.0"} - :mvn/repos {"jitpack.io" {:url "https://jitpack.io"}} + ;; use jitpack until release + com.github.commonmark/commonmark-java {:mvn/version "faea2a2a61cfa1b1f26a4e914532b651b3602e34"} + com.github.commonmark.commonmark-java/commonmark-ext-task-list-items {:mvn/version "faea2a2a61cfa1b1f26a4e914532b651b3602e34"} + + ;; jitpack bisect + + ;; origin/main bad + ;; 7b48401897a0c0bf46e757445a20deab78796101 bad (first) + + ;; faea2a2a61cfa1b1f26a4e914532b651b3602e34 good + ;; dd0a4be86643ba95da7304336e2ab123a74d0e35 good + ;; 3733963538bd52d619da40508d837186316dadbb good + + ;; jitpack stopped working as of commit, use local jars + ;; com.github.commonmark/commonmark-java {:local/root "./jars/commonmark-0.22.1-SNAPSHOT.jar"} + ;; org.commonmark/commonmark-ext-task-list-items {:local/root "./jars/commonmark-ext-task-list-items-0.22.1-SNAPSHOT.jar"} + ;; org.commonmark/commonmark-ext-footnotes {:local/root "./jars/commonmark-ext-footnotes-0.22.1-SNAPSHOT.jar"} + } :aliases {:nextjournal/clerk @@ -55,9 +68,6 @@ :git/sha "e8f275b5cf077ec9441e404c1885ff0b6ee0aef9" :deps/root "render"}}} - :commonmark-java-local - {:extra-paths ["../commonmark-java/commonmark/target/classes"]} - :build {:ns-default build :deps {io.github.clojure/tools.build {:git/tag "v0.6.1" :git/sha "515b334"} diff --git a/jars/commonmark-0.22.1-SNAPSHOT.jar b/jars/commonmark-0.22.1-SNAPSHOT.jar deleted file mode 100644 index e81fd26..0000000 Binary files a/jars/commonmark-0.22.1-SNAPSHOT.jar and /dev/null differ diff --git a/jars/commonmark-ext-footnotes-0.22.1-SNAPSHOT.jar b/jars/commonmark-ext-footnotes-0.22.1-SNAPSHOT.jar deleted file mode 100644 index 12df984..0000000 Binary files a/jars/commonmark-ext-footnotes-0.22.1-SNAPSHOT.jar and /dev/null differ diff --git a/jars/commonmark-ext-task-list-items-0.22.1-SNAPSHOT.jar b/jars/commonmark-ext-task-list-items-0.22.1-SNAPSHOT.jar deleted file mode 100644 index 360f7d4..0000000 Binary files a/jars/commonmark-ext-task-list-items-0.22.1-SNAPSHOT.jar and /dev/null differ diff --git a/src/nextjournal/markdown.cljc b/src/nextjournal/markdown.cljc index 577ef44..8168667 100644 --- a/src/nextjournal/markdown.cljc +++ b/src/nextjournal/markdown.cljc @@ -4,7 +4,6 @@ [nextjournal.markdown.parser.impl.utils :as u] [nextjournal.markdown.transform :as markdown.transform])) - ;; TODO: remove fixme (shadow compile warnings) (defn tokenize [_] []) diff --git a/src/nextjournal/markdown/parser/impl.clj b/src/nextjournal/markdown/parser/impl.clj index 473b760..4c796b7 100644 --- a/src/nextjournal/markdown/parser/impl.clj +++ b/src/nextjournal/markdown/parser/impl.clj @@ -5,7 +5,7 @@ [nextjournal.markdown.parser.impl.utils :as u]) (:import (org.commonmark.parser Parser) (org.commonmark.ext.task.list.items TaskListItemsExtension TaskListItemMarker) - (org.commonmark.ext.footnotes FootnotesExtension FootnoteReference FootnoteDefinition InlineFootnote) + #_ (org.commonmark.ext.footnotes FootnotesExtension FootnoteReference FootnoteDefinition InlineFootnote) (org.commonmark.node Node AbstractVisitor Document BlockQuote @@ -56,6 +56,7 @@ builder (extensions [(formulas/extension) (TaskListItemsExtension/create) + #_ (.. (FootnotesExtension/builder) (inlineFootnotes true) (build))]) @@ -137,6 +138,7 @@ :attrs {:src (.getDestination node) :title (.getTitle node)} :content []}) z/down z/rightmost)))) +#_ (defmethod open-node FootnoteDefinition [ctx ^FootnoteDefinition node] (-> ctx (assoc :root :footnotes) @@ -145,10 +147,10 @@ (z/append-child {:type :footnote :label (.getLabel node) :content []}) z/down z/rightmost))))) - +#_ (defmethod close-node FootnoteDefinition [ctx ^FootnoteDefinition _node] (-> ctx (update-current z/up) (assoc :root :doc))) - +#_ (defmethod open-node InlineFootnote [{:as ctx :keys [label->footnote-ref]} ^InlineFootnote _node] (let [label (str "note-" (count label->footnote-ref)) footnote-ref {:type :footnote-ref @@ -165,7 +167,7 @@ :inline? true :label label :content []}) z/down z/rightmost)))))) - +#_ (defmethod close-node InlineFootnote [ctx ^FootnoteDefinition _node] (-> ctx (update-current z/up) (assoc :root :doc))) @@ -197,6 +199,7 @@ TaskListItemMarker (swap! !ctx update-current handle-todo-list node) InlineFormula (swap! !ctx update-current z/append-child {:type :formula :text (.getLiteral ^InlineFormula node)}) BlockFormula (swap! !ctx update-current z/append-child {:type :block-formula :text (.getLiteral ^BlockFormula node)}) + #_#_ FootnoteReference (swap! !ctx (fn [{:as ctx :keys [label->footnote-ref]}] (let [label (.getLabel ^FootnoteReference node) footnote-ref (or (get label->footnote-ref label)