clerk

rgm 2023-12-03T16:35:59.078139Z

Is there a way to selectively hide comments from rendering? I want to hide eg. ;; vi:fdm=marker and ;; a folded section {{{ that control vim's code folding.

👀 1
rgm 2023-12-06T17:24:24.957559Z

ah, ok ... thanks for all that detail. I've learned stuff. On my particular issue, where I've landed is that I'll just shove the stuff that is extra foldable detail in a separate namespace then I don't need to see it in either clerk or vim. (It always takes me a while to figure out the simplest thing).

Andrea 2023-12-05T10:12:48.109119Z

hi @rgm I fear we don’t have a mechanism yet to selectively turn off markdown parsing of comments. When the expression allows it, maybe you can try with #_ , like in #_ vi:fdm=marker but I think it won’t work with the curly braces.

Andrea 2023-12-05T13:02:49.677719Z

On the other hand, you might try overriding the default renderer for markdown text nodes. In Clerk every markdown node has its own (customizable) renderer 🙂 That’d go in a notebook like:

(nextjournal.clerk/add-viewers! [(update nextjournal.clerk.viewer/markdown-viewer :add-viewers nextjournal.clerk.viewer/add-viewers
                             [{:name :nextjournal.markdown/text
                               :transform-fn (fn [{node :nextjournal/value}]
                                               (clerk/html [:span (str/replace (:text node) #"(\{\{\{|\}\}\})" "")]))}])])

Andrea 2023-12-05T13:05:02.347119Z

Or set it globally with (clerk/reset-viewers! :default (viewer/add-viewers [ … ]))