Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Last active May 1, 2025 05:16
Show Gist options
  • Save sogaiu/1cb64d5831a791a2edcd6ce38e1c7460 to your computer and use it in GitHub Desktop.
Save sogaiu/1cb64d5831a791a2edcd6ce38e1c7460 to your computer and use it in GitHub Desktop.
parse-md issue in remarkable
(import remarkable/init :as r)
(comment
(def sample
(string
" Try to move left from `zloc`, skipping over whitespace\n"
" and comment nodes.\n"
"\n"
" When at least one left move succeeds, return the z-location\n"
" for the last successful left move destination. Otherwise,\n"
" return nil.\n"
" "))
# error, at least in remarkable b0b7e5bd
(protect (r/parse-md sample))
# =>
[false
(string "expected string, symbol, keyword, array, tuple, table, "
"struct or buffer, got nil")]
# error, at least in remarkable b0b7e5bd
(protect (r/parse-md " "))
# =>
[false
(string "expected string, symbol, keyword, array, tuple, table, "
"struct or buffer, got nil")]
# error, at least in remarkable b0b7e5bd
(protect (r/parse-md "\t"))
# =>
[false
"bad slot #1, expected string, symbol, keyword or buffer, got nil"]
(r/parse-md "\n")
# =>
[:document @{:container? true :open? true} @[]]
# trimming whitespace from the right seems to prevent the error...
(r/parse-md (string/trimr sample))
# =>
[:document @{:container? true
:open? true}
@[[:paragraph @{:inlines? true
:open? false}
@[@"Try to move left from "
[:codespan @{} "zloc"]
@", skipping over whitespace\nand comment nodes."]]
[:paragraph @{:inlines? true
:open? false}
@[(buffer "When at least one left move succeeds, return the "
"z-location\nfor the last successful left move "
"destination. Otherwise,\nreturn nil.")]]]]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment