My Rails app is retrieving data from a third-party service that doesn't allow me to attach arbitrary data to records, but does have a description area that supports Markdown. I am attempting to pass data for each record over to my Rails app within the description content, via Markdown comments:
[//]: # (POST:28|USERS:102,78,90)
... additional Markdown content.
I found the [//]: # (...)
syntax in this answer for embedding comments in Markdown, and my idea was to then pass pipe-separated key-value pairs in as the comment content.
Using my example above, I would like to be able to parse the description content string to interpret the key-value pairs. In this case, POST=28
and USERS=102,78,90
. If it helps, this comment will always appear at the first line of the Markdown content.
I imagine Regex is the way to go here? I would really appreciate any help!