I have text like this in Markdown in my database which describes a location (a Place in Schema.org).
# This is a heading
This is a paragraph.
* list item in an unordered list
* another one with **bold** word
The Place has description
property which can be Text or TextObject.
I'm wondering is it OK to use the markdown (the text in the code block) above in my ld+json description
property, and/or to add the itemprop="description"
to the div element wrapping the generated HTML?
The TextObject specifies
A text file. The text can be unformatted or contain markup, html, etc.
but I'm unsure does this cover Markdown.
I use markedjs/marked to translate this to HTML on my website but that's irrelevant for this issue and is here for future reference.
It is actually more standard to provide the HTML-rendered version in the JSON-LD rather than as raw Markdown.
You can inject the HTML as the value of the description property in the ld+json script, that is after you have converted your Markdown to HTML
Like this
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Place",
"name": "Example Place",
"description": "<h1>This is a heading</h1><p>This is a paragraph.</p><ul><li>list item in an unordered list</li><li>another one with <strong>bold</strong> word</li></ul>"
}
</script>