{"id":18837930,"url":"https://github.com/nextjournal/markdown","last_synced_at":"2025-04-04T16:13:40.963Z","repository":{"id":36955942,"uuid":"485838040","full_name":"nextjournal/markdown","owner":"nextjournal","description":"A cross-platform clojure/script parser for Markdown","archived":false,"fork":false,"pushed_at":"2024-10-08T17:12:20.000Z","size":8033,"stargazers_count":55,"open_issues_count":7,"forks_count":7,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-28T15:07:26.142Z","etag":null,"topics":["clojure","clojurescript","markdown"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nextjournal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-26T15:11:35.000Z","updated_at":"2025-03-21T15:18:46.000Z","dependencies_parsed_at":"2024-04-10T10:26:27.768Z","dependency_job_id":"78775c63-3a59-440b-8bd9-8cf3952df30a","html_url":"https://github.com/nextjournal/markdown","commit_stats":{"total_commits":75,"total_committers":2,"mean_commits":37.5,"dds":"0.013333333333333308","last_synced_commit":"78f58b21a7efaec36a99d0b93f0db75830e8c1fa"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextjournal%2Fmarkdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextjournal%2Fmarkdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextjournal%2Fmarkdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextjournal%2Fmarkdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nextjournal","download_url":"https://codeload.github.com/nextjournal/markdown/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208140,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","clojurescript","markdown"],"created_at":"2024-11-08T02:37:09.209Z","updated_at":"2025-04-04T16:13:40.944Z","avatar_url":"https://github.com/nextjournal.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nextjournal markdown\n\n[![Clojars Project](https://img.shields.io/clojars/v/io.github.nextjournal/markdown.svg)](https://clojars.org/io.github.nextjournal/markdown) [![Notebooks](https://img.shields.io/static/v1?label=clerk\u0026message=notebooks\u0026color=rgb(155,187,157))](https://nextjournal.github.io/markdown)\n\nA cross-platform clojure library for [Markdown](https://en.wikipedia.org/wiki/Markdown) parsing and transformation.\n\n🚧 _ALPHA_ status, subject to frequent change. For a richer reading experience [read this readme as a clerk notebook](https://nextjournal.github.io/markdown/README).\n\n## Features\n\n* _Focus on data_: parsing yields an AST ([à la Pandoc](https://nextjournal.github.io/markdown/notebooks/pandoc)) of nested data representing a structured document.\n* _Cross Platform_: using [commonmark-java](https://github.com/commonmark/commonmark-java) on the JVM and [markdown-it](https://github.com/markdown-it/markdown-it) for clojurescript\n* _Configurable [Hiccup](https://github.com/weavejester/hiccup) conversion_.\n\n## Try\n\n[Try it online](https://nextjournal.github.io/markdown/notebooks/try).\n\n## Flavor\n\nWe adhere to [CommonMark Spec](https://spec.commonmark.org/0.30/) and comply with extensions from [Github flavoured Markdown](https://github.github.com/gfm). Additionally, we parse $\\LaTeX$ formulas (delimited by a $ for inline rendering or $$ for display mode).\n\n## Usage\n\n```clojure\n(ns hello-markdown\n  (:require [nextjournal.markdown :as md]\n            [nextjournal.markdown.transform :as md.transform]))\n```\n\nParsing markdown into an AST:\n\n```clojure\n(def data \n  (md/parse \"\u003e et tout autour, la longue cohorte de ses personnages, avec leur histoire, leur passé, leurs légendes:\n\u003e 1. Pélage vainqueur d'Alkhamah se faisant couronner à Covadonga\n\u003e 2. La cantatrice exilée de Russie suivant Schönberg à Amsterdam\n\u003e 3. Le petit chat sourd aux yeux vairons vivant au dernier étage\n\u003e 4. ...\n\n**Georges Perec**, _La Vie mode d'emploi_.\n\n---\n\"))\n```\n    ;; =\u003e\n    {:type :doc,\n     :content [{:type :blockquote,\n                :content [{:type :paragraph,\n                           :content [{:type :text,\n                                      :text \"et tout autour, la longue cohorte de ses personnage, avec leur histoire, leur passé, leurs légendes:\"}]}\n                          {:type :numbered-list,\n                           :content [{:type :list-item,\n                                      :content [{:type :plain,\n                                                 :content [{:type :text,\n                                                            :text \"Pélage vainqueur d'Alkhamah se faisant couronner à Covadonga\"}]}]}\n                                     {:type :list-item,\n                                      :content [{:type :plain,\n                                                 :content [{:type :text,\n                                                            :text \"La cantatrice exilée de Russie suivant Schönberg à Amsterdam\"}]}]}\n                                     {:type :list-item,\n                                      :content [{:type :plain,\n                                                 :content [{:type :text,\n                                                            :text \"Le petit chat sourd aux yeux vairons vivant au dernier étage\"}]}]}]}]}\n               {:type :paragraph,\n                :content [{:type :strong, :content [{:type :text, :text \"Georges Perec\"}]}\n                          {:type :text, :text \", \"}\n                          {:type :em, :content [{:type :text, :text \"La Vie mode d'emploi\"}]}\n                          {:type :text, :text \".\"}]}\n               {:type :ruler}]}\n\nand transform that AST into `hiccup` syntax.\n\n```clojure\n(md.transform/-\u003ehiccup data)\n```\n    ;; =\u003e\n    [:div\n     [:blockquote\n      [:p \"et tout autour, la longue cohorte de ses personnage, avec leur histoire, leur passé, leurs légendes:\"]\n      [:ol\n       [:li [:\u003c\u003e \"Pélage vainqueur d'Alkhamah se faisant couronner à Covadonga\"]]\n       [:li [:\u003c\u003e \"La cantatrice exilée de Russie suivant Schönberg à Amsterdam\"]]\n       [:li [:\u003c\u003e \"Le petit chat sourd aux yeux vairons vivant au dernier étage\"]]]]\n     [:p [:strong \"Georges Perec\"] \", \" [:em \"La Vie mode d'emploi\"] \".\"]\n     [:hr]]\n\nWe've built hiccup transformation in for convenience, but the same approach can be used to target [more formats](https://nextjournal.github.io/markdown/notebooks/pandoc).\n\nThis library is one of the building blocks of [Clerk](https://github.com/nextjournal/clerk) where it is used for rendering _literate fragments_.\n\n```clojure\n^{:nextjournal.clerk/viewer 'nextjournal.clerk.viewer/markdown-viewer}\ndata\n```\n\nThe transformation of markdown node types can be customised like this:\n\n```clojure\n^{:nextjournal.clerk/viewer 'nextjournal.clerk.viewer/html-viewer}\n(md.transform/-\u003ehiccup\n (assoc md.transform/default-hiccup-renderers\n        ;; :doc specify a custom container for the whole doc\n        :doc (partial md.transform/into-markup [:div.viewer-markdown])\n        ;; :text is funkier when it's zinc toned \n        :text (fn [_ctx node] [:span {:style {:color \"#71717a\"}} (:text node)])\n        ;; :plain fragments might be nice, but paragraphs help when no reagent is at hand\n        :plain (partial md.transform/into-markup [:p {:style {:margin-top \"-1.2rem\"}}])\n        ;; :ruler gets to be funky, too\n        :ruler (constantly [:hr {:style {:border \"2px dashed #71717a\"}}]))\n data)\n```\n\n## Extensibility\n\nWe added minimal tooling for [extending markdown expressions](https://nextjournal.github.io/markdown/notebooks/parsing_extensibility).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextjournal%2Fmarkdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnextjournal%2Fmarkdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextjournal%2Fmarkdown/lists"}