Skip to content

Conversation

borkdude
Copy link
Contributor

@borkdude borkdude commented May 20, 2025

I ran into this when porting my blog (see the commented line). Using nextjournal markdown now looks like this in my own code:

(defn markdown->html [file]
  (with-open [rdr (io/reader file)]
    (let [lines (line-seq rdr)]
      (println "Processing markdown for file:" (str file))
      (let [[_metadata n] (fm/parse-metadata-headers lines)
            lines (drop n lines)
            markdown-text (str/join \newline lines)]
        (->> markdown-text
             pre-process-markdown
             #_(md/parse)
             (md/->hiccup (assoc md.transform/default-hiccup-renderers
                                 :html-inline (fn [_ {:keys [text]}]
                                                (hiccup/raw text))
                                 :html-block (fn [_ {:keys [text]}]
                                               (hiccup/raw text))))
             (hiccup/html)
             str
             post-process-markdown)))))

@borkdude borkdude requested review from mk and zampino May 20, 2025 18:25
@zampino zampino merged commit a22f3ba into main May 21, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants