メモ:RでMarkdownファイルから画像のパスだけ抜き出すにはcommonmarkとxml2?

いちどcommonmarkでHTMLに変換したのをxml2で読む、というのがまだるっこしく感じるんですけど、Markdownをパースしてリストにしてくれるパッケージとかないものなんでしょうか?

md <- "
test
====

plot1
-----
![this is plot1](./path/to/plot1)

plot2
-----
![this is plot1](./path/to/plot2)
"

library(commonmark)
library(xml2)
library(magrittr)

html <- md %>%
  markdown_html() %>%
  read_html()

html %>%
  xml_find_all(".//img") %>%
  xml_attr("src")
#> [1] "./path/to/plot1" "./path/to/plot2"