Created
May 12, 2026 08:35
-
-
Save sogaiu/e6677fa3c8f5a51930aa36104578c8aa to your computer and use it in GitHub Desktop.
remarkable trees
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (import ../src/remarkable/remarkable :as r) | |
| (comment | |
| # paragraphs | |
| (def paragraphs | |
| `` | |
| This is the first paragraph. | |
| This is another paragraph. | |
| ``) | |
| (r/parse-md paragraphs) | |
| # => | |
| [:document @{:container? true :open? true} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[@"This is the first paragraph."]] | |
| [:paragraph @{:inlines? true :open? false} | |
| @[@"This is another paragraph."]]]] | |
| # code spans | |
| (def code-spans | |
| `` | |
| Hi there, `code`! How are your `function`s? | |
| ``) | |
| (r/parse-md code-spans) | |
| # => | |
| [:document @{:container? true :open? true} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[@"Hi there, " | |
| [:codespan @{} "code"] | |
| @"! How are your " | |
| [:codespan @{} "function"] | |
| @"s?"]]]] | |
| # unordered lists | |
| (def unordered-list | |
| `` | |
| * ant | |
| * bee | |
| * cat | |
| ``) | |
| (r/parse-md unordered-list) | |
| # => | |
| [:document @{:container? true :open? true} | |
| @[[:list @{:container? true :kind :bullet | |
| :marker "*" :open? false :tight? true} | |
| @[[:list-item @{:container? true :open? false :width 2} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[@"ant"]]]] | |
| [:list-item @{:container? true :open? false :width 2} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[@"bee"]]]] | |
| [:list-item @{:container? true :open? false :width 2} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[@"cat"]]]]]]]] | |
| # ordered lists | |
| (def ordered-list | |
| `` | |
| - one | |
| - two | |
| - three | |
| ``) | |
| (r/parse-md ordered-list) | |
| # => | |
| [:document @{:container? true :open? true} | |
| @[[:list @{:container? true :kind :bullet | |
| :marker "-" :open? false :tight? true} | |
| @[[:list-item @{:container? true :open? false :width 2} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[@"one"]]]] | |
| [:list-item @{:container? true :open? false :width 2} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[@"two"]]]] | |
| [:list-item @{:container? true :open? false :width 2} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[@"three"]]]]]]]] | |
| # fenced codeblocks (but only with backticks) | |
| (def fenced-codeblock | |
| ```` | |
| ``` | |
| (defn my-fn | |
| [x] | |
| 11) | |
| ``` | |
| ````) | |
| (r/parse-md fenced-codeblock) | |
| # => | |
| [:document @{:container? true :open? true} | |
| @[[:codeblock @{:delim "`" :indent 0 | |
| :kind :fenced :num 3 :open? false} | |
| @["(defn my-fn\n" | |
| " [x]\n" | |
| " 11)\n"]]]] | |
| # indented codeblocks | |
| (def indented-codeblock | |
| `` | |
| (def a 1) | |
| ``) | |
| (r/parse-md indented-codeblock) | |
| # => | |
| [:document @{:container? true :open? true} | |
| @[[:codeblock @{:kind :indented :open? false} | |
| @["(def a 1)"]]]] | |
| # emphasis | |
| (def emphasis | |
| `` | |
| *emphasized text* | |
| ``) | |
| (r/parse-md emphasis) | |
| # => | |
| [:document @{:container? true :open? true} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[[:emphasis @{} @[@"emphasized text"]]]]]] | |
| # strong emphasis | |
| (def strong-emphasis | |
| `` | |
| **strongly emphasized text** | |
| ``) | |
| (r/parse-md strong-emphasis) | |
| # => | |
| [:document @{:container? true :open? true} | |
| @[[:paragraph @{:inlines? true :open? false} | |
| @[[:strong @{} @[@"strongly emphasized text"]]]]]] | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment