greywolve / cryogen-markdown-external

A Clojure library to provide Markdown rendering to the cryogen-core compiler by using an external command/program, such as pandoc.
MIT License
8 stars 0 forks source link

Duplicates posts and pages #1

Open jgoodhcg opened 4 years ago

jgoodhcg commented 4 years ago

This repo hasn't seen any attention in 4 years so I expect this issue to not to be resolved. I spent awhile figuring it out though so I need the closure of at least making the issue.

Included this dependency in an attempt to get some custom styling on footnotes in my cryogen posts.

With the cryogen-core version 0.3.1 it causes posts to be duplicated.

compiling pages                                                
--> /pages-output/2020-01-31-test-page
--> /pages-output/2019-11-22-resume
--> /pages-output/2020-01-31-test-page
--> /pages-output/2019-11-22-resume
compiling posts                                                
--> /posts-output/2020-01-26-expo-shadow-cljs-starter
--> /posts-output/2020-01-26-expo-shadow-cljs-starter
--> /posts-output/2019-07-21-hello-world
--> /posts-output/2019-07-21-hello-world

I've tracked it down to the markup-registry having too many values of a markdown processor when this dependency is included.

cryogen-core.compiler> @cryogen-core.markup/markup-registry
[#object[cryogen_markdown_external.core$markdown_external$reify__30860 0x36c04c8b "cryogen_markdown_external.core$markdown_external$reify__30860@36c04c8b"]
 #object[cryogen_flexmark.core$markdown$reify__30876 0x44b03454 "cryogen_flexmark.core$markdown$reify__30876@44b03454"]]

The multiple values causes the read-posts/pages fn to process all posts/pages twice.

(defn read-posts
  "Returns a sequence of maps representing the data from markdown files of posts.
   Sorts the sequence by post date."
  [config]
  (->> (m/markups)
       (mapcat
         (fn [mu]
           (->>
             (find-posts config mu)
greywolve commented 1 year ago

Hey @jgoodhcg , for some reason I completely missed your issue. My apologies. :)

Is there any obvious fix here? I haven't touched this code in years, but if it's not too hard to fix I'd be game.