Skip to content

Commit

Permalink
try cljdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
darkleaf committed Nov 8, 2022
1 parent c4d3b22 commit f93710f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 32 deletions.
6 changes: 3 additions & 3 deletions build.clj
Expand Up @@ -3,8 +3,8 @@
[clojure.tools.build.api :as b]
[clojure.string :as str]))

(def lib 'org.clojars.darkleaf/di)
(def version "1.0.1")
(def lib 'org.clojars.darkleaf/di-test-cljdoc)
(def version "test-cljdoc2-SNAPSHOT")
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def jar-file (format "target/%s.jar" (name lib)))
Expand Down Expand Up @@ -39,7 +39,7 @@
:jar-file jar-file}))

(defn sync-pom [_]
(b/copy-file {:src (str class-dir "/META-INF/maven/org.clojars.darkleaf/di/pom.xml")
(b/copy-file {:src (str class-dir "/META-INF/maven/org.clojars.darkleaf/di-test-cljdoc/pom.xml")
:target "pom.xml"}))

(defn all [_]
Expand Down
6 changes: 4 additions & 2 deletions deps.edn
@@ -1,5 +1,7 @@
{:deps {}
:aliases {:dev {:extra-paths ["test"]}
:aliases {:dev {:extra-paths ["test"]
:extra-deps {io.github.cljdoc/cljdoc
{:git/sha "bfdb2eb41926e26b3a1e0d71f47aa008e18fdefb"}}}
:test {:extra-paths ["test"]
:extra-deps {io.github.cognitect-labs/test-runner
{:git/tag "v0.5.0" :git/sha "b3fd0d2"}}
Expand All @@ -11,7 +13,7 @@
:deploy {:deps {slipset/deps-deploy {:mvn/version "0.2.0"}}
:exec-fn deps-deploy.deps-deploy/deploy
:exec-args {:installer :remote
:artifact "target/di.jar"}}}}
:artifact "target/di-test-cljdoc.jar"}}}}

;; clj -T:build
;; clj -T:deploy
3 changes: 3 additions & 0 deletions doc/cljdoc.edn
@@ -0,0 +1,3 @@
{:extension-namespaces [darkleaf.di.internal.cljdoc]
:cljdoc.doc/tree
[["Intro" {:file "test/darkleaf/id/tutorial/a_intro_test.clj"}]]}
27 changes: 0 additions & 27 deletions pom.xml
@@ -1,37 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<groupId>org.clojars.darkleaf</groupId>
<artifactId>di</artifactId>
<name>di</name>
<scm>
<url>git@github.com:darkleaf/di.git</url>
<connection>scm:git:git@github.com:darkleaf/di.git</connection>
<developerConnection>scm:git:git@github.com:darkleaf/di.git</developerConnection>
<tag>9315abb8e7b4f634eba0c08acbd7f0985cb61140</tag>
</scm>
<licenses>
<license>
<name>Eclipse Public License 2.0</name>
<url>https://www.eclipse.org/legal/epl-2.0/</url>
</license>
</licenses>
<build>
<sourceDirectory>src</sourceDirectory>
</build>
<repositories>
<repository>
<id>clojars</id>
<url>https://repo.clojars.org/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>1.10.3</version>
</dependency>
</dependencies>
<version>1.0.1</version>
</project>
19 changes: 19 additions & 0 deletions src/darkleaf/di/internal/cljdoc.clj
@@ -0,0 +1,19 @@
(ns darkleaf.di.internal.cljdoc
{:no-doc true}
(:require
[cljdoc.doc-tree :as doc-tree]
[cljdoc.render.rich-text :as rich-text]))

(defn clj->md [content]
(str "```clojure\n" content "\n```"))

(defmethod doc-tree/filepath->type "clj" [_]
:darkleaf/clj)

(defmethod rich-text/render-text :darkleaf/clj [[_ content]]
(-> content
clj->md
rich-text/markdown-to-html))

(defmethod rich-text/determine-features :darkleaf/clj [[_ content]]
nil)

0 comments on commit f93710f

Please sign in to comment.